<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=http://email.email.llvm.org/c/eJy9WN1yqyoUfprkhjGjqElzkYu2OfvivIRjBBP2EMgApu1--rMAjcafmp52thMjwvr91oIFHiT52BVnohfhfhE-L9Zh_XOvZ85UIC8GFVJcM0yyle1Bi_QVeQIEV1DkQgpW5Jz9oXasO6T7PZyJnB-DQ1WWVA0ZtCGTY4YKLVUAtmiTCzNHNzVcVqKYHrTmsT9MTJvo-wNCc85lkRsmRd9H-QYEeQnCBoAAkFSZBgYjgVhedJ_qE0RrAbooLTfgNa-BX88TRFdaGIBqnOhGdaZnRcsZUTZy4xSKAk3BOA0qoahzioCL2vTdBjms_AgIy49CasMKINhAquFfVio8DhXjxD6ZgH-XncWlClQlBFU9YRSdc9aPDBVGfQQXySB9FNUVN4t4f5WsD6I-5QqM5OyggWBoAAz4f2tD5vVnlWFcr7QcnUrjnTg-55cQgQ7k0yWD90X8usBPJFzgLQoW8T-oeYN2ly96iA8VFGxmV4TTdVfGWZKKUwQIv3QtRBZu-CE7TdBFsWtuIAeTEJrCZD4VsjLGINy_OLXP77YLZIOGWs4DAvxM7Qu4GX8T1jPtFbLIUI1yQZCiplJCoyTYIz8zkSyRdhPHSkh1tMA2h1KNm0bcNBKrrWScU4LemDkhc6LomvPKMqflnSfgARPMZAnJPIf1Ias9qDVBQJ4RE4S-33QOu-JhVzLoKl2PQ6nGo8Uq_vXevT1ubRxtAoMEAMPlh18HVs52LwNy_WUWmHTvLJjV2lUJM6qr0sLkkSlruWCT9efm2uus_Edcb23wydCaMmv_LbE2-_tMa0LeFD5xeisyuEvrUNdnJi6VsZpmVeHXO0ZAx1D1iI09RlmZWuUs4_9MnV4cBxhYBsK4K32ekoAGCgoiJ65rGn5n66TvxdSljWKEPiyyCZpnZtYWl24-JvVE-gLMDwDaVQiBaDT-eEw-yenvprQti35xHQS-qEuRgrVw1eyzUNhZne6oozHqaIoaj1HjKep4jDqeol6PUa-nqJ_GqJ8mqMtoFJQoXIX2ogv8Eoa3Ja3LCYVk1OVZxj9UydFATHN2-DuSXLUUUp1zntlZDJMY6qYZkLSTxNaE5o6HsmBDZV9qQlzf0YAO5sMIXTyyAOK9W1ecu7Dh5Q_U2aIpXCONpoIB9nWlAZ5bYf2k0S21dzuT-ZXArTjf8gMPGtHAD_RXHIHA_bAnTURsUv9FV_oZ6fedKw3HHVpP69qwW-z8tqho-ttG1PbU26J25zuzevtlO5uAdXR30bWoW8Pu-1qJHVC_spPw148UxS9WtDvrMweI513ZQ-EoZPMbUSPR2GniprSBfOQUcm-POyP10Pz8dNJW6WHtvTWag9-S7GKyjbf5Mq_MSardv5L-hn3UcVkpvjsZc9Fu0bJJe4TVvzrA-n9uT6D2EVyU_A0nd3hlWldUQyPF2yRdnnZ5eii3mwPGh3VRlHlEosMWJ8lTsg23eE3okucHyvXOJnu6X35fJdvhEOMwCqMoSqMkXW3WlEQxfkoSskmTbQygU9hz8JWVs5LquFQ7J_JQHTUMcqaNbgdzrdlRUNpYaJjhdFeCADikQZQ5PfrvIvJCVf31BW_swdwwsWq_MGT-w4QGgszmFRAtnek7Z_d_pG9QFA>52945</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
failed to legalize operation 'builtin.unrealized_conversion_cast'
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Joejiong
</td>
</tr>
</table>
<pre>
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
}
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy9WNuSoyoU_ZrkhdJS1Fwe8tCdnHk4P2EZxYQpAinA9OXrzwY0Gi9t-kzXpNoEYe3bYsOGPoriY5dfCrUIDovgZbEK6j_7emFUeuKqUS74LcVF6psetEj2yAEQfLw844LTPGP0k5ix7pDq9zDKM3byjlVZEjkUULqYHNOEKyE98EXpjOs53NRwWfF8etC4Rz8pn3bR9XsFyRgTeaap4P0YxRsAshKUDQgBIonUDQ1aAFhcVR_1BaO1ApWXRhr4mrfAbpcJ0I3kGqgaB91RF3KRpJxRZWZuHCEJYHLKiFdxSWxQBYSodD9s0EPLD6-g2YkLpWkOgDWkGv5ltMLPsaKsML-Uw7fNzvxaebLinMieMoIuGe3PDOFafnhXQSF9JFEV04vocBO0T6I6ZxKcZPSoADB0AAbct_EhdfbTSlOmfCVGl9J4J44u2TVAYAO5dEnhfRHtF3hTBAu8Rd4i-gc1b9DuyoVPyaGcgM_0hnCy6uq4iKJiBAHDr10PkaEb_pBZJugq6S3TkINxAE2uU5cKaRlhUO5erNmXd9MFusFCrecJBW6l9hXcnb8r67m2hyzSRKGMF0gSXUmuUOwdkFuZSJRI2YVjNCQqXGCTQ4nCTSNqGrGxVlLGSIHeqD4jfSbolrHK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