[Mlir-commits] [mlir] [MLIR][XeGPU][XeVM] Update single element vector type handling. (PR #178558)

Jianhui Li llvmlistbot at llvm.org
Tue Feb 3 09:05:49 PST 2026


================
@@ -1215,34 +1216,79 @@ struct ConvertXeGPUToXeVMPass
       return {};
     };
 
+    // Materialization to convert
+    //   - single element vector to single element of vector element type
+    // Applies only to target materialization.
+    auto vectorToSingleElementMaterializationCast =
+        [](OpBuilder &builder, Type type, ValueRange inputs,
+           Location loc) -> Value {
+      if (inputs.size() != 1)
+        return {};
+      auto input = inputs.front();
+      if (auto vecTy = dyn_cast<VectorType>(input.getType())) {
+        if (type == vecTy.getElementType() ||
+            ((vecTy.getElementType() == builder.getIndexType()) &&
+             type.isInteger())) {
----------------
Jianhui-Li wrote:

The comment below says "If the vector rank is 0 or has a single element,
          extract scalar of target type."
Maybe change it to be "extract element from the vector assuming it only holds a single element. 

https://github.com/llvm/llvm-project/pull/178558


More information about the Mlir-commits mailing list