[Mlir-commits] [mlir] [mlir][GPU] Verify known_{block, grid, cluster}_size is non-negative (PR #179886)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Feb 5 03:31:54 PST 2026
================
@@ -347,9 +347,22 @@ def GPU_SubgroupSizeOp : GPU_Op<"subgroup_size", [
let assemblyFormat = "(`upper_bound` $upper_bound^)? attr-dict `:` type($result)";
}
-def GPU_OptionalDimSizeHintAttr : ConfinedAttr<OptionalAttr<DenseI32ArrayAttr>,
- [AttrConstraint<Or<[IsNullAttr.predicate, DenseArrayCount<3>.predicate]>,
- "with 3 elements (if present)">]>;
+def GPU_OptionalDimSizeHintAttr : ConfinedAttr<
+ OptionalAttr<DenseI32ArrayAttr>,
+ [AttrConstraint<
+ Or<[
+ IsNullAttr.predicate,
+ And<[
+ DenseArrayCount<3>.predicate,
+ CPred<"([](mlir::Attribute a) { "
+ " auto arr = ::llvm::cast<::mlir::DenseI32ArrayAttr>(a).asArrayRef();"
+ " return ::llvm::all_of(arr, [](int32_t v) { return v >= 0; });"
+ "})($_self)">
+ ]>
+ ]>,
+ "with 3 elements (if present) and all elements >= 0"
----------------
woruyu wrote:
I don't consider this carefully. Just because of -1 in issue, I modify to >=0.
https://github.com/llvm/llvm-project/pull/179886
More information about the Mlir-commits
mailing list