Changeset View
Changeset View
Standalone View
Standalone View
mlir/test/IR/invalid-ops.mlir
Show First 20 Lines • Show All 1,137 Lines • ▼ Show 20 Lines | |||||
func @atomic_rmw_expects_int(%I: memref<16x10xf32>, %i : index, %val : f32) { | func @atomic_rmw_expects_int(%I: memref<16x10xf32>, %i : index, %val : f32) { | ||||
// expected-error@+1 {{expects an integer type}} | // expected-error@+1 {{expects an integer type}} | ||||
%x = atomic_rmw "addi" %val, %I[%i, %i] : (f32, memref<16x10xf32>) -> f32 | %x = atomic_rmw "addi" %val, %I[%i, %i] : (f32, memref<16x10xf32>) -> f32 | ||||
return | return | ||||
} | } | ||||
// ----- | // ----- | ||||
func @generic_atomic_rmw_wrong_arg_num(%I: memref<10xf32>, %i : index) { | |||||
// expected-error@+1 {{expected single number of entry block arguments}} | |||||
%x = generic_atomic_rmw %I[%i] : memref<10xf32> { | |||||
^bb0(%arg0 : f32, %arg1 : f32): | |||||
%c1 = constant 1.0 : f32 | |||||
atomic_yield %c1 : f32 | |||||
} | |||||
return | |||||
} | |||||
// ----- | |||||
func @generic_atomic_rmw_wrong_arg_type(%I: memref<10xf32>, %i : index) { | |||||
// expected-error@+1 {{expected block argument of the same type result type}} | |||||
%x = generic_atomic_rmw %I[%i] : memref<10xf32> { | |||||
^bb0(%old_value : i32): | |||||
%c1 = constant 1.0 : f32 | |||||
atomic_yield %c1 : f32 | |||||
} | |||||
return | |||||
} | |||||
// ----- | |||||
func @atomic_yield_type_mismatch(%I: memref<10xf32>, %i : index) { | |||||
// expected-error@+4 {{op types mismatch between yield op: 'i32' and its parent: 'f32'}} | |||||
herhut: Could you add a test for the case where the memref and result types disagree? | |||||
%x = generic_atomic_rmw %I[%i] : memref<10xf32> { | |||||
^bb0(%old_value : f32): | |||||
%c1 = constant 1 : i32 | |||||
atomic_yield %c1 : i32 | |||||
} | |||||
return | |||||
} | |||||
// ----- | |||||
// alignment is not power of 2. | // alignment is not power of 2. | ||||
func @assume_alignment(%0: memref<4x4xf16>) { | func @assume_alignment(%0: memref<4x4xf16>) { | ||||
// expected-error@+1 {{alignment must be power of 2}} | // expected-error@+1 {{alignment must be power of 2}} | ||||
std.assume_alignment %0, 12 : memref<4x4xf16> | std.assume_alignment %0, 12 : memref<4x4xf16> | ||||
return | return | ||||
} | } | ||||
// ----- | // ----- | ||||
Show All 15 Lines |
Could you add a test for the case where the memref and result types disagree?