Issue |
123339
|
Summary |
Default semantics of `syncscope("system")` missing in the langref
|
Labels |
new issue
|
Assignees |
|
Reporter |
vchuravy
|
In multiple places throughout the llvm codebase, it is assumed that `syncscope("system")` is the default.
As an example, when an atomic operation is created with `syncscope("system")` printing it omits that syncscope.
https://github.com/llvm/llvm-project/blob/8a229f595a5c0ff354cdfa05cda974a9d56674df/llvm/lib/CodeGen/MachineOperand.cpp#L530-L531
When creating an atomic load instruction without a syncscope specifiy it is assumed to be `system` https://github.com/llvm/llvm-project/blob/8a229f595a5c0ff354cdfa05cda974a9d56674df/llvm/lib/IR/Instructions.cpp#L1271-L1275
This default nature of `system` should be documented in the language reference, where currently only `target-specific` (e.g. what backends like AMDGPU have) and `single-threaded` exist.
A wrinkle is the PTX backend. PTX does mostly use NVVM intrinsics, but also some LLVM atomic operations.
Eventually, I would love to see a move away from the nvvm intrinsics and instead fully use the LLVM atomic operation,
but currently PTX does not handle syncscopes and thus "mistranslates" the `syncscope("system")` to the PTX syncscope `device`...
This essentially means that there is an ambiguity between `syncscope("system")` and the syncscope being left undefined.
I wanted to start work on supporting atomics with a syncscope argument in the PTX backend, but this conflict in defaults would potentially break users who have been emitting atomic operations on PTX. To be clear, it would be a performance issue and not a semantic one.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs