Skip to content

Conversation

@0x12CC
Copy link
Contributor

@0x12CC 0x12CC commented Nov 20, 2025

This PR reapplies the changes from #20206. It also includes the following new changes:

  1. The coverage tools were moved from compiler dependencies to E2E test dependencies so that the SYCL toolchain can be be built without compiler-rt.
  2. A definition of __sycl_increment_profile_counters was added to fix build errors when building with Apple Clang.

0x12CC and others added 3 commits November 19, 2025 12:18
This PR extends Clang's source-based code coverage to work with SYCL
device code. It includes the following changes:

1. The `InstrProfilingLoweringPass` was updated to lower profiling
counters to SYCL device globals.
2. A new function was added to the compiler runtime to increment the
host-side profiling counters.
3. The SYCL runtime was updated to send the contents of the device-side
profiling counters to the new compiler runtime function when their
device global map entries are being freed.

This feature may not work correctly for functions that differ between
host and device due to the use of the `__SYCL_DEVICE_ONLY__` macro. In
such cases, it may not be possible to correlate the profiling counters
from the device to the host. Resolves intel#7803.

---------

Signed-off-by: Michael Aziz <[email protected]>
Co-authored-by: Steffen Larsen <[email protected]>
Signed-off-by: Michael Aziz <[email protected]>
@0x12CC 0x12CC requested review from a team and bader as code owners November 20, 2025 15:41
@0x12CC
Copy link
Contributor Author

0x12CC commented Nov 20, 2025

@steffenlarsen, @AlexeySachkov, could you please help review this updated PR. The new changes added to fix the post-commit failures are in 40f2af7 and 3d8fee6.

CmdArgs.push_back("-fdeclare-spirv-builtins");

// Set the atomic profile update flag to increment counters atomically.
CmdArgs.push_back("-fprofile-update=atomic");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this option only be passed when instrumentation is enabled? Also, please add/update a test verifying that this option being passed when needed.

Copy link
Contributor

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's try throwing it at post-commit again and see what happens! 🚀

@aelovikov-intel
Copy link
Contributor

Let's try throwing it at post-commit again and see what happens! 🚀

Push new branch to origin and trigger a manual post-commit run:
https://github.com/intel/llvm/actions/workflows/sycl-post-commit.yml
image

Copy link
Contributor

@AlexeySachkov AlexeySachkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two extra commits LGTM

@@ -1386,11 +1385,7 @@
options::OPT_fno_profile_generate, // -f[no-]profile-generate
options::OPT_ftest_coverage,
options::OPT_fno_test_coverage, // -f[no-]test-coverage
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are tests added for these options, please make sure they are removed as well.

@0x12CC
Copy link
Contributor Author

0x12CC commented Nov 20, 2025

@aelovikov-intel, could you please run the post-commit testing? I don't think I have the required permissions to create a new branch or manually run any workflow.

@aelovikov-intel
Copy link
Contributor

@aelovikov-intel, could you please run the post-commit testing? I don't think I have the required permissions to create a new branch or manually run any workflow.

https://github.com/intel/llvm/actions/runs/19546938418

Please ping me once that finishes to remove the branch.

@0x12CC
Copy link
Contributor Author

0x12CC commented Nov 20, 2025

Thanks, @aelovikov-intel. It's done so you can delete the branch.

The only test failure is in the Windows build:

Failed Tests (1):
  SYCL-Unit :: scheduler/./SchedulerTests_Non_Preview_Tests.exe/10/59

This is the same failure as in the post-commit testing for 2b96dd3 so it shouldn't be related to these changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants