Skip to content

[mlir] Change TypeOrValueSemanticsContainer base from TypeConstraint to Type #129433

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 1 commit into from
Mar 13, 2025

Conversation

Hardcode84
Copy link
Contributor

Type is derived from TypeConstraint. Using Type as base allows to use SignlessIntegerLike and friends in Variadic<>.

…nt` to `Type`

`Type` is derived from `TypeConstraint`. Using `Type` as  base allows to use `SignlessIntegerLike` and friends in `Variadic<>`.
@Hardcode84 Hardcode84 requested review from joker-eph and River707 March 2, 2025 12:46
@llvmbot llvmbot added mlir:core MLIR Core Infrastructure mlir mlir:ods labels Mar 2, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 2, 2025

@llvm/pr-subscribers-mlir-core

Author: Ivan Butygin (Hardcode84)

Changes

Type is derived from TypeConstraint. Using Type as base allows to use SignlessIntegerLike and friends in Variadic&lt;&gt;.


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

2 Files Affected:

  • (modified) mlir/include/mlir/IR/CommonTypeConstraints.td (+1-1)
  • (modified) mlir/test/lib/Dialect/Test/TestOps.td (+4)
diff --git a/mlir/include/mlir/IR/CommonTypeConstraints.td b/mlir/include/mlir/IR/CommonTypeConstraints.td
index a18b32253d857..601517717978e 100644
--- a/mlir/include/mlir/IR/CommonTypeConstraints.td
+++ b/mlir/include/mlir/IR/CommonTypeConstraints.td
@@ -883,7 +883,7 @@ class NestedTupleOf<list<Type> allowedTypes> :
 // Type constraint for types that are "like" some type or set of types T, that is
 // they're either a T or a mapable container of Ts.
 class TypeOrValueSemanticsContainer<Type allowedType, string name>
-    : TypeConstraint<Or<[
+    : Type<Or<[
   allowedType.predicate,
   ValueSemanticsContainerOf<[allowedType]>.predicate]>,
   name>;
diff --git a/mlir/test/lib/Dialect/Test/TestOps.td b/mlir/test/lib/Dialect/Test/TestOps.td
index cdc1237ec8c5a..cc33a7bf53980 100644
--- a/mlir/test/lib/Dialect/Test/TestOps.td
+++ b/mlir/test/lib/Dialect/Test/TestOps.td
@@ -103,6 +103,10 @@ def TEST_TestType : DialectType<Test_Dialect,
     CPred<"::llvm::isa<::test::TestType>($_self)">, "test">,
     BuildableType<"$_builder.getType<::test::TestType>()">;
 
+def SignlessLikeVariadic : TEST_Op<"signless_like_variadic"> {
+  let arguments = (ins Variadic<SignlessIntegerLike>:$x);
+}
+
 //===----------------------------------------------------------------------===//
 // Test Symbols
 //===----------------------------------------------------------------------===//

@llvmbot
Copy link
Member

llvmbot commented Mar 2, 2025

@llvm/pr-subscribers-mlir-ods

Author: Ivan Butygin (Hardcode84)

Changes

Type is derived from TypeConstraint. Using Type as base allows to use SignlessIntegerLike and friends in Variadic&lt;&gt;.


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

2 Files Affected:

  • (modified) mlir/include/mlir/IR/CommonTypeConstraints.td (+1-1)
  • (modified) mlir/test/lib/Dialect/Test/TestOps.td (+4)
diff --git a/mlir/include/mlir/IR/CommonTypeConstraints.td b/mlir/include/mlir/IR/CommonTypeConstraints.td
index a18b32253d857..601517717978e 100644
--- a/mlir/include/mlir/IR/CommonTypeConstraints.td
+++ b/mlir/include/mlir/IR/CommonTypeConstraints.td
@@ -883,7 +883,7 @@ class NestedTupleOf<list<Type> allowedTypes> :
 // Type constraint for types that are "like" some type or set of types T, that is
 // they're either a T or a mapable container of Ts.
 class TypeOrValueSemanticsContainer<Type allowedType, string name>
-    : TypeConstraint<Or<[
+    : Type<Or<[
   allowedType.predicate,
   ValueSemanticsContainerOf<[allowedType]>.predicate]>,
   name>;
diff --git a/mlir/test/lib/Dialect/Test/TestOps.td b/mlir/test/lib/Dialect/Test/TestOps.td
index cdc1237ec8c5a..cc33a7bf53980 100644
--- a/mlir/test/lib/Dialect/Test/TestOps.td
+++ b/mlir/test/lib/Dialect/Test/TestOps.td
@@ -103,6 +103,10 @@ def TEST_TestType : DialectType<Test_Dialect,
     CPred<"::llvm::isa<::test::TestType>($_self)">, "test">,
     BuildableType<"$_builder.getType<::test::TestType>()">;
 
+def SignlessLikeVariadic : TEST_Op<"signless_like_variadic"> {
+  let arguments = (ins Variadic<SignlessIntegerLike>:$x);
+}
+
 //===----------------------------------------------------------------------===//
 // Test Symbols
 //===----------------------------------------------------------------------===//

@llvmbot
Copy link
Member

llvmbot commented Mar 2, 2025

@llvm/pr-subscribers-mlir

Author: Ivan Butygin (Hardcode84)

Changes

Type is derived from TypeConstraint. Using Type as base allows to use SignlessIntegerLike and friends in Variadic&lt;&gt;.


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

2 Files Affected:

  • (modified) mlir/include/mlir/IR/CommonTypeConstraints.td (+1-1)
  • (modified) mlir/test/lib/Dialect/Test/TestOps.td (+4)
diff --git a/mlir/include/mlir/IR/CommonTypeConstraints.td b/mlir/include/mlir/IR/CommonTypeConstraints.td
index a18b32253d857..601517717978e 100644
--- a/mlir/include/mlir/IR/CommonTypeConstraints.td
+++ b/mlir/include/mlir/IR/CommonTypeConstraints.td
@@ -883,7 +883,7 @@ class NestedTupleOf<list<Type> allowedTypes> :
 // Type constraint for types that are "like" some type or set of types T, that is
 // they're either a T or a mapable container of Ts.
 class TypeOrValueSemanticsContainer<Type allowedType, string name>
-    : TypeConstraint<Or<[
+    : Type<Or<[
   allowedType.predicate,
   ValueSemanticsContainerOf<[allowedType]>.predicate]>,
   name>;
diff --git a/mlir/test/lib/Dialect/Test/TestOps.td b/mlir/test/lib/Dialect/Test/TestOps.td
index cdc1237ec8c5a..cc33a7bf53980 100644
--- a/mlir/test/lib/Dialect/Test/TestOps.td
+++ b/mlir/test/lib/Dialect/Test/TestOps.td
@@ -103,6 +103,10 @@ def TEST_TestType : DialectType<Test_Dialect,
     CPred<"::llvm::isa<::test::TestType>($_self)">, "test">,
     BuildableType<"$_builder.getType<::test::TestType>()">;
 
+def SignlessLikeVariadic : TEST_Op<"signless_like_variadic"> {
+  let arguments = (ins Variadic<SignlessIntegerLike>:$x);
+}
+
 //===----------------------------------------------------------------------===//
 // Test Symbols
 //===----------------------------------------------------------------------===//

@Hardcode84
Copy link
Contributor Author

ping

@Hardcode84 Hardcode84 merged commit 786e70f into llvm:main Mar 13, 2025
15 checks passed
@Hardcode84 Hardcode84 deleted the variadic-int-like branch March 13, 2025 11:17
frederik-h pushed a commit to frederik-h/llvm-project that referenced this pull request Mar 18, 2025
…nt` to `Type` (llvm#129433)

`Type` is derived from `TypeConstraint`. Using `Type` as base allows to
use `SignlessIntegerLike` and friends in `Variadic<>`.
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