Skip to content

Conversation

@Rajveer100
Copy link
Member

@Rajveer100 Rajveer100 commented Jan 17, 2025

Fix #1274

Implements atomic thread fence synchronization primitive corresponding to atomic.thread_fence CIR.

@Rajveer100
Copy link
Member Author

I have just created the ODS definition at the moment to be sure if this is the way to go.

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

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

Initial step looks good, some inline comments. Note that this PR should come with CIRGen and LLVM lowering support, I suggest you first handle a very simple case of the fence and mark all paths not currently support with llvm_unrecheable("NYI"), so that you can go about working in incremental PRs to complete this.

@bcardosolopes bcardosolopes changed the title [CIRGen] Task 1: Support for builtin __atomic_thread_fence [CIR][CIRGen] Support for builtin __atomic_thread_fence Jan 21, 2025
@Rajveer100 Rajveer100 force-pushed the atomic-thread_signal-fence branch from c2cc1a9 to e8758ac Compare January 26, 2025 10:50
@bcardosolopes
Copy link
Member

We just went over a rebase against upstream, apologies for the churn but please update your branch for this PR and force-push!

@Rajveer100 Rajveer100 force-pushed the atomic-thread_signal-fence branch from e8758ac to ca75a57 Compare January 28, 2025 11:23
@ghehg ghehg self-requested a review January 28, 2025 20:57
@Rajveer100 Rajveer100 force-pushed the atomic-thread_signal-fence branch 2 times, most recently from 6425312 to 97fb189 Compare February 6, 2025 12:02
@Rajveer100
Copy link
Member Author

Rajveer100 commented Feb 6, 2025

Do we need a new definition for AtomicSyncScope in LLVMEnums.td like there's one for ordering and then retrieve conversion using getLLVM...()?

@Rajveer100 Rajveer100 requested a review from ghehg February 6, 2025 13:25
@ghehg
Copy link
Contributor

ghehg commented Feb 6, 2025

Do we need a new definition for AtomicSyncScope in LLVMEnums.td like there's one for ordering and then retrieve conversion using getLLVM...()?

That is kinda of territory of LLVM dialect. Currently llvm.fenceop uses stringattr to represent syncscope, and I assume it works meaning it lowers to LLVM IR without problem if we set it with right string value from clangir lowering to LLVM (dialect)

@Rajveer100 Rajveer100 force-pushed the atomic-thread_signal-fence branch from 97fb189 to 39bfe2b Compare February 7, 2025 08:13
@Rajveer100 Rajveer100 requested a review from ghehg February 7, 2025 11:33
@Rajveer100
Copy link
Member Author

From my sight I can see the following nits:

  • Better variable naming in the test suite
  • Finish the description to show example usage of the op

@Rajveer100 Rajveer100 force-pushed the atomic-thread_signal-fence branch 2 times, most recently from 1a626c7 to 83b33a7 Compare February 8, 2025 12:01
Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

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

Mostly good, few nits and ready to go

@Rajveer100 Rajveer100 force-pushed the atomic-thread_signal-fence branch from 83b33a7 to 8f81369 Compare February 10, 2025 11:28
@Rajveer100 Rajveer100 force-pushed the atomic-thread_signal-fence branch from 8f81369 to 35d7898 Compare February 11, 2025 08:30
@ghehg
Copy link
Contributor

ghehg commented Feb 11, 2025

LGMT, too

@Rajveer100 Rajveer100 force-pushed the atomic-thread_signal-fence branch from 35d7898 to 9699710 Compare February 12, 2025 08:35
Resolves llvm#1274

Implements atomic thread fence synchronization primitive
corresponding to `atomic.thread_fence` CIR.
@Rajveer100 Rajveer100 force-pushed the atomic-thread_signal-fence branch 2 times, most recently from a191e33 to 0a24062 Compare February 12, 2025 10:09
@Rajveer100 Rajveer100 force-pushed the atomic-thread_signal-fence branch from 0a24062 to 0ed0cb6 Compare February 12, 2025 10:46
@bcardosolopes bcardosolopes merged commit 6dd6d82 into llvm:main Feb 12, 2025
6 checks passed
lanza pushed a commit that referenced this pull request Mar 18, 2025
Fix #1274

Implements atomic thread fence synchronization primitive corresponding
to `atomic.thread_fence` CIR.
terapines-osc-cir pushed a commit to Terapines/clangir that referenced this pull request Sep 2, 2025
Fix llvm#1274

Implements atomic thread fence synchronization primitive corresponding
to `atomic.thread_fence` CIR.
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.

CIRGen support for *_atomic_{thread,signal}_fence

3 participants