35#define DEBUG_TYPE "si-memory-legalizer"
36#define PASS_NAME "SI Memory Legalizer"
58enum class SIAtomicScope {
71 case SIAtomicScope::NONE:
73 case SIAtomicScope::SINGLETHREAD:
74 return "singlethread";
75 case SIAtomicScope::WAVEFRONT:
77 case SIAtomicScope::WORKGROUP:
79 case SIAtomicScope::CLUSTER:
81 case SIAtomicScope::AGENT:
83 case SIAtomicScope::SYSTEM:
100 OS << LS <<
"scratch";
109class SIMemOpInfo final {
112 friend class SIMemOpAccess;
116 SIAtomicScope Scope = SIAtomicScope::SYSTEM;
119 bool IsCrossAddressSpaceOrdering =
false;
120 bool IsVolatile =
false;
121 bool IsNonTemporal =
false;
122 bool IsLastUse =
false;
123 bool IsCooperative =
false;
124 bool IsAVNone =
false;
125 unsigned CFSBits = 0;
131 SIAtomicScope Scope = SIAtomicScope::SYSTEM,
134 bool IsCrossAddressSpaceOrdering =
true,
136 bool IsVolatile =
false,
bool IsNonTemporal =
false,
137 bool IsLastUse =
false,
bool IsCooperative =
false,
bool IsAVNone =
false,
138 bool CanDemoteWorkgroupToWavefront =
false,
unsigned CFSBits = 0)
139 : Ordering(Ordering), FailureOrdering(FailureOrdering), Scope(Scope),
140 OrderingAddrSpace(OrderingAddrSpace), InstrAddrSpace(InstrAddrSpace),
141 IsCrossAddressSpaceOrdering(IsCrossAddressSpaceOrdering),
142 IsVolatile(IsVolatile), IsNonTemporal(IsNonTemporal),
143 IsLastUse(IsLastUse), IsCooperative(IsCooperative), IsAVNone(IsAVNone),
147 assert(!IsCooperative &&
"Cannot be cooperative & non-atomic!");
148 assert(Scope == SIAtomicScope::NONE && !any(OrderingAddrSpace) &&
149 !IsCrossAddressSpaceOrdering &&
154 assert(Scope != SIAtomicScope::NONE &&
161 if ((OrderingAddrSpace == InstrAddrSpace) &&
163 this->IsCrossAddressSpaceOrdering =
false;
168 this->Scope = std::min(Scope, SIAtomicScope::SINGLETHREAD);
169 }
else if (!(InstrAddrSpace &
171 this->Scope = std::min(Scope, SIAtomicScope::WORKGROUP);
172 }
else if (!(InstrAddrSpace &
175 this->Scope = std::min(Scope, SIAtomicScope::AGENT);
180 if (this->Scope == SIAtomicScope::CLUSTER && !ST.hasClusters())
181 this->Scope = SIAtomicScope::AGENT;
183 if (CanDemoteWorkgroupToWavefront &&
184 this->Scope == SIAtomicScope::WORKGROUP)
185 this->Scope = SIAtomicScope::WAVEFRONT;
204 return FailureOrdering;
210 return InstrAddrSpace;
216 return OrderingAddrSpace;
221 bool getIsCrossAddressSpaceOrdering()
const {
222 return IsCrossAddressSpaceOrdering;
227 bool isVolatile()
const {
233 bool isNonTemporal()
const {
234 return IsNonTemporal;
239 bool isLastUse()
const {
return IsLastUse; }
242 bool isCooperative()
const {
return IsCooperative; }
245 bool isAVNone()
const {
return IsAVNone; }
254 unsigned getCFS()
const {
return CFSBits; }
257class SIMemOpAccess final {
261 const bool CanDemoteWorkgroupToWavefront;
265 const char *
Msg)
const;
271 std::optional<std::tuple<SIAtomicScope, SIAtomicAddrSpace, bool>>
276 std::optional<SIMemOpInfo>
286 std::optional<SIMemOpInfo>
291 std::optional<SIMemOpInfo>
296 std::optional<SIMemOpInfo>
301 std::optional<SIMemOpInfo>
307 std::optional<SIMemOpInfo>
311class SICacheControl {
333 unsigned Bits)
const;
343 static std::unique_ptr<SICacheControl> create(
const GCNSubtarget &ST,
372 SIMemOp
Op,
bool IsVolatile,
374 bool IsLastUse =
false)
const = 0;
393 "cooperative atomics are not available on this architecture");
407 bool IsCrossAddrSpaceOrdering, Position Pos,
418 Position Pos)
const = 0;
427 Position Pos)
const = 0;
432 Position Pos,
bool IsAVNone)
const {
433 bool Changed = !IsAVNone && insertWriteback(
MI, Scope, AddrSpace, Pos);
434 Changed |= insertWait(
MI, Scope, AddrSpace, SIMemOp::LOAD | SIMemOp::STORE,
435 IsCrossAddrSpaceOrdering, Pos,
442 virtual bool handleNonVolatile(
MachineInstr &
MI)
const {
return false; }
445 unsigned CFSBits = 0)
const {
450 virtual ~SICacheControl() =
default;
455class SIGfx6CacheControl final :
public SICacheControl {
457 SIGfx6CacheControl(
const GCNSubtarget &ST,
bool TgSplit)
458 : SICacheControl(ST, TgSplit) {}
474 bool IsVolatile,
bool IsNonTemporal,
475 bool IsLastUse)
const override;
479 bool IsCrossAddrSpaceOrdering, Position Pos,
485 Position Pos)
const override;
489 Position Pos)
const override;
493class SIGfx10CacheControl final :
public SICacheControl {
495 SIGfx10CacheControl(
const GCNSubtarget &ST,
bool TgSplit)
496 : SICacheControl(ST, TgSplit) {}
516 bool IsVolatile,
bool IsNonTemporal,
517 bool IsLastUse)
const override;
521 bool IsCrossAddrSpaceOrdering, Position Pos,
529 Position Pos)
const override {
534class SIGfx12CacheControl final :
public SICacheControl {
559 SIGfx12CacheControl(
const GCNSubtarget &ST,
bool TgSplit)
560 : SICacheControl(ST, TgSplit) {
563 assert(!ST.hasGFX1250Insts() || ST.hasGFX13Insts() || ST.isCuModeEnabled());
568 bool IsCrossAddrSpaceOrdering, Position Pos,
576 bool IsVolatile,
bool IsNonTemporal,
577 bool IsLastUse)
const override;
587 Position Pos)
const override;
592 return setAtomicScope(
MI, Scope, AddrSpace);
598 return setAtomicScope(
MI, Scope, AddrSpace);
604 return setAtomicScope(
MI, Scope, AddrSpace);
610 unsigned CFSBits)
const override;
613class SIMemoryLegalizer final {
617 std::unique_ptr<SICacheControl>
CC =
nullptr;
620 std::list<MachineBasicBlock::iterator> AtomicPseudoMIs;
630 bool removeAtomicPseudoMIs();
634 bool expandLoad(
const SIMemOpInfo &MOI,
638 bool expandStore(
const SIMemOpInfo &MOI,
642 bool expandAtomicFence(
const SIMemOpInfo &MOI,
646 bool expandAtomicCmpxchgOrRmw(
const SIMemOpInfo &MOI,
681 &
MI.getMF()->getFunction(),
MI.getDebugLoc());
689 Fn,
Twine(
"unknown amdgcn-av metadata '") + Suffix +
Twine(
'\''),
697 bool TagFound =
false;
698 for (
const auto &[Prefix, Suffix] : MMRA) {
699 if (Prefix !=
"amdgcn-av")
701 if (Suffix ==
"none")
704 diagnoseUnknownAVMetadata(
MI, Suffix);
712 const char *
Msg)
const {
714 Func.getContext().diagnose(
715 DiagnosticInfoUnsupported(Func,
Msg,
MI->getDebugLoc()));
718std::optional<std::tuple<SIAtomicScope, SIAtomicAddrSpace, bool>>
722 return std::tuple(SIAtomicScope::SYSTEM, SIAtomicAddrSpace::ATOMIC,
true);
724 return std::tuple(SIAtomicScope::AGENT, SIAtomicAddrSpace::ATOMIC,
true);
726 return std::tuple(SIAtomicScope::CLUSTER, SIAtomicAddrSpace::ATOMIC,
true);
728 return std::tuple(SIAtomicScope::WORKGROUP, SIAtomicAddrSpace::ATOMIC,
731 return std::tuple(SIAtomicScope::WAVEFRONT, SIAtomicAddrSpace::ATOMIC,
734 return std::tuple(SIAtomicScope::SINGLETHREAD, SIAtomicAddrSpace::ATOMIC,
737 return std::tuple(SIAtomicScope::SYSTEM,
738 SIAtomicAddrSpace::ATOMIC & InstrAddrSpace,
false);
740 return std::tuple(SIAtomicScope::AGENT,
741 SIAtomicAddrSpace::ATOMIC & InstrAddrSpace,
false);
743 return std::tuple(SIAtomicScope::CLUSTER,
744 SIAtomicAddrSpace::ATOMIC & InstrAddrSpace,
false);
746 return std::tuple(SIAtomicScope::WORKGROUP,
747 SIAtomicAddrSpace::ATOMIC & InstrAddrSpace,
false);
749 return std::tuple(SIAtomicScope::WAVEFRONT,
750 SIAtomicAddrSpace::ATOMIC & InstrAddrSpace,
false);
752 return std::tuple(SIAtomicScope::SINGLETHREAD,
753 SIAtomicAddrSpace::ATOMIC & InstrAddrSpace,
false);
760SIMemOpAccess::SIMemOpAccess(
const AMDGPUMachineModuleInfo &MMI_,
762 : MMI(&MMI_),
ST(
ST),
763 CanDemoteWorkgroupToWavefront(
765 MF.
getFunction().hasFnAttribute(
"amdgpu-no-lds-dma")) {}
767std::optional<SIMemOpInfo> SIMemOpAccess::constructFromMIWithMMO(
769 assert(
MI->getNumMemOperands() > 0);
771 std::optional<SyncScope::ID> MergedSSID;
775 bool IsNonTemporal =
true;
777 bool IsLastUse =
false;
778 bool IsCooperative =
false;
779 unsigned CFSBits = 0;
783 for (
const auto &MMO :
MI->memoperands()) {
784 IsNonTemporal &= MMO->isNonTemporal();
786 IsLastUse |= MMO->getFlags() &
MOLastUse;
791 if (OpOrdering != AtomicOrdering::NotAtomic) {
794 SyncScope::ID CurSSID = MergedSSID.value_or(MMO->getSyncScopeID());
801 MergedSSID = *Merged;
803 assert(MMO->getFailureOrdering() != AtomicOrdering::Release &&
804 MMO->getFailureOrdering() != AtomicOrdering::AcquireRelease);
816 Ordering = AtomicOrdering::Monotonic;
818 SIAtomicScope
Scope = SIAtomicScope::NONE;
820 bool IsCrossAddressSpaceOrdering =
false;
821 if (Ordering != AtomicOrdering::NotAtomic) {
822 auto ScopeOrNone = toSIAtomicScope(SSID, InstrAddrSpace);
827 std::tie(Scope, OrderingAddrSpace, IsCrossAddressSpaceOrdering) =
829 if (!OrderingAddrSpace ||
830 ((OrderingAddrSpace & SIAtomicAddrSpace::ATOMIC) !=
831 OrderingAddrSpace) ||
832 !(InstrAddrSpace & SIAtomicAddrSpace::ATOMIC)) {
837 return SIMemOpInfo(ST, Ordering, Scope, OrderingAddrSpace, InstrAddrSpace,
838 IsCrossAddressSpaceOrdering, FailureOrdering, IsVolatile,
839 IsNonTemporal, IsLastUse, IsCooperative,
840 hasAVNoneMMRA(*
MI), CanDemoteWorkgroupToWavefront,
844std::optional<SIMemOpInfo>
848 if (!(
MI->mayLoad() && !
MI->mayStore()))
852 if (
MI->getNumMemOperands() == 0)
853 return SIMemOpInfo(ST);
855 return constructFromMIWithMMO(
MI);
858std::optional<SIMemOpInfo>
862 if (!(!
MI->mayLoad() &&
MI->mayStore()))
866 if (
MI->getNumMemOperands() == 0)
867 return SIMemOpInfo(ST);
869 return constructFromMIWithMMO(
MI);
872std::optional<SIMemOpInfo>
876 if (
MI->getOpcode() != AMDGPU::ATOMIC_FENCE)
883 auto ScopeOrNone = toSIAtomicScope(SSID, SIAtomicAddrSpace::ATOMIC);
889 SIAtomicScope
Scope = SIAtomicScope::NONE;
891 bool IsCrossAddressSpaceOrdering =
false;
892 std::tie(Scope, OrderingAddrSpace, IsCrossAddressSpaceOrdering) =
895 if (OrderingAddrSpace != SIAtomicAddrSpace::ATOMIC) {
904 OrderingAddrSpace = getSynchronizeAddrSpaceMD(*
MI);
906 return SIMemOpInfo(ST, Ordering, Scope, OrderingAddrSpace,
907 SIAtomicAddrSpace::ATOMIC, IsCrossAddressSpaceOrdering,
908 AtomicOrdering::NotAtomic,
false,
false,
false,
false,
909 hasAVNoneMMRA(*
MI), CanDemoteWorkgroupToWavefront);
912std::optional<SIMemOpInfo> SIMemOpAccess::getAtomicCmpxchgOrRmwInfo(
916 if (!(
MI->mayLoad() &&
MI->mayStore()))
920 if (
MI->getNumMemOperands() == 0)
921 return SIMemOpInfo(ST);
923 return constructFromMIWithMMO(
MI);
926std::optional<SIMemOpInfo>
933 return constructFromMIWithMMO(
MI);
941 if (
MI.getNumMemOperands() == 0)
944 return MMO->getFlags() & (MOThreadPrivate | MachineMemOperand::MOInvariant);
948SICacheControl::SICacheControl(
const GCNSubtarget &ST,
bool TgSplit) :
ST(
ST) {
949 TII =
ST.getInstrInfo();
951 InsertCacheInv = !
ST.getCLOpts().skip_cache_invalidations;
952 TgSplitEnabled = TgSplit;
956 unsigned Bits)
const {
957 MachineOperand *CPol =
TII->getNamedOperand(*
MI, AMDGPU::OpName::cpol);
961 CPol->setImm(
CPol->getImm() | Bits);
966 assert((!
ST.hasGloballyAddressableScratch() ||
967 any(AS & SIAtomicAddrSpace::GLOBAL) ||
968 !(AS & SIAtomicAddrSpace::SCRATCH)) &&
969 "scratch instructions should already be replaced by flat "
970 "instructions if GloballyAddressableScratch is enabled");
971 return any(AS & SIAtomicAddrSpace::GLOBAL);
975std::unique_ptr<SICacheControl> SICacheControl::create(
const GCNSubtarget &ST,
977 GCNSubtarget::Generation Generation =
ST.getGeneration();
978 if (Generation < AMDGPUSubtarget::GFX10)
979 return std::make_unique<SIGfx6CacheControl>(ST, TgSplit);
980 if (Generation < AMDGPUSubtarget::GFX12)
981 return std::make_unique<SIGfx10CacheControl>(ST, TgSplit);
982 return std::make_unique<SIGfx12CacheControl>(ST, TgSplit);
985bool SIGfx6CacheControl::enableLoadCacheBypass(
991 if (!canAffectGlobalAddrSpace(AddrSpace)) {
1003 case SIAtomicScope::SYSTEM:
1004 if (
ST.hasGFX940Insts()) {
1010 case SIAtomicScope::AGENT:
1011 if (
ST.hasGFX940Insts()) {
1020 case SIAtomicScope::WORKGROUP:
1021 if (
ST.hasGFX940Insts()) {
1028 }
else if (
ST.hasGFX90AInsts()) {
1037 case SIAtomicScope::WAVEFRONT:
1038 case SIAtomicScope::SINGLETHREAD:
1048bool SIGfx6CacheControl::enableStoreCacheBypass(
1050 SIAtomicScope Scope,
1059 if (
ST.hasGFX940Insts() && canAffectGlobalAddrSpace(AddrSpace)) {
1061 case SIAtomicScope::SYSTEM:
1065 case SIAtomicScope::AGENT:
1069 case SIAtomicScope::WORKGROUP:
1073 case SIAtomicScope::WAVEFRONT:
1074 case SIAtomicScope::SINGLETHREAD:
1092bool SIGfx6CacheControl::enableRMWCacheBypass(
1094 SIAtomicScope Scope,
1105 if (
ST.hasGFX940Insts() && canAffectGlobalAddrSpace(AddrSpace)) {
1107 case SIAtomicScope::SYSTEM:
1111 case SIAtomicScope::AGENT:
1112 case SIAtomicScope::WORKGROUP:
1113 case SIAtomicScope::WAVEFRONT:
1114 case SIAtomicScope::SINGLETHREAD:
1128bool SIGfx6CacheControl::enableVolatileAndOrNonTemporal(
1130 bool IsVolatile,
bool IsNonTemporal,
bool IsLastUse =
false)
const {
1140 assert(
Op == SIMemOp::LOAD ||
Op == SIMemOp::STORE);
1145 if (
ST.hasGFX940Insts()) {
1148 }
else if (
Op == SIMemOp::LOAD) {
1160 Changed |= insertWait(
MI, SIAtomicScope::SYSTEM, AddrSpace,
Op,
false,
1161 Position::AFTER, AtomicOrdering::Unordered,
1167 if (IsNonTemporal) {
1168 if (
ST.hasGFX940Insts()) {
1182 SIAtomicScope Scope,
1184 bool IsCrossAddrSpaceOrdering, Position Pos,
1186 bool AtomicsOnly)
const {
1192 if (Pos == Position::AFTER)
1196 if (
ST.hasGFX90AInsts() && TgSplitEnabled) {
1205 (SIAtomicAddrSpace::GLOBAL | SIAtomicAddrSpace::SCRATCH |
1206 SIAtomicAddrSpace::GDS)) &&
1207 (Scope == SIAtomicScope::WORKGROUP)) {
1209 Scope = SIAtomicScope::AGENT;
1213 AddrSpace &= ~SIAtomicAddrSpace
::LDS;
1217 bool LGKMCnt =
false;
1220 (SIAtomicAddrSpace::GLOBAL | SIAtomicAddrSpace::SCRATCH))) {
1222 case SIAtomicScope::SYSTEM:
1223 case SIAtomicScope::AGENT:
1226 case SIAtomicScope::WORKGROUP:
1227 case SIAtomicScope::WAVEFRONT:
1228 case SIAtomicScope::SINGLETHREAD:
1237 if (
any(AddrSpace & SIAtomicAddrSpace::LDS)) {
1239 case SIAtomicScope::SYSTEM:
1240 case SIAtomicScope::AGENT:
1241 case SIAtomicScope::WORKGROUP:
1248 LGKMCnt |= IsCrossAddrSpaceOrdering;
1250 case SIAtomicScope::WAVEFRONT:
1251 case SIAtomicScope::SINGLETHREAD:
1260 if (
any(AddrSpace & SIAtomicAddrSpace::GDS)) {
1262 case SIAtomicScope::SYSTEM:
1263 case SIAtomicScope::AGENT:
1270 LGKMCnt |= IsCrossAddrSpaceOrdering;
1272 case SIAtomicScope::WORKGROUP:
1273 case SIAtomicScope::WAVEFRONT:
1274 case SIAtomicScope::SINGLETHREAD:
1283 if (VMCnt || LGKMCnt) {
1284 unsigned WaitCntImmediate =
1290 .
addImm(WaitCntImmediate);
1298 Scope == SIAtomicScope::WORKGROUP &&
1299 any(AddrSpace & SIAtomicAddrSpace::LDS)) {
1304 if (Pos == Position::AFTER)
1313 return !ST.isAmdPalOS() && !ST.isMesa3DOS();
1317 SIAtomicScope Scope,
1319 Position Pos)
const {
1320 if (!InsertCacheInv)
1328 if (Pos == Position::AFTER)
1332 ? AMDGPU::BUFFER_WBINVL1_VOL
1333 : AMDGPU::BUFFER_WBINVL1;
1335 if (canAffectGlobalAddrSpace(AddrSpace)) {
1337 case SIAtomicScope::SYSTEM:
1338 if (
ST.hasBufferInvInst()) {
1354 if (
ST.hasGFX90AInsts()) {
1369 case SIAtomicScope::AGENT:
1370 if (
ST.hasBufferInvInst()) {
1385 case SIAtomicScope::WORKGROUP:
1386 if (TgSplitEnabled) {
1387 if (
ST.hasBufferInvInst()) {
1406 }
else if (
ST.hasGFX90AInsts()) {
1412 case SIAtomicScope::WAVEFRONT:
1413 case SIAtomicScope::SINGLETHREAD:
1430 if (Pos == Position::AFTER)
1437 SIAtomicScope Scope,
1439 Position Pos)
const {
1440 if (!
ST.hasGFX90AInsts())
1447 if (Pos == Position::AFTER)
1450 if (canAffectGlobalAddrSpace(AddrSpace)) {
1452 case SIAtomicScope::SYSTEM:
1464 case SIAtomicScope::AGENT:
1465 if (
ST.hasGFX940Insts()) {
1472 case SIAtomicScope::WORKGROUP:
1473 case SIAtomicScope::WAVEFRONT:
1474 case SIAtomicScope::SINGLETHREAD:
1484 if (Pos == Position::AFTER)
1490bool SIGfx10CacheControl::enableLoadCacheBypass(
1496 if (canAffectGlobalAddrSpace(AddrSpace)) {
1498 case SIAtomicScope::SYSTEM:
1499 case SIAtomicScope::AGENT:
1506 case SIAtomicScope::WORKGROUP:
1511 if (!
ST.isCuModeEnabled())
1514 case SIAtomicScope::WAVEFRONT:
1515 case SIAtomicScope::SINGLETHREAD:
1533bool SIGfx10CacheControl::enableVolatileAndOrNonTemporal(
1535 bool IsVolatile,
bool IsNonTemporal,
bool IsLastUse =
false)
const {
1546 assert(
Op == SIMemOp::LOAD ||
Op == SIMemOp::STORE);
1554 if (
Op == SIMemOp::LOAD) {
1567 Changed |= insertWait(
MI, SIAtomicScope::SYSTEM, AddrSpace,
Op,
false,
1568 Position::AFTER, AtomicOrdering::Unordered,
1573 if (IsNonTemporal) {
1578 if (
Op == SIMemOp::STORE)
1593 SIAtomicScope Scope,
1595 bool IsCrossAddrSpaceOrdering,
1597 bool AtomicsOnly)
const {
1603 if (Pos == Position::AFTER)
1608 bool LGKMCnt =
false;
1611 (SIAtomicAddrSpace::GLOBAL | SIAtomicAddrSpace::SCRATCH))) {
1613 case SIAtomicScope::SYSTEM:
1614 case SIAtomicScope::AGENT:
1615 if (
any(
Op & SIMemOp::LOAD))
1617 if (
any(
Op & SIMemOp::STORE))
1620 case SIAtomicScope::WORKGROUP:
1630 if (
any(
Op & SIMemOp::LOAD))
1632 if (
any(
Op & SIMemOp::STORE))
1636 case SIAtomicScope::WAVEFRONT:
1637 case SIAtomicScope::SINGLETHREAD:
1646 if (
any(AddrSpace & SIAtomicAddrSpace::LDS)) {
1648 case SIAtomicScope::SYSTEM:
1649 case SIAtomicScope::AGENT:
1650 case SIAtomicScope::WORKGROUP:
1657 LGKMCnt |= IsCrossAddrSpaceOrdering;
1659 case SIAtomicScope::WAVEFRONT:
1660 case SIAtomicScope::SINGLETHREAD:
1669 if (
any(AddrSpace & SIAtomicAddrSpace::GDS)) {
1671 case SIAtomicScope::SYSTEM:
1672 case SIAtomicScope::AGENT:
1679 LGKMCnt |= IsCrossAddrSpaceOrdering;
1681 case SIAtomicScope::WORKGROUP:
1682 case SIAtomicScope::WAVEFRONT:
1683 case SIAtomicScope::SINGLETHREAD:
1692 if (VMCnt || LGKMCnt) {
1693 unsigned WaitCntImmediate =
1699 .
addImm(WaitCntImmediate);
1707 Scope == SIAtomicScope::WORKGROUP &&
1708 any(AddrSpace & SIAtomicAddrSpace::LDS)) {
1715 .
addReg(AMDGPU::SGPR_NULL, RegState::Undef)
1720 if (Pos == Position::AFTER)
1727 SIAtomicScope Scope,
1729 Position Pos)
const {
1730 if (!InsertCacheInv)
1738 if (Pos == Position::AFTER)
1741 if (canAffectGlobalAddrSpace(AddrSpace)) {
1743 case SIAtomicScope::SYSTEM:
1744 case SIAtomicScope::AGENT:
1752 case SIAtomicScope::WORKGROUP:
1757 if (!
ST.isCuModeEnabled()) {
1762 case SIAtomicScope::WAVEFRONT:
1763 case SIAtomicScope::SINGLETHREAD:
1778 if (Pos == Position::AFTER)
1786 MachineOperand *
CPol =
TII->getNamedOperand(*
MI, OpName::cpol);
1801 MachineOperand *
CPol =
TII->getNamedOperand(*
MI, OpName::cpol);
1814bool SIGfx12CacheControl::insertWaitsBeforeSystemScopeStore(
1822 if (
ST.hasImageInsts()) {
1824 if (
ST.hasAnyBVHInsts())
1834 SIAtomicScope Scope,
1836 bool IsCrossAddrSpaceOrdering,
1838 bool AtomicsOnly)
const {
1844 bool LOADCnt =
false;
1846 bool STORECnt =
false;
1848 if (Pos == Position::AFTER)
1852 (SIAtomicAddrSpace::GLOBAL | SIAtomicAddrSpace::SCRATCH))) {
1854 case SIAtomicScope::SYSTEM:
1855 case SIAtomicScope::AGENT:
1856 case SIAtomicScope::CLUSTER:
1857 if (
any(
Op & SIMemOp::LOAD))
1859 if (
any(
Op & SIMemOp::STORE))
1862 case SIAtomicScope::WORKGROUP:
1879 if (!
ST.isCuModeEnabled() ||
ST.hasGFX1250Insts() ||
1881 if (
any(
Op & SIMemOp::LOAD))
1883 if (
any(
Op & SIMemOp::STORE))
1887 case SIAtomicScope::WAVEFRONT:
1888 case SIAtomicScope::SINGLETHREAD:
1897 if (
any(AddrSpace & SIAtomicAddrSpace::LDS)) {
1899 case SIAtomicScope::SYSTEM:
1900 case SIAtomicScope::AGENT:
1901 case SIAtomicScope::CLUSTER:
1902 case SIAtomicScope::WORKGROUP:
1909 DSCnt |= IsCrossAddrSpaceOrdering;
1911 case SIAtomicScope::WAVEFRONT:
1912 case SIAtomicScope::SINGLETHREAD:
1933 if (!AtomicsOnly &&
ST.hasImageInsts()) {
1934 if (
ST.hasAnyBVHInsts())
1952 if (Pos == Position::AFTER)
1959 SIAtomicScope Scope,
1961 Position Pos)
const {
1962 if (!InsertCacheInv)
1974 if (!canAffectGlobalAddrSpace(AddrSpace))
1979 case SIAtomicScope::SYSTEM:
1985 case SIAtomicScope::AGENT:
1991 case SIAtomicScope::CLUSTER:
1994 case SIAtomicScope::WORKGROUP:
2002 if (
ST.isCuModeEnabled())
2007 case SIAtomicScope::WAVEFRONT:
2008 case SIAtomicScope::SINGLETHREAD:
2015 if (Pos == Position::AFTER)
2020 if (Pos == Position::AFTER)
2025 if (
ST.hasINVWBL2WaitCntRequirement() && Scope > SIAtomicScope::CLUSTER) {
2026 insertWait(
MI, Scope, AddrSpace, SIMemOp::LOAD,
2027 false, Pos, AtomicOrdering::Acquire,
2030 if (Pos == Position::AFTER)
2038 SIAtomicScope Scope,
2040 Position Pos)
const {
2045 if (!canAffectGlobalAddrSpace(AddrSpace))
2052 if (Pos == Position::AFTER)
2064 std::optional<AMDGPU::CPol::CPol> NeedsWB;
2066 case SIAtomicScope::SYSTEM:
2067 if (!
ST.hasNoMTypeNC())
2070 case SIAtomicScope::AGENT:
2073 if (
ST.hasGFX1250Insts() && !
ST.hasNoMTypeNC())
2076 case SIAtomicScope::CLUSTER:
2077 case SIAtomicScope::WORKGROUP:
2078 case SIAtomicScope::WAVEFRONT:
2079 case SIAtomicScope::SINGLETHREAD:
2081 case SIAtomicScope::NONE:
2090 if (
ST.hasINVWBL2WaitCntRequirement()) {
2091 insertWait(
MI, Scope, AddrSpace, SIMemOp::LOAD | SIMemOp::STORE,
2093 AtomicOrdering::Release,
2101 if (Pos == Position::AFTER)
2107bool SIGfx12CacheControl::handleNonVolatile(MachineInstr &
MI)
const {
2109 if (!
ST.hasGFX1250Insts())
2111 MachineOperand *
CPol =
TII->getNamedOperand(
MI, OpName::cpol);
2118bool SIGfx12CacheControl::enableVolatileAndOrNonTemporal(
2120 bool IsVolatile,
bool IsNonTemporal,
bool IsLastUse =
false)
const {
2129 assert(
Op == SIMemOp::LOAD ||
Op == SIMemOp::STORE);
2136 }
else if (IsNonTemporal) {
2144 if (
ST.requiresWaitXCntForSingleAccessInstructions() &&
2156 Changed |= insertWait(
MI, SIAtomicScope::SYSTEM, AddrSpace,
Op,
false,
2157 Position::AFTER, AtomicOrdering::Unordered,
2164bool SIGfx12CacheControl::finalizeStore(MachineInstr &
MI,
bool Atomic)
const {
2165 assert(
MI.mayStore() &&
"Not a Store inst");
2166 const bool IsRMW = (
MI.mayLoad() &&
MI.mayStore());
2169 if (Atomic &&
ST.requiresWaitXCntForSingleAccessInstructions() &&
2180 MachineOperand *
CPol =
TII->getNamedOperand(
MI, OpName::cpol);
2186 if (
ST.requiresWaitsBeforeSystemScopeStores() && !Atomic &&
2188 Changed |= insertWaitsBeforeSystemScopeStore(
MI.getIterator());
2198 MachineOperand *
CPol =
TII->getNamedOperand(*
MI, AMDGPU::OpName::cpol);
2199 assert(CPol &&
"load_monitor must have a cpol operand");
2205bool SIGfx12CacheControl::handleCooperativeAtomic(MachineInstr &
MI)
const {
2206 if (!
ST.hasGFX1250Insts())
2210 MachineOperand *
CPol =
TII->getNamedOperand(
MI, OpName::cpol);
2211 assert(CPol &&
"No CPol operand?");
2219 SIAtomicScope Scope,
2223 if (canAffectGlobalAddrSpace(AddrSpace)) {
2225 case SIAtomicScope::SYSTEM:
2228 case SIAtomicScope::AGENT:
2231 case SIAtomicScope::CLUSTER:
2234 case SIAtomicScope::WORKGROUP:
2237 if (!
ST.isCuModeEnabled())
2240 case SIAtomicScope::WAVEFRONT:
2241 case SIAtomicScope::SINGLETHREAD:
2260 unsigned CFSBits)
const {
2261 if (!
ST.hasCacheFillSize())
2265 MachineOperand *
CPol =
TII->getNamedOperand(*CoreMI, OpName::cpol);
2280bool SIMemoryLegalizer::removeAtomicPseudoMIs() {
2281 if (AtomicPseudoMIs.empty())
2284 for (
auto &
MI : AtomicPseudoMIs)
2285 MI->eraseFromParent();
2287 AtomicPseudoMIs.clear();
2291bool SIMemoryLegalizer::expandLoad(
const SIMemOpInfo &MOI,
2299 if (MOI.isAtomic()) {
2301 <<
", scope=" <<
toString(MOI.getScope())
2302 <<
", ordering-AS=" << MOI.getOrderingAddrSpace()
2303 <<
", instr-AS=" << MOI.getInstrAddrSpace() <<
"\n");
2305 if (Order == AtomicOrdering::Monotonic ||
2306 Order == AtomicOrdering::Acquire ||
2307 Order == AtomicOrdering::SequentiallyConsistent) {
2308 Changed |=
CC->enableLoadCacheBypass(
MI, MOI.getScope(),
2309 MOI.getOrderingAddrSpace());
2314 if (MOI.isCooperative())
2320 if (Order == AtomicOrdering::SequentiallyConsistent)
2321 Changed |=
CC->insertWait(
MI, MOI.getScope(), MOI.getOrderingAddrSpace(),
2322 SIMemOp::LOAD | SIMemOp::STORE,
2323 MOI.getIsCrossAddressSpaceOrdering(),
2324 Position::BEFORE, Order,
false);
2326 if (Order == AtomicOrdering::Acquire ||
2327 Order == AtomicOrdering::SequentiallyConsistent) {
2330 CC->insertWait(
MI, MOI.getScope(), MOI.getInstrAddrSpace(),
2331 SIMemOp::LOAD, MOI.getIsCrossAddressSpaceOrdering(),
2332 Position::AFTER, Order,
true);
2333 if (!MOI.isAVNone()) {
2335 MI, MOI.getScope(), MOI.getOrderingAddrSpace(), Position::AFTER);
2345 Changed |=
CC->enableVolatileAndOrNonTemporal(
2346 MI, MOI.getInstrAddrSpace(), SIMemOp::LOAD, MOI.isVolatile(),
2347 MOI.isNonTemporal(), MOI.isLastUse());
2355bool SIMemoryLegalizer::expandStore(
const SIMemOpInfo &MOI,
2363 MachineInstr &StoreMI = *
MI;
2365 if (MOI.isAtomic()) {
2367 <<
", scope=" <<
toString(MOI.getScope())
2368 <<
", ordering-AS=" << MOI.getOrderingAddrSpace()
2369 <<
", instr-AS=" << MOI.getInstrAddrSpace() <<
"\n");
2370 if (MOI.getOrdering() == AtomicOrdering::Monotonic ||
2371 MOI.getOrdering() == AtomicOrdering::Release ||
2372 MOI.getOrdering() == AtomicOrdering::SequentiallyConsistent) {
2373 Changed |=
CC->enableStoreCacheBypass(
MI, MOI.getScope(),
2374 MOI.getOrderingAddrSpace());
2379 if (MOI.isCooperative())
2382 if (MOI.getOrdering() == AtomicOrdering::Release ||
2383 MOI.getOrdering() == AtomicOrdering::SequentiallyConsistent) {
2385 CC->insertRelease(
MI, MOI.getScope(), MOI.getOrderingAddrSpace(),
2386 MOI.getIsCrossAddressSpaceOrdering(),
2387 Position::BEFORE, MOI.isAVNone());
2390 Changed |=
CC->finalizeStore(StoreMI,
true);
2398 Changed |=
CC->enableVolatileAndOrNonTemporal(
2399 MI, MOI.getInstrAddrSpace(), SIMemOp::STORE, MOI.isVolatile(),
2400 MOI.isNonTemporal());
2404 Changed |=
CC->finalizeStore(StoreMI,
false);
2410bool SIMemoryLegalizer::expandAtomicFence(
const SIMemOpInfo &MOI,
2412 assert(
MI->getOpcode() == AMDGPU::ATOMIC_FENCE);
2416 AtomicPseudoMIs.push_back(
MI);
2421 if (MOI.isAtomic()) {
2423 <<
", scope=" <<
toString(MOI.getScope())
2424 <<
", ordering-AS=" << OrderingAddrSpace <<
"\n");
2426 if (Order == AtomicOrdering::Acquire) {
2428 Changed |=
CC->insertWait(
MI, MOI.getScope(), OrderingAddrSpace,
2429 SIMemOp::LOAD | SIMemOp::STORE,
2430 MOI.getIsCrossAddressSpaceOrdering(),
2431 Position::BEFORE, Order,
true);
2434 if (Order == AtomicOrdering::Release ||
2435 Order == AtomicOrdering::AcquireRelease ||
2436 Order == AtomicOrdering::SequentiallyConsistent) {
2444 Changed |=
CC->insertRelease(
MI, MOI.getScope(), OrderingAddrSpace,
2445 MOI.getIsCrossAddressSpaceOrdering(),
2446 Position::BEFORE, MOI.isAVNone());
2454 if ((Order == AtomicOrdering::Acquire ||
2455 Order == AtomicOrdering::AcquireRelease ||
2456 Order == AtomicOrdering::SequentiallyConsistent) &&
2458 Changed |=
CC->insertAcquire(
MI, MOI.getScope(), OrderingAddrSpace,
2468bool SIMemoryLegalizer::expandAtomicCmpxchgOrRmw(
const SIMemOpInfo &MOI,
2475 MachineInstr &RMWMI = *
MI;
2477 if (MOI.isAtomic()) {
2479 <<
", failure-ordering="
2481 <<
", scope=" <<
toString(MOI.getScope())
2482 <<
", ordering-AS=" << MOI.getOrderingAddrSpace()
2483 <<
", instr-AS=" << MOI.getInstrAddrSpace() <<
"\n");
2485 if (Order == AtomicOrdering::Monotonic ||
2486 Order == AtomicOrdering::Acquire || Order == AtomicOrdering::Release ||
2487 Order == AtomicOrdering::AcquireRelease ||
2488 Order == AtomicOrdering::SequentiallyConsistent) {
2489 Changed |=
CC->enableRMWCacheBypass(
MI, MOI.getScope(),
2490 MOI.getInstrAddrSpace());
2493 if (Order == AtomicOrdering::Release ||
2494 Order == AtomicOrdering::AcquireRelease ||
2495 Order == AtomicOrdering::SequentiallyConsistent ||
2496 MOI.getFailureOrdering() == AtomicOrdering::SequentiallyConsistent) {
2498 CC->insertRelease(
MI, MOI.getScope(), MOI.getOrderingAddrSpace(),
2499 MOI.getIsCrossAddressSpaceOrdering(),
2500 Position::BEFORE, MOI.isAVNone());
2503 if (Order == AtomicOrdering::Acquire ||
2504 Order == AtomicOrdering::AcquireRelease ||
2505 Order == AtomicOrdering::SequentiallyConsistent ||
2506 MOI.getFailureOrdering() == AtomicOrdering::Acquire ||
2507 MOI.getFailureOrdering() == AtomicOrdering::SequentiallyConsistent) {
2510 CC->insertWait(
MI, MOI.getScope(), MOI.getInstrAddrSpace(),
2512 MOI.getIsCrossAddressSpaceOrdering(), Position::AFTER,
2514 if (!MOI.isAVNone()) {
2516 MI, MOI.getScope(), MOI.getOrderingAddrSpace(), Position::AFTER);
2520 Changed |=
CC->finalizeStore(RMWMI,
true);
2529bool SIMemoryLegalizer::expandLDSDMA(
const SIMemOpInfo &MOI,
2543 bool Changed =
CC->enableVolatileAndOrNonTemporal(
2544 MI, MOI.getInstrAddrSpace(), OpKind, MOI.isVolatile(),
2545 MOI.isNonTemporal(), MOI.isLastUse());
2550bool SIMemoryLegalizerLegacy::runOnMachineFunction(
MachineFunction &MF) {
2551 const MachineModuleInfo &MMI =
2552 getAnalysis<MachineModuleInfoWrapperPass>().getMMI();
2553 return SIMemoryLegalizer(MMI).run(MF);
2560 .getCachedResult<MachineModuleAnalysis>(
2562 assert(MMI &&
"MachineModuleAnalysis must be available");
2563 if (!SIMemoryLegalizer(MMI->getMMI()).run(MF))
2575 CC = SICacheControl::create(ST, TgSplit);
2577 for (
auto &
MBB : MF) {
2581 if (
MI->isBundle() &&
MI->mayLoadOrStore()) {
2584 I != E &&
I->isBundledWithPred(); ++
I) {
2585 I->unbundleFromPred();
2588 MO.setIsInternalRead(
false);
2591 MI =
MI->eraseFromParent();
2595 if (
const auto &MOI = MOA.getLoadInfo(
MI))
2597 else if (
const auto &MOI = MOA.getStoreInfo(
MI))
2599 else if (
const auto &MOI = MOA.getLDSDMAInfo(
MI))
2601 else if (
const auto &MOI = MOA.getAtomicFenceInfo(
MI))
2603 else if (
const auto &MOI = MOA.getAtomicCmpxchgOrRmwInfo(
MI))
2604 Changed |= expandAtomicCmpxchgOrRmw(*MOI,
MI);
2612 Changed |= removeAtomicPseudoMIs();
2618char SIMemoryLegalizerLegacy::ID = 0;
2622 return new SIMemoryLegalizerLegacy();
static std::optional< LoadInfo > getLoadInfo(const MachineInstr &MI)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
AMDGPU Machine Module Info.
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Atomic ordering constants.
AMD GCN specific subclass of TargetSubtarget.
const HexagonInstrInfo * TII
This header defines various interfaces for pass management in LLVM.
static bool isAtomic(MachineBasicBlock::iterator I)
This file provides utility for Memory Model Relaxation Annotations (MMRAs).
uint64_t IntrinsicInst * II
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
static bool isNonVolatileMemoryAccess(const MachineInstr &MI)
static bool canUseBUFFER_WBINVL1_VOL(const GCNSubtarget &ST)
static Function * getFunction(FunctionType *Ty, const Twine &Name, Module *M)
static const uint32_t IV[8]
SyncScope::ID getWorkgroupSSID() const
SyncScope::ID getWavefrontSSID() const
SyncScope::ID getAgentSSID() const
SyncScope::ID getClusterOneAddressSpaceSSID() const
SyncScope::ID getClusterSSID() const
SyncScope::ID getAgentOneAddressSpaceSSID() const
SyncScope::ID getSingleThreadOneAddressSpaceSSID() const
SyncScope::ID getWavefrontOneAddressSpaceSSID() const
std::optional< SyncScope::ID > getMergedSyncScopeID(SyncScope::ID A, SyncScope::ID B) const
In AMDGPU, synchronization scopes are inclusive: a larger scope is inclusive of a smaller one (e....
SyncScope::ID getSystemOneAddressSpaceSSID() const
SyncScope::ID getWorkgroupOneAddressSpaceSSID() const
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent the analysis usage information of a pass.
LLVM_ABI void setPreservesCFG()
This function should be called by the pass, iff they do not:
Represents analyses that only rely on functions' control flow.
Diagnostic information for unsupported feature in backend.
FunctionPass class - This class is used to implement most global optimizations.
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function.
Generation getGeneration() const
Module * getParent()
Get the module that this global value is contained inside of...
LLVM_ABI void diagnose(const DiagnosticInfo &DI)
Report a message to the currently installed diagnostic handler.
A helper class to return the specified delimiter string after the first invocation of operator String...
Instructions::iterator instr_iterator
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
MachineInstrBundleIterator< MachineInstr > iterator
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Function & getFunction()
Return the LLVM function that this machine code represents.
const MachineInstrBuilder & addReg(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
Representation of each machine instruction.
A description of a memory reference used in the backend.
This class contains meta information specific to a module.
Ty & getObjFileInfo()
Keep track of various per-module pieces of information for backends that would like to do so.
MachineOperand class - Representation of each machine instruction operand.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalyses & preserveSet()
Mark an analysis set as preserved.
static bool isVMEM(const MachineInstr &MI)
static bool mayWriteLDSThroughDMA(const MachineInstr &MI)
static bool isBUF(const MachineInstr &MI)
static bool isAtomicRet(const MachineInstr &MI)
static bool isAtomic(const MachineInstr &MI)
static bool isLoadMonitor(unsigned Opc)
static bool isLDSDMA(const MachineInstr &MI)
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
Represent a constant reference to a string, i.e.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char IsVolatile[]
Key for Kernel::Arg::Metadata::mIsVolatile.
bool isGFX10(const MCSubtargetInfo &STI)
bool isGFX11(const MCSubtargetInfo &STI)
SIAtomicAddrSpace toSIAtomicAddrSpace(unsigned LLVMAddrSpace)
LLVM_ABI IsaVersion getIsaVersion(StringRef GPU)
unsigned encodeWaitcnt(const IsaVersion &Version, const Waitcnt &Decoded)
bool isTgSplitEnabled(const Function &F)
SIAtomicAddrSpace
The distinct address spaces supported by the AMDGPU target for atomic memory operation.
@ ATOMIC
The address spaces that support atomic instructions.
SIAtomicAddrSpace getSynchronizeAddrSpace(const MMRAMetadata &MMRA, const Function *DiagFn, const DebugLoc &DL)
Parses the values for the "amdgpu-synchronize-as" MMRA.
unsigned getVmcntBitMask(const IsaVersion &Version)
unsigned getLgkmcntBitMask(const IsaVersion &Version)
unsigned getExpcntBitMask(const IsaVersion &Version)
constexpr bool any(E Val)
constexpr bool isAtomicRet(const T &...O)
constexpr bool isMaybeAtomic(const T &...O)
@ SingleThread
Synchronized with respect to signal handlers executing in the same thread.
@ System
Synchronized with respect to all concurrently executing threads.
Scope
Defines the scope in which this symbol should be visible: Default – Visible in the public interface o...
NodeAddr< FuncNode * > Func
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
OuterAnalysisManagerProxy< ModuleAnalysisManager, MachineFunction > ModuleAnalysisManagerMachineFunctionProxy
Provide the ModuleAnalysisManager to Function proxy.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
char & SIMemoryLegalizerID
@ LLVM_MARK_AS_BITMASK_ENUM
LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE()
static void reportUnsupported(MachineIRBuilder &MIRBuilder, const Twine &Msg)
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
bool isReleaseOrStronger(AtomicOrdering AO)
LLVM_ABI PreservedAnalyses getMachineFunctionPassPreservedAnalyses()
Returns the minimum set of Analyses that all machine function passes must preserve.
static const DIScope * getScope(const NodeT *N)
const char * toIRString(AtomicOrdering ao)
String used by LLVM IR to represent atomic ordering.
MachineInstr * getImm(const MachineOperand &MO, const MachineRegisterInfo *MRI)
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
AtomicOrdering getMergedAtomicOrdering(AtomicOrdering AO, AtomicOrdering Other)
Return a single atomic ordering that is at least as strong as both the AO and Other orderings for an ...
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
static const MachineMemOperand::Flags MOCooperative
Mark the MMO of cooperative load/store atomics.
AtomicOrdering
Atomic ordering for LLVM's memory model.
DWARFExpression::Operation Op
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
std::string toString(const APInt &I, unsigned Radix, bool Signed, bool formatAsCLiteral=false, bool UpperCase=true, bool InsertSeparators=false)
static const MachineMemOperand::Flags MOLastUse
Mark the MMO of a load as the last use.
static const MachineMemOperand::Flags MOCFSB0
Use two MMO flags to encode the 2-bit cache fill size field for GFX13+.
FunctionPass * createSIMemoryLegalizerPass()
Instruction set architecture version.