Skip to content

[mlir][spirv] Remove ConstantLike trait from spirv.ARM.GraphConstant#198054

Merged
CoTinker merged 1 commit into
llvm:mainfrom
CoTinker:constant
May 16, 2026
Merged

[mlir][spirv] Remove ConstantLike trait from spirv.ARM.GraphConstant#198054
CoTinker merged 1 commit into
llvm:mainfrom
CoTinker:constant

Conversation

@CoTinker

Copy link
Copy Markdown
Contributor

Operations with the ConstantLike trait can always be folded into a concrete attribute value. However, the spirv.ARM.GraphConstant op cannot be folded, because its GraphConstantID is merely a unique identifier used to map to the actual constants defined in the SPIR-V module. Therefore, the ConstantLike trait should be removed from pirv.ARM.GraphConstant. Fixes #197970.

Operations with the `ConstantLike` trait can always be folded into a concrete attribute value. However, the `spirv.ARM.GraphConstant` op cannot be folded, because its GraphConstantID is merely a unique identifier used to map to the actual constants defined in the SPIR-V module. Therefore, the `ConstantLike` trait should be removed from `pirv.ARM.GraphConstant`.
@llvmorg-github-actions

llvmorg-github-actions Bot commented May 16, 2026

Copy link
Copy Markdown

@llvm/pr-subscribers-mlir-spirv

@llvm/pr-subscribers-mlir

Author: Longsheng Mou (CoTinker)

Changes

Operations with the ConstantLike trait can always be folded into a concrete attribute value. However, the spirv.ARM.GraphConstant op cannot be folded, because its GraphConstantID is merely a unique identifier used to map to the actual constants defined in the SPIR-V module. Therefore, the ConstantLike trait should be removed from pirv.ARM.GraphConstant. Fixes #197970.


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

1 Files Affected:

  • (modified) mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGraphOps.td (+1-1)
diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGraphOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGraphOps.td
index d8012749131d6..b68a635253975 100644
--- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGraphOps.td
+++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGraphOps.td
@@ -116,7 +116,7 @@ def InGraphScope : PredOpTrait<
 
 // -----
 
-def SPIRV_GraphConstantARMOp : SPIRV_GraphARMOp<"GraphConstant", [InGraphScope, Pure, ConstantLike]> {
+def SPIRV_GraphConstantARMOp : SPIRV_GraphARMOp<"GraphConstant", [InGraphScope, Pure]> {
   let summary = "Declare a graph constant.";
 
   let description = [{

@CoTinker CoTinker merged commit 199e750 into llvm:main May 16, 2026
14 checks passed
@CoTinker CoTinker deleted the constant branch May 16, 2026 06:31
pedroMVicente pushed a commit to pedroMVicente/llvm-project that referenced this pull request May 19, 2026
…lvm#198054)

Operations with the `ConstantLike` trait can always be folded into a
concrete attribute value. However, the `spirv.ARM.GraphConstant` op
cannot be folded, because its GraphConstantID is merely a unique
identifier used to map to the actual constants defined in the SPIR-V
module. Therefore, the `ConstantLike` trait should be removed from
`pirv.ARM.GraphConstant`. Fixes llvm#197970.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

3 participants