This change adds a new option to the StandardToLLVM lowering to configure
the bitwidth of the index type independently of the target architecture's
pointer size.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Have you considered using LLVMTypeConverterCustomization for this? If you had and decided otherwise, I'm okay to land this after the comments are addressed.
IMO, it should be now possible to drop the the customization and use the new dispatch features available in TypeConverter.
mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h | ||
---|---|---|
66 | Nit: use the named constant instead | |
mlir/lib/Conversion/GPUCommon/IndexIntrinsicsOpLowering.h | ||
36–37 | Can we just have an accessor in the type converter that returns the bitwidth without having to construct the type? | |
36–37 | Nit: while you are there, let's use camelBack for variable names. | |
mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp | ||
134 | Nit: drop trivial braces | |
137 | leftover debug stmt | |
3079 | Consider including the value that leads to the machine word size being used, otherwise it may confuse people to have bitwidth=0. |
I did not go with the customization as it was not clear to me how those would compose. One should still be able to select different lowerings for signatures and the index type.
I did not understand your comment about new dispatch features. Can you explain?
mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h | ||
---|---|---|
51 | Can this be just a field (or a new callback) in this structure instead? |
mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h | ||
---|---|---|
196 | customizations already has it, let's just have getIndexType() access customizations instead and drop the duplicate field. We store the copy of what is passed in the constructor, so we can freely update it with the value derived from the module if necessary. |
Can this be just a field (or a new callback) in this structure instead?