brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · e923ac1 Raw
47 lines · plain
1// RUN: mlir-opt -split-input-file %s -pass-pipeline='builtin.module(func.func(test-affine-reify-value-bounds))' -verify-diagnostics2 3func.func @test_invalid_reify_dim(%size: index) -> (index) {4    %zero = arith.constant 0 : index5    %tensor_val = tensor.empty(%size) : tensor<?xf32>6 7    // expected-error@+1 {{'test.reify_bound' op invalid dim for shaped type}}8    %dim = "test.reify_bound"(%tensor_val) {dim = 1 : i64} : (tensor<?xf32>) -> index9 10    return %dim: index11}12 13// -----14 15func.func @test_invalid_reify_negative_dim(%size: index) -> (index) {16    %zero = arith.constant 0 : index17    %tensor_val = tensor.empty(%size) : tensor<?xf32>18 19    // expected-error@+1 {{'test.reify_bound' op dim must be non-negative}}20    %dim = "test.reify_bound"(%tensor_val) {dim = -1 : i64} : (tensor<?xf32>) -> index21 22    return %dim: index23}24 25// -----26 27func.func @test_invalid_reify_int_value(%size: index) -> (index) {28    %zero = arith.constant 0 : index29    %int_val = arith.constant 1 : index30 31    // expected-error@+1 {{'test.reify_bound' op unexpected 'dim' attribute for index variable}}32    %dim = "test.reify_bound"(%int_val) {dim = 1 : i64} : (index) -> index33 34    return %dim: index35}36 37// -----38 39func.func @test_invalid_reify_without_dim(%size: index) -> (index) {40    %zero = arith.constant 0 : index41    %tensor_val = tensor.empty(%size) : tensor<?xf32>42 43    // expected-error@+1 {{'test.reify_bound' op expected 'dim' attribute for shaped type variable}}44    %dim = "test.reify_bound"(%tensor_val) : (tensor<?xf32>) -> index45 46    return %dim: index47}