@@ -719,12 +719,8 @@ static unsigned int getCodeMemorySemantic(MemSDNode *N,
719
719
AtomicOrdering Ordering = N->getSuccessOrdering ();
720
720
auto CodeAddrSpace = getCodeAddrSpace (N);
721
721
722
- // Supports relaxed, acquire, release, weak:
723
- bool hasAtomics =
724
- Subtarget->getPTXVersion () >= 60 && Subtarget->getSmVersion () >= 70 ;
725
- // Supports mmio:
726
- bool hasRelaxedMMIO =
727
- Subtarget->getPTXVersion () >= 82 && Subtarget->getSmVersion () >= 70 ;
722
+ bool HasMemoryOrdering = Subtarget->hasMemoryOrdering ();
723
+ bool HasRelaxedMMIO = Subtarget->hasRelaxedMMIO ();
728
724
729
725
// TODO: lowering for SequentiallyConsistent Operations: for now, we error.
730
726
// TODO: lowering for AcquireRelease Operations: for now, we error.
@@ -770,7 +766,7 @@ static unsigned int getCodeMemorySemantic(MemSDNode *N,
770
766
// sm_60 and older.
771
767
if (!(Ordering == AtomicOrdering::NotAtomic ||
772
768
Ordering == AtomicOrdering::Monotonic) &&
773
- !hasAtomics ) {
769
+ !HasMemoryOrdering ) {
774
770
SmallString<256 > Msg;
775
771
raw_svector_ostream OS (Msg);
776
772
OS << " PTX does not support \" atomic\" for orderings different than"
@@ -783,7 +779,7 @@ static unsigned int getCodeMemorySemantic(MemSDNode *N,
783
779
// the volatile semantics and preserve the atomic ones. [4]: TODO: volatile
784
780
// atomics with order stronger than relaxed are currently unimplemented in
785
781
// sm_60 and older.
786
- if (!hasAtomics && N->isVolatile () &&
782
+ if (!HasMemoryOrdering && N->isVolatile () &&
787
783
!(Ordering == AtomicOrdering::NotAtomic ||
788
784
Ordering == AtomicOrdering::Monotonic)) {
789
785
SmallString<256 > Msg;
@@ -804,7 +800,7 @@ static unsigned int getCodeMemorySemantic(MemSDNode *N,
804
800
CodeAddrSpace == NVPTX::PTXLdStInstCode::GLOBAL ||
805
801
CodeAddrSpace == NVPTX::PTXLdStInstCode::SHARED);
806
802
bool useRelaxedMMIO =
807
- hasRelaxedMMIO && CodeAddrSpace == NVPTX::PTXLdStInstCode::GLOBAL;
803
+ HasRelaxedMMIO && CodeAddrSpace == NVPTX::PTXLdStInstCode::GLOBAL;
808
804
809
805
switch (Ordering) {
810
806
case AtomicOrdering::NotAtomic:
@@ -817,7 +813,7 @@ static unsigned int getCodeMemorySemantic(MemSDNode *N,
817
813
: addrGenericOrGlobalOrShared ? NVPTX::PTXLdStInstCode::Volatile
818
814
: NVPTX::PTXLdStInstCode::NotAtomic;
819
815
else
820
- return hasAtomics ? NVPTX::PTXLdStInstCode::Relaxed
816
+ return HasMemoryOrdering ? NVPTX::PTXLdStInstCode::Relaxed
821
817
: addrGenericOrGlobalOrShared ? NVPTX::PTXLdStInstCode::Volatile
822
818
: NVPTX::PTXLdStInstCode::NotAtomic;
823
819
case AtomicOrdering::Acquire:
0 commit comments