Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Dialect/Arithmetic/Transforms/EmulateWideInt.cpp | ||
---|---|---|
373 | Why is this pattern needed? |
mlir/lib/Dialect/Arithmetic/Transforms/EmulateWideInt.cpp | ||
---|---|---|
373 | Without this, vector.print %x : i2N would be considered illegal and the mlir-opt invocation would fail. The high-level idea behind future integration test is to run the same module with and without emulation, so that we can generate the expected emulated values based on whatever mlir-cpu-runner prints for wide operations without emulation. As an alternative, I think we might be able to always print vector<2xiN>, but this would require us to bitcast from i2N to vector<2xiN. I don't think that arith.bitcast supports that but llvm.bitcast should. But then I'm not sure if this wouldn't defer the same problem to the missing conversion/legality check for llvm.bitcast. |
Thanks for adding these. Especially with how complicated some of the emulation patterns are, these will add confidence to the implementation.
mlir/lib/Dialect/Arithmetic/Transforms/EmulateWideInt.cpp | ||
---|---|---|
373 | You're right that arith.bitcast doesn't do vector bitcasting -- it sounds like we need a vector.bitcast op that does that (which also maps to llvm.bitcast). That being said, if this pattern is only needed for testing, I would suggest moving it into a test pass. But I wouldn't say that this pattern is "test only". It's legalizing vector.print to use wide integer emulation (even though that just means it rewrites the operand types). So I think you can drop the comment about that. |
mlir/lib/Dialect/Arithmetic/Transforms/EmulateWideInt.cpp | ||
---|---|---|
373 | Yeah, the comment was meant to justify the unusual placement of the pattern: I'd expect to see it in a vector transform or dedicated test pass. But in the interest of incremental changes, I added it to the main arith pass for the time being. |
Why is this pattern needed?