================
@@ -824,9 +838,23 @@ SIAtomicAddrSpace 
SIMemOpAccess::toSIAtomicAddrSpace(unsigned AS) const {
   return SIAtomicAddrSpace::OTHER;
 }
 
+/// returns true if any instruction in \p MF accesses LDS through DMA.
+static bool containsLDSDMA(const MachineFunction &MF) {
+  return any_of(MF, [](const MachineBasicBlock &MBB) {
+    return any_of(MBB.instrs(), [](const MachineInstr &MI) {
+      return SIInstrInfo::isLDSDMA(MI);
----------------
Pierre-vh wrote:

I think this belongs in the attributor, same as FLAT_SCRATCH_INIT - create a 
generic attribute to say whether a function may issue any kind of asynchronous 
operation such as LDSDMA, TENSOR, ASYNC, etc.

I think the property we're interested in is knowing whether there is any chance 
a thread may perform accesses via a third-party of some kind (async engine, 
DMA, etc.) ? And if it does, we can't demote because, in a way, the workgroup 
is technically no longer a single wave, an external engine is also involved.
You also need to conservatively assume it can perform async operations on 
targets where such ops are available and you have indirect calls or external 
calls.

cc @arsenm does that seem sensible to you ?

https://github.com/llvm/llvm-project/pull/224065
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to