[Mlir-commits] [mlir] [MLIR][X86] Enable strict property assembly format (PR #217284)
Mehdi Amini
llvmlistbot at llvm.org
Wed Aug 19 03:50:49 PDT 2026
https://github.com/joker-eph created https://github.com/llvm/llvm-project/pull/217284
Enable the strict properties assembly format mode for the X86 dialect. Spell the mask-compress constant source attribute directly in the assembly format so it is not parsed from attr-dict in strict mode.
Assisted-by: Codex
>From d955abfcfd9ca3fdf83041cbaa728f43ab3f4dc6 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Wed, 6 May 2026 13:44:51 -0700
Subject: [PATCH] [MLIR][X86] Enable strict property assembly format
Enable the strict properties assembly format mode for the X86 dialect.
Spell the mask-compress constant source attribute directly in the assembly
format so it is not parsed from attr-dict in strict mode.
Assisted-by: Codex
---
mlir/include/mlir/Dialect/X86/X86.td | 4 +++-
mlir/test/Dialect/X86/legalize-for-llvm.mlir | 2 +-
mlir/test/Dialect/X86/roundtrip.mlir | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/mlir/include/mlir/Dialect/X86/X86.td b/mlir/include/mlir/Dialect/X86/X86.td
index 20a0695126d4e..681887e894260 100644
--- a/mlir/include/mlir/Dialect/X86/X86.td
+++ b/mlir/include/mlir/Dialect/X86/X86.td
@@ -25,6 +25,7 @@ include "mlir/IR/BuiltinTypes.td"
def X86_Dialect : Dialect {
let name = "x86";
+ let useStrictPropertiesInAssemblyFormat = 1;
let cppNamespace = "::mlir::x86";
let useDefaultTypePrinterParser = 1;
@@ -77,7 +78,8 @@ def MaskCompressOp : AVX512_Op<"mask.compress", [Pure,
OptionalAttr<ElementsAttr>:$constant_src);
let results = (outs VectorOfLengthAndType<[16, 8],
[F32, I32, F64, I64]>:$dst);
- let assemblyFormat = "$k `,` $a (`,` $src^)? attr-dict"
+ let assemblyFormat = "$k `,` $a (`,` $src^)? "
+ "(`constant_src` `=` $constant_src^)? attr-dict"
" `:` type($dst) (`,` type($src)^)?";
let hasVerifier = 1;
diff --git a/mlir/test/Dialect/X86/legalize-for-llvm.mlir b/mlir/test/Dialect/X86/legalize-for-llvm.mlir
index e5163c0297597..30e701ae73932 100644
--- a/mlir/test/Dialect/X86/legalize-for-llvm.mlir
+++ b/mlir/test/Dialect/X86/legalize-for-llvm.mlir
@@ -33,7 +33,7 @@ func.func @avx512_mask_compress(
// CHECK: llvm.mlir.constant(dense<5.000000e+00> : vector<16xf32>)
// CHECK: llvm.call_intrinsic "llvm.x86.avx512.mask.compress"
%1 = x86.avx512.mask.compress %k1, %a1
- {constant_src = dense<5.0> : vector<16xf32>} : vector<16xf32>
+ constant_src = dense<5.0> : vector<16xf32>: vector<16xf32>
// CHECK: llvm.call_intrinsic "llvm.x86.avx512.mask.compress"
%2 = x86.avx512.mask.compress %k2, %a2, %a2 : vector<8xi64>, vector<8xi64>
return %0, %1, %2 : vector<16xf32>, vector<16xf32>, vector<8xi64>
diff --git a/mlir/test/Dialect/X86/roundtrip.mlir b/mlir/test/Dialect/X86/roundtrip.mlir
index 49f3ebe4415d1..e0bae417e49c3 100644
--- a/mlir/test/Dialect/X86/roundtrip.mlir
+++ b/mlir/test/Dialect/X86/roundtrip.mlir
@@ -41,7 +41,7 @@ func.func @avx512_mask_compress(%k1: vector<16xi1>, %a1: vector<16xf32>,
// CHECK: x86.avx512.mask.compress {{.*}} : vector<16xf32>
%0 = x86.avx512.mask.compress %k1, %a1 : vector<16xf32>
// CHECK: x86.avx512.mask.compress {{.*}} : vector<16xf32>
- %1 = x86.avx512.mask.compress %k1, %a1 {constant_src = dense<5.0> : vector<16xf32>} : vector<16xf32>
+ %1 = x86.avx512.mask.compress %k1, %a1 constant_src = dense<5.0> : vector<16xf32>: vector<16xf32>
// CHECK: x86.avx512.mask.compress {{.*}} : vector<8xi64>
%2 = x86.avx512.mask.compress %k2, %a2, %a2 : vector<8xi64>, vector<8xi64>
return %0, %1, %2 : vector<16xf32>, vector<16xf32>, vector<8xi64>
More information about the Mlir-commits
mailing list