[llvm] [llvm-mca] Account for AcquireAtCycles in llvm-mca (PR #80742)

Michael Maitland via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 06:53:14 PST 2024


================
@@ -430,7 +430,7 @@ class ResourceManager {
 
   void issueInstruction(
       const InstrDesc &Desc,
-      SmallVectorImpl<std::pair<ResourceRef, ReleaseAtCycles>> &Pipes);
+      SmallVectorImpl<std::pair<ResourceRef, NumCyclesUsed>> &Pipes);
----------------
michaelmaitland wrote:

NumCycleUsed is based on the `ReleaseAtCycle - AcquireAtCycle`. In that sense, it does know about AcquireAtCycle.

I think what you are pointing out here is that the current implementation will use the resource for the correct number of cycles now, but it ignores when it can start acquiring the resource relative to when the instruction is issued. To demonstrate, say an instruction X uses resource A with (Acquire, Release) = (0, 2) and resource B with (Acquire, Release) = (1, 2). This patch will model that resource A is used for 2 cycles and resource B for 1 cycle, but it does not model that we have to wait one cycle before consuming resource B.

I should look into adding this support. Thanks for catching this!

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


More information about the llvm-commits mailing list