[Mlir-commits] [mlir] [MLIR][XeGPU][TransformOps] Add get_desc_op (PR #166801)
Jianhui Li
llvmlistbot at llvm.org
Fri Nov 7 23:02: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.";
----------------
Jianhui-Li wrote:
Actually user may write a program like below, and findProducerOfType will miss it since it only searches along operand(0).
A_desc = Create_nd_tdesc : <1024x1024xbf16>
A = Load_nd A_desc : <1024x1024xbf16>
Bias = load bias_memref : <1024xbf16>
Bias_bcast = broadcast Bias: <1024x1024xbf16>
A_Bias = add Bias_bcast, A //A tensor is used as 2nd parameter.
C = DPAS A_Bias, ...
I don't think it worths to complicate findProducerOfType(). Maybe the message can add a hint, like "Could not find a matching descriptor op when walking the producer chain of the first operand.";
https://github.com/llvm/llvm-project/pull/166801
More information about the Mlir-commits
mailing list