[draft] SCoP detection

SCoP Detection

In the efforts to run Tadashi (Vatai et al., 2025) on real world applications we developed scop_detector (and the convenience wrapper scops_in_dir) to help identify potential apps and/or SCoPs within them.

SCoP detection in Tadashi

Tadashi extracts SCoPs from source files using PET (Verdoolaege & Grosser, 2012). The entry point of PET is the pet_transform_C_source() function, which processes each SCoP by executing a callback function it passed to pet_transform_C_source() as a parameter.

autodetect feature (in tadashi and in general)

scop_detecor similarly uses pet_transform_C_source(), but the callback, instead of transforming the scop, prints it as is with commented out scop/endscop pragmas (with an additional comment which indicates the index of the SCoP and makes it easier to locate the scops, like this

...
// #pragma scop // [N] //////////////////
<SCoP>
// #pragma endscop // [N] //////////////////

This allows the user to just uncomment the pragmas for Tadashi to fin the SCoPs. However, care must be take: if you uncomment the scop/endscop pragmas with index 0 and 2 (but leave SCoP with index 1 commented out), this will result in Tadashi skipping SCoP 1 and messing up the index of the third SCoP and SCoP with index 2 (in the comment generated by scop_detector) will have index 1 in Tadashi.

(setq display-line-numbers-type ‘visual)

References

  1. Tadashi: Enabling AI-Based Automated Code Generation With Guaranteed Correctness
    Emil Vatai, Aleksandr Drozd, Ivan R. Ivanov, and 3 more authors
    Jun 2025
    Comment: Submitted to SC25
  2. Polyhedral Extraction Tool
    Sven Verdoolaege and Tobias Grosser
    Jun 2012



Enjoy Reading This Article?

Here are some more articles you might like to read next:

  • [draft] SCoPing SNAP
  • a post with plotly.js
  • MPI4py under Slurm
  • Making Tadashi into a Python package
  • a post with image galleries