[llvm] [Verifier] Remove reqd_work_group_size product limit check (PR #206022)

Wenju He via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 26 03:06:46 PDT 2026


https://github.com/wenju-he created https://github.com/llvm/llvm-project/pull/206022

6794e31 breaks SYCL test that use UINT32_MAX in reqd_work_group_size: https://github.com/intel/llvm/blob/33ef4bef99f9/sycl/test-e2e/OptionalKernelFeatures/large-reqd-work-group-size.cpp#L50

Checking the product of reqd_work_group_size values is too restrictive for all targets.
Any i64 value in reqd_work_group_size is actually valid IR. The product change is probably better to do at runtime instead for some targets.

>From 682b5ccb665d6d2f31e5f40ca91ad03e916ca853 Mon Sep 17 00:00:00 2001
From: Wenju He <wenju.he at intel.com>
Date: Fri, 26 Jun 2026 02:49:36 -0700
Subject: [PATCH] [Verifier] Remove reqd_work_group_size product limit check

6794e31 breaks SYCL test that use UINT32_MAX in reqd_work_group_size:
https://github.com/intel/llvm/blob/33ef4bef99f9/sycl/test-e2e/OptionalKernelFeatures/large-reqd-work-group-size.cpp#L50

Checking the product of reqd_work_group_size values is too restrictive
for all targets.
Any i64 value in reqd_work_group_size is actually valid IR. The product
change is probably better to do at runtime instead for some targets.
---
 llvm/lib/IR/Verifier.cpp | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 648446555793b..f803c9f79d127 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -2637,7 +2637,6 @@ void Verifier::verifyFunctionMetadata(
       if (MD->getNumOperands() != 3)
         continue;
 
-      uint64_t Product = 1;
       for (unsigned I = 0; I != 3; ++I) {
         ConstantInt *C = mdconst::dyn_extract<ConstantInt>(MD->getOperand(I));
         Check(C, "reqd_work_group_size operands must be integer constants", MD);
@@ -2649,13 +2648,6 @@ void Verifier::verifyFunctionMetadata(
               "reqd_work_group_size operands must fit in 64 bits", MD);
         if (Value.getActiveBits() > 64)
           break;
-
-        uint64_t Dim = Value.getZExtValue();
-        Check(Dim == 0 || Product <= std::numeric_limits<uint64_t>::max() / Dim,
-              "reqd_work_group_size product must fit in 64 bits", MD);
-        if (Dim != 0 && Product > std::numeric_limits<uint64_t>::max() / Dim)
-          break;
-        Product *= Dim;
       }
     }
   }



More information about the llvm-commits mailing list