[llvm] [MCA] Enable customization of individual instructions (PR #155420)
Min-Yih Hsu via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 16 10:33:33 PDT 2025
mshockwave wrote:
> > That being said, I still don't think we should have the Instrument::customize and Instrument::canCustomize -- I believe we can conditionally static_cast to this new LatencyInstrument by the getDesc it returns.
>
> We still need callbacks in InstrBuilder to check whether some instrument can customize InstrDesc (so we cannot reuse the description) and to do the customization, and latency change is not the only possible customization (though it is the only one in the current patch), so I don't like having the code in InstrumentManager that checks for specific instruments.
Instrument was originally invented as an opaque "handle" pass to InstrumentManager, and InstrumentManager does the actual works. Otherwise we would have a `Instrument::getSchedClassID` virtual function (because some instruments are used by `InstrumentManager::getSchedClassID`). For every new features added into `InstrumentManager` in the future, for instance `InstrumentManager::doFoo`, if we also need to add a new virtual function counterpart into `Instrument`, like `Instrument::doFoo`, I don't think it'll scale well.
Other than that, I think most parts of this patch are coming into shape, thanks for pushing this work!
https://github.com/llvm/llvm-project/pull/155420
More information about the llvm-commits
mailing list