Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Differential D146381 Diff 506596 mlir/test/Dialect/Arith/one-shot-bufferize-memory-space-invalid.mlir
Changeset View
Changeset View
Standalone View
Standalone View
mlir/test/Dialect/Arith/one-shot-bufferize-memory-space-invalid.mlir
// RUN: mlir-opt %s -one-shot-bufferize="must-infer-memory-space" -split-input-file -verify-diagnostics | // RUN: mlir-opt %s -one-shot-bufferize="must-infer-memory-space" -split-input-file -verify-diagnostics | ||||
func.func @inconsistent_memory_space_arith_select(%c: i1) -> tensor<10xf32> { | func.func @inconsistent_memory_space_arith_select(%c: i1) -> tensor<10xf32> { | ||||
// Selecting tensors with different memory spaces. Such IR cannot be | // Selecting tensors with different memory spaces. Such IR cannot be | ||||
// bufferized. | // bufferized. | ||||
%0 = bufferization.alloc_tensor() {memory_space = 0 : ui64} : tensor<10xf32> | %0 = bufferization.alloc_tensor() {memory_space = 0 : ui64} : tensor<10xf32> | ||||
%1 = bufferization.alloc_tensor() {memory_space = 1 : ui64} : tensor<10xf32> | %1 = bufferization.alloc_tensor() {memory_space = 1 : ui64} : tensor<10xf32> | ||||
// expected-error @+2 {{inconsistent memory space on true/false operands}} | // expected-error @+2 {{inconsistent memory space on true/false operands}} | ||||
// expected-error @+1 {{failed to bufferize op}} | // expected-error @+1 {{failed to bufferize op}} | ||||
%r = arith.select %c, %0, %1 : tensor<10xf32> | %r = arith.select %c, %0, %1 : tensor<10xf32> | ||||
func.return %r : tensor<10xf32> | func.return %r : tensor<10xf32> | ||||
} | } | ||||
// ----- | // ----- | ||||
func.func @constant_memory_space(%idx: index, %v: i32) -> tensor<3xi32> { | func.func @unknown_memory_space(%idx: index, %v: i32) -> tensor<3xi32> { | ||||
// expected-error @+2 {{memory space not implemented yet}} | // expected-error @+2 {{could not infer memory space}} | ||||
// expected-error @+1 {{failed to bufferize op}} | // expected-error @+1 {{failed to bufferize op}} | ||||
%cst = arith.constant dense<[5, 1000, 20]> : tensor<3xi32> | %cst = arith.constant dense<[5, 1000, 20]> : tensor<3xi32> | ||||
%0 = tensor.insert %v into %cst[%idx] : tensor<3xi32> | %0 = tensor.insert %v into %cst[%idx] : tensor<3xi32> | ||||
return %0 : tensor<3xi32> | return %0 : tensor<3xi32> | ||||
} | } | ||||
No newline at end of file | No newline at end of file |