[Mlir-commits] [mlir] ecf8211 - [mlir][gpu] Guard negative workgroup_attributions in GPU ops (#174409)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Jan 13 13:19:17 PST 2026
Author: Prathamesh Tagore
Date: 2026-01-13T16:19:13-05:00
New Revision: ecf8211fda3ec81a2ac89f805cb915a3ac352aec
URL: https://github.com/llvm/llvm-project/commit/ecf8211fda3ec81a2ac89f805cb915a3ac352aec
DIFF: https://github.com/llvm/llvm-project/commit/ecf8211fda3ec81a2ac89f805cb915a3ac352aec.diff
LOG: [mlir][gpu] Guard negative workgroup_attributions in GPU ops (#174409)
Added:
Modified:
mlir/include/mlir/Dialect/GPU/IR/GPUOps.td
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/GPU/IR/GPUOps.td b/mlir/include/mlir/Dialect/GPU/IR/GPUOps.td
index e8c23200547d6..571665e7440b7 100644
--- a/mlir/include/mlir/Dialect/GPU/IR/GPUOps.td
+++ b/mlir/include/mlir/Dialect/GPU/IR/GPUOps.td
@@ -456,7 +456,12 @@ def GPU_GPUFuncOp : GPU_Op<"func", [
unsigned getNumWorkgroupAttributions() {
auto attr = (*this)->getAttrOfType<IntegerAttr>(
getNumWorkgroupAttributionsAttrName());
- return attr ? attr.getInt() : 0;
+ if (!attr)
+ return 0;
+ int64_t value = attr.getInt();
+ assert(value >= 0 && value < std::numeric_limits<uint32_t>::max() &&
+ "invalid workgroup attribution count");
+ return value;
}
/// Return the index of the first workgroup attribution in the block argument
@@ -1006,7 +1011,12 @@ def GPU_LaunchOp : GPU_Op<"launch", [
unsigned getNumWorkgroupAttributions() {
auto attr = (*this)->getAttrOfType<IntegerAttr>(
getNumWorkgroupAttributionsAttrName());
- return attr ? attr.getInt() : 0;
+ if (!attr)
+ return 0;
+ int64_t value = attr.getInt();
+ assert(value >= 0 && value < std::numeric_limits<uint32_t>::max() &&
+ "invalid workgroup attribution count");
+ return value;
}
/// Returns a list of block arguments that correspond to buffers located in
More information about the Mlir-commits
mailing list