Now that RISCV pseudo instructions now account for SEW in some cases,
it useful that RISCV SEW instruments exist so that llvm-mca can use
the SEW specific scheduler classes.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I've only left a minor comment. Otherwise, patch looks good to me.
llvm/lib/Target/RISCV/MCA/RISCVCustomBehaviour.cpp | ||
---|---|---|
201 | I don't expect different instruments to have the same DESC_NAME. This should probably be an "else if". |
- Add explicit
- change if -> else if
llvm/test/tools/llvm-mca/RISCV/different-sew-instruments.s | ||
---|---|---|
8 | We need a LMUL instrument since the vdiv.vv instruction depends on LMUL and SEW. I chose to use the same LMUL to show that the MCA reports changed based on SEW changing. The reason we need to provide an LMUL to test SEW is because vdiv.vv depends on both LMUL and SEW. We could not resolve the correct SchedClassID without both. I thought about having a LMUL-SEW instrument instead of a SEW instrument, but it becomes trickier to replace an active LMUL instrument with the LMUL from the LMUL-SEW instrument. It was simpler to just use two instruments. I am open to improving this in the future. |
llvm/test/tools/llvm-mca/RISCV/different-sew-instruments.s | ||
---|---|---|
8 |
Ahh that makes sense, thanks
Does the current implementation effectively falls back to a default LMUL? If that's the case I think it's good enough as a baseline. That said, having a LMUL-SEW instrument would definitely be a nice addition. |
llvm/test/tools/llvm-mca/RISCV/different-sew-instruments.s | ||
---|---|---|
8 | It falls back to the “WorstCase” behavior. We have test coverage of no lmul nor sew provided, but I’ll add a test that gives coverage of lmul but no sew for an instruction that needs sew + lmul. |
Add test case to verify when an instruction needs LMUL+SEW but only SEW provided that it falls back to WorstCase behavior
llvm/test/tools/llvm-mca/RISCV/different-sew-instruments.s | ||
---|---|---|
8 | I've addressed this with llvm/test/tools/llvm-mca/RISCV/needs-sew-but-only-lmul.s |
llvm/test/tools/llvm-mca/RISCV/different-lmul-instruments.s | ||
---|---|---|
31 | It looks like we're defaulting to worst case when SEW is provided, but the sched resource does not depend on SEW. This is occurring in many of the test cases. I need to fix. |
maybe adding explicit?