[llvm] 55dd65f - [SPIR-V] Diagnose integer dot builtins without SPV_KHR_integer_dot_product (#218599)

via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 07:54:44 PDT 2026


Author: Arseniy Obolenskiy
Date: 2026-08-26T16:54:39+02:00
New Revision: 55dd65f4616ddffd9898df26883a95a2e3e983bd

URL: https://github.com/llvm/llvm-project/commit/55dd65f4616ddffd9898df26883a95a2e3e983bd
DIFF: https://github.com/llvm/llvm-project/commit/55dd65f4616ddffd9898df26883a95a2e3e983bd.diff

LOG: [SPIR-V] Diagnose integer dot builtins without SPV_KHR_integer_dot_product (#218599)

Added: 
    

Modified: 
    llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
    llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_integer_dot_product/SPV_KHR_integer_dot_product_OCLtoSPIRV_int.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
index 01bf7d0926b15..0978a6c6e5c95 100644
--- a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
@@ -1928,9 +1928,13 @@ static bool generateDotOrFMulInst(StringRef DemangledCall,
 
   const auto *ST =
       static_cast<const SPIRVSubtarget *>(&MIRBuilder.getMF().getSubtarget());
-  if (GR->isScalarOrVectorOfType(Call->ReturnRegister, SPIRV::OpTypeInt) &&
-      (ST->canUseExtension(SPIRV::Extension::SPV_KHR_integer_dot_product) ||
-       ST->isAtLeastSPIRVVer(VersionTuple(1, 6)))) {
+  if (GR->isScalarOrVectorOfType(Call->ReturnRegister, SPIRV::OpTypeInt)) {
+    if (!ST->canUseExtension(SPIRV::Extension::SPV_KHR_integer_dot_product) &&
+        !ST->isAtLeastSPIRVVer(VersionTuple(1, 6)))
+      report_fatal_error(Twine(Call->Builtin->name()) +
+                             ": the builtin requires the following SPIR-V "
+                             "extension: SPV_KHR_integer_dot_product",
+                         false);
     const SPIRV::DemangledBuiltin *Builtin = Call->Builtin;
     const SPIRV::IntegerDotProductBuiltin *IntDot =
         SPIRV::lookupIntegerDotProductBuiltin(Builtin->name());

diff  --git a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_integer_dot_product/SPV_KHR_integer_dot_product_OCLtoSPIRV_int.ll b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_integer_dot_product/SPV_KHR_integer_dot_product_OCLtoSPIRV_int.ll
index 52ddc39265442..a387d57494017 100644
--- a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_integer_dot_product/SPV_KHR_integer_dot_product_OCLtoSPIRV_int.ll
+++ b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_integer_dot_product/SPV_KHR_integer_dot_product_OCLtoSPIRV_int.ll
@@ -2,6 +2,9 @@
 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32v1.6-unknown-unknown %s -o - -filetype=obj | spirv-val %}
 ; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown --spirv-ext=+SPV_KHR_integer_dot_product %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-EXT
 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown --spirv-ext=+SPV_KHR_integer_dot_product %s -o - -filetype=obj | spirv-val %}
+; RUN: not llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o - 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
+
+; CHECK-ERROR: LLVM ERROR: {{.*}}: the builtin requires the following SPIR-V extension: SPV_KHR_integer_dot_product
 
 ; CHECK: Capability DotProduct
 ; CHECK: Capability DotProductInput4x8BitPacked


        


More information about the llvm-commits mailing list