================
@@ -976,11 +976,22 @@ SIMemOpAccess::getLDSDMAInfo(const
MachineBasicBlock::iterator &MI) const {
/// being marked as non-volatile. This means that either they are accessing the
/// constant address space, are accessing a known invariant memory location, or
/// that they are marked with the non-volatile metadata/MMO flag.
-static bool isNonVolatileMemoryAccess(const MachineInstr &MI) {
+static bool isNonVolatileMemoryAccess(const GCNSubtarget &ST,
+ const MachineInstr &MI) {
if (MI.getNumMemOperands() == 0)
return false;
+ // If globally addressable scratch is not in use, we can assume any scratch
+ // opcode accesses thread-local memory, thus is NV=1.
+ bool GASEnabled = ST.isGloballyAddressableScratchEnabled();
+ if (!GASEnabled && ST.getInstrInfo()->isFLATScratch(MI.getOpcode()))
+ return true;
return all_of(MI.memoperands(), [&](const MachineMemOperand *MMO) {
- return MMO->getFlags() & (MOThreadPrivate |
MachineMemOperand::MOInvariant);
+ // If globally addressable scratch is enabled, we can only set NV=1 by
+ // checking for the thread-private or invariant memory. If it is disabled,
+ // we can additionally consider private memory.
+ return (!GASEnabled && MMO->getAddrSpace() == AMDGPUAS::PRIVATE_ADDRESS) ||
----------------
arsenm wrote:
I expect the number of MMOs to be fixed per function. There could be multiple
MMOs, but it would be for something like the DMA copies where there's a
separate source and dest. All isFLATScratch cases are simple and have 1 MMO (or
0, which this patch will also mishandle)
https://github.com/llvm/llvm-project/pull/189556
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits