Skip to content

Add workaround for ACPP allocation tracker destruction order - #343

Merged
GagaLP merged 1 commit into
masterfrom
fix/satic_destruction_order
Oct 21, 2026
Merged

GagaLP merged 1 commit into
masterfrom
fix/satic_destruction_order

Conversation

@GagaLP

@GagaLP GagaLP commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

AdaptiveCpp stores its USM allocation tracker in a function-local static that is initialized by the first allocation, i.e., after the runtime has registered its atexit shutdown handler. Consequently, the tracker is destroyed before the runtime frees its allocations, causing each sycl::free() call during shutdown to operate on a destroyed object. This results in heap corruption, manifesting as a hang on exit in release builds and a segmentation fault in debug builds.

By allocating memory once in the sycl_backend constructor, the tracker is initialized before the shutdown handler is registered and therefore outlives the runtime.

@GagaLP
GagaLP requested a review from PeterTh October 13, 2026 15:44
@github-actions

Copy link
Copy Markdown

Check-perf-impact results: (ae6918621b46271c2f10d6eb978fe95d)

❓ No new benchmark data submitted. ❓
Please re-run the microbenchmarks and include the results if your commit could potentially affect performance.

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 38424719415

Coverage remained the same at 95.052%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 7264
Covered Lines: 7159
Line Coverage: 98.55%
Relevant Branches: 3690
Covered Branches: 3253
Branch Coverage: 88.16%
Branches in Coverage %: Yes
Coverage Strength: 1818037.98 hits per line

💛 - Coveralls

@PeterTh PeterTh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@GagaLP
GagaLP merged commit d78d5d4 into master Oct 21, 2026
32 of 33 checks passed
@GagaLP
GagaLP deleted the fix/satic_destruction_order branch October 21, 2026 12:19
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.

3 participants