Skip to content

[MLIR Attr] add ArrayMaxCount attribute constraint #92453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 16, 2024

Conversation

emosy
Copy link
Contributor

@emosy emosy commented May 16, 2024

this is the dual of ArrayMinCount. I saw that I needed it but it didn't exist yet

@emosy emosy changed the title [MLIR Attr] add ArrayMaxCount [MLIR Attr] add ArrayMaxCount attribute constraint May 16, 2024
@llvmbot llvmbot added mlir:core MLIR Core Infrastructure mlir mlir:ods labels May 16, 2024
@llvmbot
Copy link
Member

llvmbot commented May 16, 2024

@llvm/pr-subscribers-mlir
@llvm/pr-subscribers-mlir-ods

@llvm/pr-subscribers-mlir-core

Author: Ryan Thomas Lynch (emosy)

Changes

this is the dual of ArrayMinCount. I saw that I needed it but it didn't exist yet


Full diff: https://github.com/llvm/llvm-project/pull/92453.diff

1 Files Affected:

  • (modified) mlir/include/mlir/IR/CommonAttrConstraints.td (+4)
diff --git a/mlir/include/mlir/IR/CommonAttrConstraints.td b/mlir/include/mlir/IR/CommonAttrConstraints.td
index 0d69bb0717a59..d99bde1f87ef0 100644
--- a/mlir/include/mlir/IR/CommonAttrConstraints.td
+++ b/mlir/include/mlir/IR/CommonAttrConstraints.td
@@ -773,6 +773,10 @@ def IntPositive : AttrConstraint<
     CPred<"::llvm::cast<::mlir::IntegerAttr>($_self).getValue().isStrictlyPositive()">,
     "whose value is positive">;
 
+class ArrayMaxCount<int n> : AttrConstraint<
+    CPred<"::llvm::cast<::mlir::ArrayAttr>($_self).size() <= " # n>,
+    "with at most " # n # " elements">;
+
 class ArrayMinCount<int n> : AttrConstraint<
     CPred<"::llvm::cast<::mlir::ArrayAttr>($_self).size() >= " # n>,
     "with at least " # n # " elements">;

emosy added 2 commits May 16, 2024 15:13
this is the dual of ArrayMinCount. I saw that I needed it but it didn't exist yet
@emosy emosy force-pushed the mlir/attr/arraymaxcount branch from 89d7718 to 8d97179 Compare May 16, 2024 22:13
@emosy
Copy link
Contributor Author

emosy commented May 16, 2024

@joker-eph Thanks! I also made some changes to Operations.md

Feel free to merge the PR when ready

@joker-eph joker-eph merged commit e578314 into llvm:main May 16, 2024
3 of 4 checks passed
qiaojbao pushed a commit to GPUOpen-Drivers/llvm-project that referenced this pull request Jun 5, 2024
…f282b2831

Local branch amd-gfx f40f282 Merged main:d311a62e2f1ae34a0329c3812f2969cedac93561 into amd-gfx:3c31da5ad733
Remote branch main e578314 [MLIR Attr] add ArrayMaxCount attribute constraint (llvm#92453)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mlir:core MLIR Core Infrastructure mlir:ods mlir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants