[Mlir-commits] [mlir] [mlir][memref]: Fix Bug in GlobalOp Verifier (PR #144900)
Jack Frankland
llvmlistbot at llvm.org
Wed Jun 25 08:25:05 PDT 2025
================
@@ -342,6 +342,16 @@ memref.global "priate" constant @memref5 : memref<2xf32> = uninitialized
// -----
+// expected-error @+1 {{op initial value element expected to be of type 'f16', but was of type 'f32'}}
+"memref.global"() <{constant, initial_value = dense<1.000000e+00> : tensor<1xf32>, sym_name = "memref6", sym_visibility = "private", type = memref<1xf16>}> : () -> ()
+
+// -----
+
+// expected-error @+1 {{op initial value shape expected to be 1, 2 but was 2, 2}}
+"memref.global"() <{constant, initial_value = dense<1.000000e+00> : tensor<2x2xf16>, sym_name = "memref7", sym_visibility = "private", type = memref<1x2xf16>}> : () -> ()
----------------
FranklandJack wrote:
I think this might also be exercising a different verifier since the error message being produced is slightly different to the one I'm triggering in my test. Could it be that in the pretty version the type of the initializer is deduced from the return type of the operation vs the type of the dense element attribute?
https://github.com/llvm/llvm-project/pull/144900
More information about the Mlir-commits
mailing list