================
@@ -1256,6 +1256,16 @@ defm GLOBAL_LOAD_ASYNC_TO_LDS_B64      :  
FLAT_Global_Load_LDS_Pseudo<"global_lo
 defm GLOBAL_LOAD_ASYNC_TO_LDS_B128     :  
FLAT_Global_Load_LDS_Pseudo<"global_load_async_to_lds_b128",  1>;
 } // End SubtargetPredicate = HasAsyncLoadToLDSInsts, WaveSizePredicate = 
isWave32
 
+// Expand in MC emission into an EXEC save, EXEC-zero load, and EXEC restore.
+// Keep the load's flags and named operands for wait counts and VGPR encoding.
+def GLOBAL_LOAD_ASYNC_TO_LDS_B8_replay :
----------------
yxsamliu wrote:

The extra opcode is compiler-only; it does not add an ISA instruction beyond 
the workaround sequence. I used it to make the added async load visible to 
machine passes while keeping the complete EXEC save/clear/load/restore sequence 
in MC emission.

We could emit the workaround directly when emitting the arrival, without a 
replay pseudo. However, putting everything in MC would still require a safe 
EXEC-save SGPR and correct resource counts, accounting for the added bytes, and 
handling the hidden async event and its marks. The current AMDGPU MC backend 
has no general long-branch relaxation. We would also need to preserve the 
dependency drain between the arrival and the replay. Keeping some earlier 
accounting is possible; removing it entirely would need more MC machinery or a 
separately validated conservative approach.

We could instead use the ordinary B8 load with a marker. That would keep the 
normal async-load accounting, but size, clause and delay handling would still 
need to recognize the marker. It saves the extra opcode, but mostly moves the 
special handling rather than removing it. The pseudo makes this distinction 
explicit, although it also has a maintenance cost in instruction classifiers.

Another option is to insert four ordinary instructions earlier. That gives us 
normal size and delay handling, but exposes the temporary EXEC writes to later 
passes, which was the concern raised in the earlier review.

Yes, a function can contain both ordinary and replay loads. Real loads use the 
current EXEC; only the replay dummy runs with EXEC=0. Both emit the same load 
opcode. The local IR test covers this mix and XNACK disabled.

This fix is currently holding up a release, so getting it in soon would help. 
If there are no remaining correctness concerns, could we land the current 
approach and handle further refactoring in a follow-up?


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

Reply via email to