[llvm] [NVPTX] Load/Store/Fence syncscope support (PR #106101)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 13 12:02:53 PDT 2024
================
@@ -915,6 +920,42 @@ getOperationOrderings(MemSDNode *N, const NVPTXSubtarget *Subtarget) {
} // namespace
+NVPTX::Scope NVPTXDAGToDAGISel::getOperationScope(MemSDNode *N,
+ NVPTX::Ordering Ord) const {
+ switch (Ord) {
+ case NVPTX::Ordering::NotAtomic:
+ case NVPTX::Ordering::Volatile: // Non-atomic volatile operations
+ // NVPTX uses Thread scope as the scope of non-atomic operations.
+ return NVPTX::Scope::Thread;
+ case NVPTX::Ordering::RelaxedMMIO:
+ // RelaxedMMIO operations are always system scope.
+ // If a RelaxedMMIO order was generated from an atomic volatile operation
+ // with a smaller thread scope, we bump it here to system scope.
+ return NVPTX::Scope::System;
+ case NVPTX::Ordering::Relaxed:
+ case NVPTX::Ordering::Acquire:
+ case NVPTX::Ordering::Release:
+ case NVPTX::Ordering::AcquireRelease:
+ case NVPTX::Ordering::SequentiallyConsistent:
+ auto S = Scopes[N->getSyncScopeID()];
+
+ // Atomic operations must have a scope greater than thread.
----------------
gonzalobg wrote:
I made the scope change, and now "scope greater than thread" should make sense, but since thread is the smallest scope, i think `s == thread` is the right check. Even though the scope re-ordering doesn't help much here, it may still help in other places (if not now, in the future).
https://github.com/llvm/llvm-project/pull/106101
More information about the llvm-commits
mailing list