[llvm] [NVPTX] Add Volta Atomic SequentiallyConsistent Load and Store Operations (PR #98551)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 25 15:42:42 PDT 2024


================
@@ -106,15 +106,53 @@ enum LoadStore {
   isStoreShift = 6
 };
 
-namespace PTXLdStInstCode {
-enum MemorySemantic {
+// Extends LLVM AtomicOrdering with PTX Orderings:
+using OrderingUnderlyingType = unsigned int;
+enum class Ordering : OrderingUnderlyingType {
   NotAtomic = 0, // PTX calls these: "Weak"
-  Volatile = 1,
+  // Unordered = 1, // NVPTX maps LLVM Unorderd to Relaxed
   Relaxed = 2,
-  Acquire = 3,
-  Release = 4,
-  RelaxedMMIO = 5
+  // Consume = 3,   // Unimplemented in LLVM; NVPTX would map to "Acquire"
+  Acquire = 4,
+  Release = 5,
+  // AcquireRelease = 6, // TODO
+  SequentiallyConsistent = 7,
+  Volatile = 8,
+  RelaxedMMIO = 9,
+  LAST = RelaxedMMIO
 };
+
+template <typename OStream> OStream &operator<<(OStream &O, Ordering Order) {
----------------
Artem-B wrote:

I think we do not need a template here. Using `raw_ostream` for the stream type should do the job.

I'd also split it into `Ordering` to `std::string` conversion, and the stram output `operator<<`. This will make it a bit easier to print out ordering values in error cases, so you would not need a temporary string stream for that.

https://github.com/llvm/llvm-project/pull/98551


More information about the llvm-commits mailing list