Skip to content

Commit 87934c4

Browse files
committed
refine
1 parent 605eee0 commit 87934c4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

mlir/lib/Dialect/XeGPU/Transforms/XeGPUWgToSgDistribute.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,11 @@ struct XeGPUWgToSgDistributePass
398398
} // namespace
399399

400400
void XeGPUWgToSgDistributePass::runOnOperation() {
401+
// Track existing UnrealizedConversionCastOps
402+
SmallVector<Operation *> existingCastOps;
403+
getOperation()->walk([&](UnrealizedConversionCastOp castOp) {
404+
existingCastOps.push_back(castOp.getOperation());
405+
});
401406

402407
TypeConverter converter;
403408
converter.addConversion([&](Type type) -> Type { return type; });
@@ -478,7 +483,10 @@ void XeGPUWgToSgDistributePass::runOnOperation() {
478483
return isLegal(layout);
479484
});
480485

481-
target.addIllegalOp<UnrealizedConversionCastOp>();
486+
target.addDynamicallyLegalOp<UnrealizedConversionCastOp>(
487+
[=](UnrealizedConversionCastOp op) {
488+
return llvm::is_contained(existingCastOps, op.getOperation());
489+
});
482490

483491
target.markUnknownOpDynamicallyLegal([](Operation *) { return true; });
484492

0 commit comments

Comments
 (0)