[Mlir-commits] [mlir] [mlir][spirv] Improve type constraints for SPIR-V Tosa CastOp (PR #192227)
Igor Wodiany
llvmlistbot at llvm.org
Wed Apr 15 09:52:50 PDT 2026
================
@@ -2661,11 +2682,57 @@ def SPIRV_TosaResizeOp : SPIRV_TosaOpWithResult<"Resize", 63, [Pure,
def SPIRV_TosaCastOp : SPIRV_TosaOpWithResult<"Cast", 64, [Pure,
- AllShapesMatch<["input", "output"]>]> {
+ AllShapesMatch<["input", "output"]>,
+ ElementTypeIsNot<"input", I64>,
+ TypeConstraintImplicationOn<"input", F16, "output", [F32, I16, I32, I8]>,
+ TypeConstraintImplicationOn<"input", F32, "output", [F16, I16, I32, I8, BF16]>,
+ TypeConstraintImplicationOn<"input", I16, "output", [F16, F32, I32, I8, SPIRV_Bool, BF16]>,
+ TypeConstraintImplicationOn<"input", I32, "output", [F16, F32, I16, I8, SPIRV_Bool, BF16]>,
+ TypeConstraintImplicationOn<"input", I8, "output", [F16, F32, I16, I32, SPIRV_Bool, BF16]>,
+ TypeConstraintImplicationOn<"input", SPIRV_Bool, "output", [I16, I32, I8]>,
+ TypeConstraintImplicationOn<"input", BF16, "output", [F32, I16, I32, I8]>]> {
let summary = "Cast operation.";
let description = [{
Casts a tensor from one data type to another.
+ Valid casting combinations are defined in the following table:
+
+ | Mode | Input | Output |
----------------
IgWod wrote:
Not sure we need all three columns. I'd either keep only Mode, or Input and Output.
https://github.com/llvm/llvm-project/pull/192227
More information about the Mlir-commits
mailing list