| Issue |
52945
|
| Summary |
failed to legalize operation 'builtin.unrealized_conversion_cast'
|
| Labels |
|
| Assignees |
|
| Reporter |
Joejiong
|
cmds
```
mlir-opt conv_2d_.mlir \
-canonicalize \
-cse \
-linalg-bufferize \
-std-bufferize \
-tensor-constant-bufferize \
-tensor-bufferize \
-func-bufferize \
-finalizing-bufferize \
-buffer-deallocation \
-lower-affine \
-convert-linalg-to-loops \
-canonicalize \
-convert-scf-to-std \
-convert-linalg-to-llvm \
-convert-vector-to-llvm \
--convert-memref-to-llvm \
-convert-std-to-llvm \
-reconcile-unrealized-casts \
-verify-diagnostics | /llvm/build/bin/mlir-cpu-runner \
-e main \
-entry-point-result=void \
-shared-libs=/llvm/build/lib/libmlir_runner_utils.so
```
```
#map0 = affine_map<(d0) -> (d0)>
#map1 = affine_map<(d0) -> (d0 ceildiv 256)>
module {
// func private @print_memref_f32(memref<*xf32>)
func private @print_memref_f32(tensor<*xf32>) -> ()
// Creates and returns 4-D buffer of size (%s1, %s2, %s3, %s4) filled with the value %f
func @init_4d_filled_f32_tensor(%s1 : index, %s2 : index, %s3 : index, %s4 : index, %f : f32) -> tensor<?x?x?x?xf32> {
%buf = linalg.init_tensor [%s1, %s2, %s3, %s4] : tensor<?x?x?x?xf32>
%res = linalg.fill(%f, %buf) : f32, tensor<?x?x?x?xf32> -> tensor<?x?x?x?xf32>
return %res : tensor<?x?x?x?xf32>
}
func @conv_2d_nhwc_hwcf(
%input: tensor<?x?x?x?xf32>,
%filter: tensor<?x?x?x?xf32>,
%output: tensor<?x?x?x?xf32>) -> tensor<?x?x?x?xf32> {
%res = linalg.conv_2d_nhwc_hwcf {dilations = dense<1> : tensor<2xi64>,
strides = dense<1> : tensor<2xi64>}
ins (%input, %filter: tensor<?x?x?x?xf32>, tensor<?x?x?x?xf32>)
outs (%output: tensor<?x?x?x?xf32>) -> tensor<?x?x?x?xf32>
return %res :tensor<?x?x?x?xf32>
}
func @main() {
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
%c2 = arith.constant 2 : index
%c3 = arith.constant 3 : index
%c6 = arith.constant 6 : index
%c8 = arith.constant 8 : index
%f10 = arith.constant 10.00000e+00 : f32
%val = arith.constant 2.00000e+00 : f32
%zero = arith.constant 0.00000e+00 : f32
// normal_conv2d_test
// filter: 1,1,1,3
// in : 1,2,2,1
// out : 1,2,2,3
%filter2D_nhwc = call @init_4d_filled_f32_tensor(%c1, %c1, %c1, %c3, %val) :(index, index, index, index, f32) -> (tensor<?x?x?x?xf32>)
%in2D_nhwc = call @init_4d_filled_f32_tensor(%c1, %c2, %c2, %c1, %val) : (index, index, index, index, f32) -> (tensor<?x?x?x?xf32>)
%out2D_nhwc = call @init_4d_filled_f32_tensor(%c1, %c2, %c2, %c3, %zero) : (index, index, index, index, f32) -> (tensor<?x?x?x?xf32>)
// memref.store %f10, %in2D_nhwc[%c0, %c0, %c1, %c0] : memref<?x?x?x?xf32>
%res_out2D_nhwc = call @conv_2d_nhwc_hwcf(%in2D_nhwc, %filter2D_nhwc, %out2D_nhwc) : (tensor<?x?x?x?xf32>,
tensor<?x?x?x?xf32>, tensor<?x?x?x?xf32>) -> tensor<?x?x?x?xf32>
%out2D_nhwc_ = tensor.cast %res_out2D_nhwc : tensor<?x?x?x?xf32> to tensor<*xf32>
call @print_memref_f32(%out2D_nhwc_): (tensor<*xf32>) -> ()
return
}
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs