[Mlir-commits] [mlir] Preserve Encoding During TensorOp Creation (PR #80871)

ian Bearman llvmlistbot at llvm.org
Tue Feb 6 08:45:50 PST 2024


================
@@ -1622,7 +1623,20 @@ CollapseShapeOp::inferCollapsedType(RankedTensorType type,
     currentDim += dim;
   }
 
-  return RankedTensorType::get(newShape, type.getElementType());
+  auto encoding = type.getEncoding();
+  if (auto v = encoding.dyn_cast_or_null<VerifiableTensorEncoding>()) {
+    auto ignoreError = [&] {
+      auto emitter = mlir::emitError(UnknownLoc::get(type.getContext()));
+      emitter.abandon();
+      return emitter;
+    };
+    if (failed(
----------------
manbearian wrote:

@aartbik , this was the change that @matthias-springer wanted to call out. This was a real case i ran into where the encoding could no longer be applied to the derived type since the dimensionality changed. 

Thoughts?

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


More information about the Mlir-commits mailing list