[PATCH] D141734: [SPIR-V] Emit OpExecutionMode ContractionOff for no FP_CONTRACT metadata
Michal Paszkowski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 19 06:27:24 PST 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2bcedd464348: [SPIR-V] Emit OpExecutionMode ContractionOff for no FP_CONTRACT metadata (authored by mpaszkowski).
Changed prior to commit:
https://reviews.llvm.org/D141734?vs=489140&id=490494#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141734/new/
https://reviews.llvm.org/D141734
Files:
llvm/lib/Target/SPIRV/SPIRVAsmPrinter.cpp
llvm/test/CodeGen/SPIRV/metadata-opencl.ll
llvm/test/CodeGen/SPIRV/opencl/kernel_arg_type_function_metadata.ll
llvm/test/CodeGen/SPIRV/opencl/kernel_arg_type_module_metadata.ll
llvm/test/CodeGen/SPIRV/opencl/metadata/fp_contractions_metadata.ll
llvm/test/CodeGen/SPIRV/opencl/metadata/kernel_arg_type_function_metadata.ll
llvm/test/CodeGen/SPIRV/opencl/metadata/kernel_arg_type_module_metadata.ll
llvm/test/CodeGen/SPIRV/opencl/metadata/no_fp_contractions_metadata.ll
llvm/test/CodeGen/SPIRV/opencl/metadata/opencl_version_metadata.ll
Index: llvm/test/CodeGen/SPIRV/opencl/metadata/no_fp_contractions_metadata.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/SPIRV/opencl/metadata/no_fp_contractions_metadata.ll
@@ -0,0 +1,8 @@
+; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
+
+; CHECK: OpEntryPoint Kernel %[[#ENTRY:]] "foo"
+; CHECK: OpExecutionMode %[[#ENTRY]] ContractionOff
+define spir_kernel void @foo() {
+entry:
+ ret void
+}
Index: llvm/test/CodeGen/SPIRV/opencl/metadata/fp_contractions_metadata.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/SPIRV/opencl/metadata/fp_contractions_metadata.ll
@@ -0,0 +1,10 @@
+; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
+
+; CHECK: OpEntryPoint Kernel %[[#ENTRY:]] "foo"
+; CHECK-NOT: OpExecutionMode %[[#ENTRY]] ContractionOff
+define spir_kernel void @foo() {
+entry:
+ ret void
+}
+
+!opencl.enable.FP_CONTRACT = !{}
Index: llvm/lib/Target/SPIRV/SPIRVAsmPrinter.cpp
===================================================================
--- llvm/lib/Target/SPIRV/SPIRVAsmPrinter.cpp
+++ llvm/lib/Target/SPIRV/SPIRVAsmPrinter.cpp
@@ -447,6 +447,15 @@
Inst.addOperand(MCOperand::createImm(TypeCode));
outputMCInst(Inst);
}
+ if (!M.getNamedMetadata("spirv.ExecutionMode") &&
+ !M.getNamedMetadata("opencl.enable.FP_CONTRACT")) {
+ MCInst Inst;
+ Inst.setOpcode(SPIRV::OpExecutionMode);
+ Inst.addOperand(MCOperand::createReg(FReg));
+ unsigned EM = static_cast<unsigned>(SPIRV::ExecutionMode::ContractionOff);
+ Inst.addOperand(MCOperand::createImm(EM));
+ outputMCInst(Inst);
+ }
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141734.490494.patch
Type: text/x-patch
Size: 1734 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230119/d6d6e742/attachment.bin>
More information about the llvm-commits
mailing list