llvm-project
38 строк · 1.9 Кб
1// RUN: mlir-opt -allow-unregistered-dialect %s -verify-diagnostics -split-input-file -mlir-print-elementsattrs-with-hex-if-larger=1 | FileCheck %s --check-prefix=HEX
2// RUN: mlir-opt -allow-unregistered-dialect %s -verify-diagnostics -split-input-file | FileCheck %s
3
4// HEX: dense<"0x000020410000A040"> : tensor<2xf32>
5"foo.op"() {dense.attr = dense<[10.0, 5.0]> : tensor<2xf32>} : () -> ()
6
7// HEX: dense<"0x00000000000024400000000000001440"> : tensor<2xf64>
8"foo.op"() {dense.attr = dense<[10.0, 5.0]> : tensor<2xf64>} : () -> ()
9
10// CHECK: dense<[1.000000e+01, 5.000000e+00]> : tensor<2xf32>
11"foo.op"() {dense.attr = dense<"0x000020410000A040"> : tensor<2xf32>} : () -> ()
12
13// CHECK: dense<[1.000000e+01, 5.000000e+00]> : tensor<2xf64>
14"foo.op"() {dense.attr = dense<"0x00000000000024400000000000001440"> : tensor<2xf64>} : () -> ()
15
16// CHECK: dense<(1.000000e+01,5.000000e+00)> : tensor<2xcomplex<f32>>
17"foo.op"() {dense.attr = dense<"0x000020410000A040000020410000A040"> : tensor<2xcomplex<f32>>} : () -> ()
18
19// CHECK: dense<(1.000000e+01,5.000000e+00)> : tensor<2xcomplex<f64>>
20"foo.op"() {dense.attr = dense<"0x0000000000002440000000000000144000000000000024400000000000001440"> : tensor<2xcomplex<f64>>} : () -> ()
21
22// CHECK: dense<[1.000000e+01, 5.000000e+00]> : tensor<2xbf16>
23"foo.op"() {dense.attr = dense<"0x2041A040"> : tensor<2xbf16>} : () -> ()
24
25// -----
26
27// expected-error@+1 {{expected string containing hex digits starting with `0x`}}
28"foo.op"() {dense.attr = dense<"00000000000024400000000000001440"> : tensor<2xf64>} : () -> ()
29
30// -----
31
32// expected-error@+1 {{expected string containing hex digits starting with `0x`}}
33"foo.op"() {dense.attr = dense<"0x0000000000002440000000000000144X"> : tensor<2xf64>} : () -> ()
34
35// -----
36
37// expected-error@+1 {{elements hex data size is invalid for provided type}}
38"foo.op"() {dense.attr = dense<"0x00000000000024400000000000001440"> : tensor<4xf64>} : () -> ()
39