llvm-project/llvm/lib/MCA
Michael Maitland 98e342dca2 [RISCV][llvm-mca] Use LMUL Instruments to provide more accurate reports on RISCV
On x86 and AArch, SIMD instructions encode all of the scheduling information in the instruction
itself. For example, VADD.I16 q0, q1, q2 is a neon instruction that operates on 16-bit integer
elements stored in 128-bit Q registers, which leads to eight 16-bit lanes in parallel. This kind
of information impacts how the instruction takes to execute and what dependencies this may cause.

On RISCV however, the data that impacts scheduling is encoded in CSR registers such as vtype or
vl, in addition with the instruction itself. But MCA does not track or use the data in these
registers. This patch fixes this problem by introducing Instruments into MCA.

* Replace `CodeRegions` with `AnalysisRegions`
* Add `Instrument` and `InstrumentManager`
* Add `InstrumentRegions`
* Add RISCV Instrument and `InstrumentManager`
* Parse `Instruments` in driver
* Use instruments to override schedule class
* RISCV use lmul instrument to override schedule class
* Fix unit tests to pass empty instruments
* Add -ignore-im clopt to disable this change

A prior version of this patch was commited in 5e82ee5373. 2323a4ee61 reverted
that change because the unit test files caused build errors. The change with fixes
were committed in b88b8307bf but reverted once again e8e92c8313 due to more
build errors.

This commit adds the prior changes and fixes the build error.

Differential Revision: https://reviews.llvm.org/D137440
2022-11-18 09:55:15 -08:00
..
HardwareUnits [MCA] Correctly check pipeline availability for partially overlapping resource groups. 2022-09-07 12:17:59 +01:00
Stages
CMakeLists.txt [MCA] Allow mca::Instruction-s to be recycled and reused 2022-06-24 15:39:51 -07:00
CodeEmitter.cpp
Context.cpp
CustomBehaviour.cpp [RISCV][llvm-mca] Use LMUL Instruments to provide more accurate reports on RISCV 2022-11-18 09:55:15 -08:00
HWEventListener.cpp
IncrementalSourceMgr.cpp [MCA] Allow mca::Instruction-s to be recycled and reused 2022-06-24 15:39:51 -07:00
InstrBuilder.cpp [RISCV][llvm-mca] Use LMUL Instruments to provide more accurate reports on RISCV 2022-11-18 09:55:15 -08:00
Instruction.cpp [MCA] Allow mca::Instruction-s to be recycled and reused 2022-06-24 15:39:51 -07:00
Pipeline.cpp
Support.cpp Use std::gcd (NFC) 2022-08-27 21:20:59 -07:00
View.cpp