[clang] [llvm] [AMDGPU] Emit a waitcnt instruction after each memory instruction (PR #79236)

Jun Wang via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 19 12:43:46 PST 2024


jwanggit86 wrote:

> Did you try to move this to SIInsertWaitCnt, as suggested?



> Did you try to move this to SIInsertWaitCnt, as suggested?

Pls see my reply on Feb 15, which is copy-pasted below.

Regarding the question about SIInsertWaitcnt, initially the code was indeed put there (see PR https://github.com/llvm/llvm-project/pull/68932). After a discussion with @t-tye and others, it was decided to do it in SIMemoryLegalizer. I think the main reason is that functionality-wise this new feather is more closely related to the Mem Legalizer. Tony can explain this better. Also, the Mem Legalizer, like SIInsertWaitcnt, goes through each instruction already.
Based on the implementation experience, I'd say another reason that supports putting it in the Mem Legalizer is that there's already a class hierarchy for the different ISAs, making it easier to implement ISA-specific behaviors.

https://github.com/llvm/llvm-project/pull/79236


More information about the llvm-commits mailing list