[llvm] [llvm-mca] Add optional identifier field to mca::Instruction (PR #97867)
Chinmay Deshpande via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 11 12:19:55 PDT 2024
chinmaydd wrote:
Thanks for the response @boomanaiden154. I agree with @michaelmaitland that a central reason for this change is to be rid of the custom LLVM dependency that we have been dragging around with MCAD for a couple of years now.
Subclassing `mca::Instruction` is possible but it will require us to redefine even more llvm-mca functionality within MCAD. For instance, the entire `Pipeline` works with the `InstRef` class that holds a pointer to `mca::Instruction`. We are also looking to use hardware events generated by MCA (such as `StallEvent`, `PressureEvent`) to better inform the consumer. This requires that the unique identifier (and therefore access to the relevant metadata) persist through the various stages of the pipeline.
I'm not too confident that hashing will work reliably here, although I not entirely confident. For instance the `CyclesLeft` field will be updated at different stages of the pipeline -- therefore changing the hash. I could hash the opcode and the operands from `InstructionBase` but that is not going to help in uniquely identifying instructions. I dont see any other member combination that would yield a unique identifier for differentiating Instructions A and B, that have the same opcode and operands, in the pipeline. Happy to hear suggestions.
https://github.com/llvm/llvm-project/pull/97867
More information about the llvm-commits
mailing list