[Mlir-commits] [mlir] 8d8502a - [mlir][spirv] Add op decoration NoContraction (#88578)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Apr 12 23:00:50 PDT 2024
Author: Hsiangkai Wang
Date: 2024-04-13T07:00:46+01:00
New Revision: 8d8502a1b6e4e2b775d16be456f6b5ee544dcc55
URL: https://github.com/llvm/llvm-project/commit/8d8502a1b6e4e2b775d16be456f6b5ee544dcc55
DIFF: https://github.com/llvm/llvm-project/commit/8d8502a1b6e4e2b775d16be456f6b5ee544dcc55.diff
LOG: [mlir][spirv] Add op decoration NoContraction (#88578)
Added:
Modified:
mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp
mlir/lib/Target/SPIRV/Serialization/Serializer.cpp
mlir/test/Target/SPIRV/decorations.mlir
Removed:
################################################################################
diff --git a/mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp b/mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp
index 57e8d9a7729629..faaa42023a803a 100644
--- a/mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp
+++ b/mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp
@@ -310,6 +310,7 @@ LogicalResult spirv::Deserializer::processDecoration(ArrayRef<uint32_t> words) {
case spirv::Decoration::RelaxedPrecision:
case spirv::Decoration::Restrict:
case spirv::Decoration::RestrictPointer:
+ case spirv::Decoration::NoContraction:
if (words.size() != 2) {
return emitError(unknownLoc, "OpDecoration with ")
<< decorationName << "needs a single target <id>";
diff --git a/mlir/lib/Target/SPIRV/Serialization/Serializer.cpp b/mlir/lib/Target/SPIRV/Serialization/Serializer.cpp
index 9a74ac115e9555..200abdf993ce8c 100644
--- a/mlir/lib/Target/SPIRV/Serialization/Serializer.cpp
+++ b/mlir/lib/Target/SPIRV/Serialization/Serializer.cpp
@@ -276,6 +276,7 @@ LogicalResult Serializer::processDecorationAttr(Location loc, uint32_t resultID,
case spirv::Decoration::RelaxedPrecision:
case spirv::Decoration::Restrict:
case spirv::Decoration::RestrictPointer:
+ case spirv::Decoration::NoContraction:
// For unit attributes and decoration attributes, the args list
// has no values so we do nothing.
if (isa<UnitAttr, DecorationAttr>(attr))
diff --git a/mlir/test/Target/SPIRV/decorations.mlir b/mlir/test/Target/SPIRV/decorations.mlir
index e8f75a1edbd086..195773735431e5 100644
--- a/mlir/test/Target/SPIRV/decorations.mlir
+++ b/mlir/test/Target/SPIRV/decorations.mlir
@@ -87,3 +87,13 @@ spirv.func @fadd_decorations(%arg: f32) -> f32 "None" {
spirv.ReturnValue %0 : f32
}
}
+
+// -----
+
+spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Kernel], []> {
+spirv.func @fmul_decorations(%arg: f32) -> f32 "None" {
+ // CHECK: spirv.FMul %{{.*}}, %{{.*}} {no_contraction}
+ %0 = spirv.FMul %arg, %arg {no_contraction} : f32
+ spirv.ReturnValue %0 : f32
+}
+}
More information about the Mlir-commits
mailing list