[Mlir-commits] [mlir] [MLIR][XeVM] Update XeVM type converter (PR #189306)
Sang Ik Lee
llvmlistbot at llvm.org
Fri Apr 10 07:55:13 PDT 2026
================
@@ -1084,14 +1049,25 @@ struct ConvertXeGPUToXeVMPass
using Base::Base;
void runOnOperation() override {
- LLVMTypeConverter typeConverter(&getContext());
+ MLIRContext *context = &getContext();
+
+ // XeVM type converter is based on LLVM type converter with the
+ // following customizations.
+ // First, type conversion rules are added for xegpu custom types,
+ // TensorDescType and MemDescType.
+ // Second, MemRefType is lowered to single integer type
+ // Third, VectorType of single element or 0D is converted to vector
+ // element type. Otherwise, vector type is flatten to 1D.
+ LowerToLLVMOptions options(context);
+ options.overrideIndexBitwidth(this->use64bitIndex ? 64 : 32);
+ LLVMTypeConverter typeConverter(context, options);
+
+ Type xevmIndexType = typeConverter.convertType(IndexType::get(context));
+ Type i32Type = IntegerType::get(context, 32);
typeConverter.addConversion([&](VectorType type) -> Type {
- unsigned rank = type.getRank();
- auto elemType = type.getElementType();
- // If the element type is index, convert it to i64.
- if (llvm::isa<IndexType>(elemType))
- elemType = IntegerType::get(&getContext(), 64);
+ auto elemType = typeConverter.convertType(type.getElementType());
----------------
silee2 wrote:
Thanks. Missed updating materialization cast.
https://github.com/llvm/llvm-project/pull/189306
More information about the Mlir-commits
mailing list