[Mlir-commits] [mlir] [MLIR][XeGPU][TransformOps] Add get_desc_op (PR #166801)
Tuomas Kärnä
llvmlistbot at llvm.org
Mon Nov 10 02:40:40 PST 2025
================
@@ -111,6 +155,28 @@ setDescLayout(transform::TransformRewriter &rewriter,
return newDescOp;
}
+DiagnosedSilenceableFailure
+transform::GetDescOp::apply(transform::TransformRewriter &rewriter,
+ transform::TransformResults &results,
+ transform::TransformState &state) {
+
+ auto targetValues = state.getPayloadValues(getTarget());
+ if (!llvm::hasSingleElement(targetValues)) {
+ return emitDefiniteFailure()
+ << "requires exactly one target value handle (got "
+ << llvm::range_size(targetValues) << ")";
+ }
+
+ auto maybeDescOp =
+ findProducerOfType<xegpu::CreateNdDescOp>(*targetValues.begin());
+ if (!maybeDescOp) {
+ return emitSilenceableFailure(getLoc()) << "Could not find descriptor op.";
----------------
tkarna wrote:
Thanks, I agree. Updated the error message as suggested.
In the future, we can hopefully replace `xegpu.get_desc_op` with a generic transform dialect find-producer method which tracers through all operands and also supports more than loop block args.
When tracing through all operands the trace will branch out and we could find more than one create desc op. In those cases we could define more anchor ops to deduce the right tiles (e.g. in the above example one could match the broadcast op to get a handle to the bias).
https://github.com/llvm/llvm-project/pull/166801
More information about the Mlir-commits
mailing list