Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CIRGen support for *_atomic_{thread,signal}_fence #1274

Open
bcardosolopes opened this issue Jan 9, 2025 · 4 comments · May be fixed by #1287
Open

CIRGen support for *_atomic_{thread,signal}_fence #1274

bcardosolopes opened this issue Jan 9, 2025 · 4 comments · May be fixed by #1287
Assignees
Labels
good first issue Good for newcomers

Comments

@bcardosolopes
Copy link
Member

All the below are missing:

CodeGen/CIRGenBuiltin.cpp:  case Builtin::BI__atomic_thread_fence:
CodeGen/CIRGenBuiltin.cpp-  case Builtin::BI__atomic_signal_fence:
CodeGen/CIRGenBuiltin.cpp:  case Builtin::BI__c11_atomic_thread_fence:
CodeGen/CIRGenBuiltin.cpp-  case Builtin::BI__c11_atomic_signal_fence:
CodeGen/CIRGenBuiltin.cpp:    llvm_unreachable("BI__atomic_thread_fence like NYI");
@bcardosolopes bcardosolopes added the good first issue Good for newcomers label Jan 9, 2025
@bcardosolopes bcardosolopes changed the title CIRGen support for *thread_fence CIRGen support for *_atomic_{thread,signal}_fence Jan 9, 2025
@elhewaty
Copy link
Member

elhewaty commented Jan 9, 2025

I will give it a try, assign me please

@bcardosolopes
Copy link
Member Author

@elhewaty awesome, just did!

@Rajveer100
Copy link
Contributor

@bcardosolopes
Could you provide some context here with respect to the implementations?

From my understanding, this is similar to adding an operation in MLIR dialect, and then referencing with the cir:: namespace.

@bcardosolopes
Copy link
Member Author

bcardosolopes commented Jan 14, 2025

@Rajveer100 sure, we probably want a new cir::FenceOp that encodes (a) the sync scope somehow (perhaps a attribute enum kind that covers single_thread and system) and (b) the atomic ordering. If the atomic ordering isn't constant, we don't want to early expand it during CIRGen, but only during LLVM Lowering. Lowering to LLVM should also be implemented as part of the PR that fixes this.

Rajveer100 added a commit to Rajveer100/clangir that referenced this issue Jan 17, 2025
Part of llvm#1274

Implements atomic thread fence synchronization primitive
corresponding to `atomic.thread_fence` CIR.
Rajveer100 added a commit to Rajveer100/clangir that referenced this issue Jan 19, 2025
Part of 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
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants