Repository navigation
Closed
Closed
Copy link
Description
Sample 1:
iree-compile --output-format=vm-bytecode \
--iree-hal-target-backends=llvm-cpu \
--iree-input-type=tosa \
--iree-llvm-target-triple=aarch64-none-linux-android29 \
--iree-flow-enable-data-tiling \
--iree-flow-enable-fuse-padding-into-linalg-consumer-ops \
--iree-llvmcpu-enable-pad-consumer-fusion \
--iree-flow-enable-aggressive-fusion \
iree_cc69d69f-6d1f-4a1a-a31e-e021888d0d28_MobileBertSquad_fp32.mlirError:
/usr/local/google/home/cheyuw/iree/iree-build/e2e_test_artifacts/model_cc69d69f-6d1f-4a1a-a31e-e021888d0d28_MobileBertSquad_fp32.tflite:0:0: error: 'memref.cast' op operand type
'memref<8x64xf32, strided<[512, 1], offset: ?>, #hal.descriptor_type<storage_buffer>>' and result type 'memref<64x64xf32, strided<[512, 1], offset: ?>, #hal.descriptor_type<sto
rage_buffer>>' are cast incompatible
/usr/local/google/home/cheyuw/iree/iree-build/e2e_test_artifacts/model_cc69d69f-6d1f-4a1a-a31e-e021888d0d28_MobileBertSquad_fp32.tflite:0:0: note: called from
/usr/local/google/home/cheyuw/iree/iree-build/e2e_test_artifacts/model_cc69d69f-6d1f-4a1a-a31e-e021888d0d28_MobileBertSquad_fp32.tflite:0:0: note: see current operation: %43 = "
memref.cast"(%42) : (memref<8x64xf32, strided<[512, 1], offset: ?>, #hal.descriptor_type<storage_buffer>>) -> memref<64x64xf32, strided<[512, 1], offset: ?>, #hal.descriptor_typ
e<storage_buffer>>
/usr/local/google/home/cheyuw/iree/iree-build/e2e_test_artifacts/model_cc69d69f-6d1f-4a1a-a31e-e021888d0d28_MobileBertSquad_fp32.tflite:0:0: error: failed to run translation of
source executable to target executable for backend #hal.executable.target<"llvm-cpu", "embedded-elf-arm_64", {cpu = "generic", cpu_features = "", data_layout = "e-m:e-i8:8:32-i1
6:16:32-i64:64-i128:128-n32:64-S128", native_vector_size = 16 : index, target_triple = "aarch64-unknown-unknown-eabi-elf"}>
/usr/local/google/home/cheyuw/iree/iree-build/e2e_test_artifacts/model_cc69d69f-6d1f-4a1a-a31e-e021888d0d28_MobileBertSquad_fp32.tflite:0:0: note: called from
/usr/local/google/home/cheyuw/iree/iree-build/e2e_test_artifacts/model_cc69d69f-6d1f-4a1a-a31e-e021888d0d28_MobileBertSquad_fp32.tflite:0:0: note: see current operation:
...
Sample 2:
iree-compile --output-format=vm-bytecode \
--iree-hal-target-backends=llvm-cpu \
--iree-input-type=tosa \
--iree-llvm-target-triple=aarch64-none-linux-android29 \
--iree-flow-enable-data-tiling \
--iree-llvm-target-cpu-features=+dotprod \
--iree-flow-enable-fuse-padding-into-linalg-consumer-ops \
--iree-llvmcpu-enable-pad-consumer-fusion \
--iree-flow-enable-aggressive-fusion \
iree_e3997104-a3d2-46b4-9fbf-39069906d123_MobileBertSquad_int8.mlirError:
/usr/local/google/home/cheyuw/iree/iree-build/e2e_test_artifacts/model_e3997104-a3d2-46b4-9fbf-39069906d123_MobileBertSquad_int8.tflite:0:0: error: 'memref.cast' op operand type
'memref<8x16xi8, strided<[512, 1], offset: ?>, #hal.descriptor_type<storage_buffer>>' and result type 'memref<64x64xi8, strided<[512, 1], offset: ?>, #hal.descriptor_type<stora
ge_buffer>>' are cast incompatible
/usr/local/google/home/cheyuw/iree/iree-build/e2e_test_artifacts/model_e3997104-a3d2-46b4-9fbf-39069906d123_MobileBertSquad_int8.tflite:0:0: note: called from
/usr/local/google/home/cheyuw/iree/iree-build/e2e_test_artifacts/model_e3997104-a3d2-46b4-9fbf-39069906d123_MobileBertSquad_int8.tflite:0:0: note: see current operation: %76 = "
memref.cast"(%75) : (memref<8x16xi8, strided<[512, 1], offset: ?>, #hal.descriptor_type<storage_buffer>>) -> memref<64x64xi8, strided<[512, 1], offset: ?>, #hal.descriptor_type<
storage_buffer>>
/usr/local/google/home/cheyuw/iree/iree-build/e2e_test_artifacts/model_e3997104-a3d2-46b4-9fbf-39069906d123_MobileBertSquad_int8.tflite:0:0: error: failed to run translation of
source executable to target executable for backend #hal.executable.target<"llvm-cpu", "embedded-elf-arm_64", {cpu = "generic", cpu_features = "+dotprod", data_layout = "e-m:e-i8
:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", native_vector_size = 16 : index, target_triple = "aarch64-unknown-unknown-eabi-elf"}>
/usr/local/google/home/cheyuw/iree/iree-build/e2e_test_artifacts/model_e3997104-a3d2-46b4-9fbf-39069906d123_MobileBertSquad_int8.tflite:0:0: note: called from
/usr/local/google/home/cheyuw/iree/iree-build/e2e_test_artifacts/model_e3997104-a3d2-46b4-9fbf-39069906d123_MobileBertSquad_int8.tflite:0:0: note: see current operation:
"hal.executable.variant"() ({
"hal.executable.export"() ({
}) {layout = #hal.pipeline.layout<push_constants = 0, sets = [<0, bindings = [<0, storage_buffer, ReadOnly>, <1, storage_buffer, ReadOnly>, <2, storage_buffer, ReadOnly>, <3,
storage_buffer>, <4, storage_buffer>, <5, storage_buffer>]>]>, ordinal = 0 : index, sym_name = "main_dispatch_9_generic_384x512", translation_info = #iree_codegen.translation_in
fo<CPUDataTiling>} : () -> ()
...
Metadata
Metadata
Assignees
Labels
No labels
Activity
pzread commentedon Feb 21, 2023
It seems like the problem happens when tiling the dispatch with multi results + pack op
Here is my guess (see the dump of
TileAndDistributeToWorkgroupsbelow):The dispatch contains 1 generic op + 1 pack op and returns 3 results:
%16#0to<48x512x8x1xf32>)%16#0:<384x512xf32>%16#1:<384x512xf32>After
TileAndDistributeToWorkgroupson the pack op, the generic op is tiled to output<64x64xf32>because of its consumer, the pack op (from<64x64x32>to<8x64x8x1xf32>). But the store ops for the other 2 results are incorrectly written with the source tensor size<8x64xf32>:This results in the invalid casts later. For example:
Dump before/after
TileAndDistributeToWorkgroups:pzread commentedon Feb 21, 2023
@hanhanW can you take a look and see if we can support multi result + pack op?
hanhanW commentedon Feb 21, 2023
Sure, I'll take a look at this, thanks!
Fixes tiling sizes for pulled producers in TileAndDistribute (#12399)
Fixes tiling sizes for pulled producers in TileAndDistribute (iree-or…
Fixes tiling sizes for pulled producers in TileAndDistribute (#12399)
Fixes tiling sizes for pulled producers in TileAndDistribute (iree-or…
Fixes tiling sizes for pulled producers in TileAndDistribute (iree-or…