@@ -1461,6 +1461,8 @@ class ConvertBuiltin<string name, InstructionSet set> {
1461
1461
bit IsRounded = !not(!eq(!find(name, "_rt"), -1));
1462
1462
bit IsBfloat16 = !or(!not(!eq(!find(name, "BF16"), -1)),
1463
1463
!not(!eq(!find(name, "bfloat16"), -1)));
1464
+ bit IsTF32 = !or(!not(!eq(!find(name, "TF32"), -1)),
1465
+ !not(!eq(!find(name, "tensor_float32"), -1)));
1464
1466
FPRoundingMode RoundingMode = !cond(!not(!eq(!find(name, "_rte"), -1)) : RTE,
1465
1467
!not(!eq(!find(name, "_rtz"), -1)) : RTZ,
1466
1468
!not(!eq(!find(name, "_rtp"), -1)) : RTP,
@@ -1472,7 +1474,7 @@ class ConvertBuiltin<string name, InstructionSet set> {
1472
1474
def ConvertBuiltins : GenericTable {
1473
1475
let FilterClass = "ConvertBuiltin";
1474
1476
let Fields = ["Name", "Set", "IsDestinationSigned", "IsSaturated",
1475
- "IsRounded", "IsBfloat16", "RoundingMode"];
1477
+ "IsRounded", "IsBfloat16", "IsTF32", " RoundingMode"];
1476
1478
string TypeOf_Set = "InstructionSet";
1477
1479
string TypeOf_RoundingMode = "FPRoundingMode";
1478
1480
}
@@ -1556,6 +1558,25 @@ foreach conv = ["FToBF16INTEL", "BF16ToFINTEL"] in {
1556
1558
def : ConvertBuiltin<!strconcat("__spirv_Convert", conv), OpenCL_std>;
1557
1559
}
1558
1560
1561
+ // cl_intel_tensor_float32_conversions / SPV_INTEL_tensor_float32_conversion
1562
+ // Multiclass used to define at the same time both a demangled builtin record
1563
+ // and a corresponding convert builtin record.
1564
+ multiclass DemangledTF32RoundBuiltin<string name1, string name2> {
1565
+ // Create records for scalar and vector conversions.
1566
+ foreach i = ["", "2", "3", "4", "8", "16"] in {
1567
+ def : DemangledBuiltin<!strconcat("intel_round_", name1, i, name2, i), OpenCL_std, Convert, 1, 1>;
1568
+ def : ConvertBuiltin<!strconcat("intel_round_", name1, i, name2, i), OpenCL_std>;
1569
+ }
1570
+ }
1571
+
1572
+ defm : DemangledTF32RoundBuiltin<"tensor_float32", "_as_float">;
1573
+ defm : DemangledTF32RoundBuiltin<"as_tensor_float32", "_float">;
1574
+
1575
+ foreach conv = ["FToTF32INTEL"] in {
1576
+ def : DemangledBuiltin<!strconcat("__spirv_Round", conv), OpenCL_std, Convert, 1, 1>;
1577
+ def : ConvertBuiltin<!strconcat("__spirv_Round", conv), OpenCL_std>;
1578
+ }
1579
+
1559
1580
//===----------------------------------------------------------------------===//
1560
1581
// Class defining a vector data load/store builtin record used for lowering
1561
1582
// into OpExtInst instruction.
0 commit comments