Skip to content

Add feature flag for relaxed atomics - #8192

Merged
stevenfontanella merged 3 commits into
mainfrom
feature-flag
Jan 11, 2026
Merged

Add feature flag for relaxed atomics#8192
stevenfontanella merged 3 commits into
mainfrom
feature-flag

Conversation

@stevenfontanella

@stevenfontanella stevenfontanella commented Jan 9, 2026

Copy link
Copy Markdown
Member

Part of #8165. Add flag for --enable-relaxed atomics and enable it for the existing SafeHeap tests that previously implicitly depended on it. The next PR #8193 disables generation of AcqRel SafeHeap functions when the feature is disabled and adds new tests to cover that case.

Also validate that the feature is enabled when a module includes an AcqRel load operation (currently the only one we support).

@stevenfontanella
stevenfontanella force-pushed the feature-flag branch 3 times, most recently from 07df315 to 2f0fc13 Compare January 9, 2026 23:19
@stevenfontanella
stevenfontanella marked this pull request as ready for review January 10, 2026 00:03
;; NOTE: This test was ported using port_passes_tests_to_lit.py and could be cleaned up.

;; RUN: foreach %s %t wasm-opt --safe-heap --enable-threads --enable-simd --enable-memory64 -S -o - | filecheck %s
;; RUN: foreach %s %t wasm-opt --safe-heap --enable-threads --enable-simd --enable-memory64 --enable-relaxed-atomics -S -o - | filecheck %s

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Rather than adding relaxed-atomics to each of these files, let's make a new file that enables just relaxed atomics.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't understand, this test wouldn't pass without --enabled-relaxed-atomics because --safe-heap combined with --enable-threads will cause us to generate safe heap methods that use acqrel ordering (which the next PR fixes but we need this PR first). In the next PR #8193 I add an equivalent test without --enable-relaxed-atomics to show that the acqrel methods aren't added. Also we anyway need a test that enables both relaxed atomics and safe heap to show that the safe acqrel methods are added.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see. LGTM to land this as-is because of the dependencies between PRs. I think ultimately we don't need to have more than one SafeHeap test that enables relaxed-atomics, though. (Also we can make the test file names much shorter now that they are lit tests.)

@tlively tlively left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM % those comments.

Comment thread test/unit/test_features.py
@stevenfontanella
stevenfontanella merged commit 653c164 into main Jan 11, 2026
17 checks passed
@stevenfontanella
stevenfontanella deleted the feature-flag branch January 11, 2026 06:10
stevenfontanella added a commit that referenced this pull request Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants