iree-org / iree

A retargetable MLIR-based machine learning compiler and runtime toolkit.
http://iree.dev/
Apache License 2.0
2.58k stars 579 forks source link

Linalgext 'attention' test is failing to build on Emscripten #12129

Open ScottTodd opened 1 year ago

ScottTodd commented 1 year ago

https://github.com/iree-org/iree/actions/runs/4130706149/jobs/7137719751

[14/350] Generating check_llvm-cpu_local-task_attention.mlir_module.vmfb from attention.mlir
FAILED: tests/e2e/linalg_ext_ops/check_llvm-cpu_local-task_attention.mlir_module.vmfb /work/build-emscripten/tests/e2e/linalg_ext_ops/check_llvm-cpu_local-task_attention.mlir_module.vmfb 
cd /work/build-emscripten/tests/e2e/linalg_ext_ops && /work/full-build-dir/install/bin/iree-compile --output-format=vm-bytecode --mlir-print-op-on-diagnostic=false --iree-hal-target-backends=llvm-cpu /work/tests/e2e/linalg_ext_ops/attention.mlir -o check_llvm-cpu_local-task_attention.mlir_module.vmfb --iree-hal-executable-object-search-path=\"/work/build-emscripten\" --iree-llvm-target-triple=wasm32-unknown-emscripten
/work/tests/e2e/linalg_ext_ops/attention.mlir:6:8: error: 'linalg.generic' op inferred input/output operand #3 has shape's dimension #0 to be 2, but found 4
  %1 = iree_linalg_ext.attention ins(%query, %key, %value : tensor<1x4x4xf32>,
       ^

See https://github.com/iree-org/iree/pull/12041#discussion_r1101777536

nicolasvasilache commented 1 year ago

12129 will also need to be reactivated/reverted to fully close this.

allieculp commented 1 year ago

@ScottTodd @MaheshRavishankar Can we set a priority for this?

ScottTodd commented 1 year ago

P2/P3, emscripten isn't being actively worked on and there will be larger things to address before we'd want linalgext 'attention' there. TBD if the test failing on Emscripten is indicative of some other work we should do though.

ScottTodd commented 2 months ago

This is still an issue, FWIW.

Recent logs: https://github.com/iree-org/iree/actions/runs/9882106083/job/27294727339#step:7:876

FAILED: tests/e2e/linalg_ext_ops/check_llvm-cpu_local-task_attention.mlir_module.vmfb /work/build-emscripten/tests/e2e/linalg_ext_ops/check_llvm-cpu_local-task_attention.mlir_module.vmfb 
cd /work/build-emscripten/tests/e2e/linalg_ext_ops && /work/full-build-dir/install/bin/iree-compile --output-format=vm-bytecode --mlir-print-op-on-diagnostic=false --iree-hal-target-backends=llvm-cpu /work/tests/e2e/linalg_ext_ops/attention.mlir -o check_llvm-cpu_local-task_attention.mlir_module.vmfb --iree-hal-executable-object-search-path=\"/work/build-emscripten\" --iree-llvmcpu-target-triple=wasm32-unknown-emscripten
failed to translate executables
failed to translate executables
failed to translate executables
/work/tests/e2e/linalg_ext_ops/attention.mlir:14:8: error: Yield operand #2 is not equivalent to the corresponding iter bbArg
  %1 = iree_linalg_ext.attention ins(%query, %key, %value, %scale : tensor<1x3x4xf32>,
       ^
/work/tests/e2e/linalg_ext_ops/attention.mlir:14:8: error: failed to run translation of source executable to target executable for backend #hal.executable.target<"llvm-cpu", "system-wasm-wasm_32", {cpu = "generic", cpu_features = "", data_layout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20", link_embedded = false, native_vector_size = 8 : i64, target_triple = "wasm32-unknown-emscripten"}>
  %1 = iree_linalg_ext.attention ins(%query, %key, %value, %scale : tensor<1x3x4xf32>,
       ^
/work/tests/e2e/linalg_ext_ops/attention.mlir:40:8: error: Yield operand #2 is not equivalent to the corresponding iter bbArg
  %1 = iree_linalg_ext.attention ins(%query, %key, %value, %scale : tensor<1x4x4xf32>,
       ^
/work/tests/e2e/linalg_ext_ops/attention.mlir:40:8: error: failed to run translation of source executable to target executable for backend #hal.executable.target<"llvm-cpu", "system-wasm-wasm_32", {cpu = "generic", cpu_features = "", data_layout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20", link_embedded = false, native_vector_size = 8 : i64, target_triple = "wasm32-unknown-emscripten"}>
  %1 = iree_linalg_ext.attention ins(%query, %key, %value, %scale : tensor<1x4x4xf32>,
       ^
/work/tests/e2e/linalg_ext_ops/attention.mlir:82:8: error: Yield operand #2 is not equivalent to the corresponding iter bbArg
  %1 = iree_linalg_ext.attention ins(%query, %key, %value, %scale : tensor<3x3x4xf32>,
       ^
/work/tests/e2e/linalg_ext_ops/attention.mlir:82:8: error: failed to run translation of source executable to target executable for backend #hal.executable.target<"llvm-cpu", "system-wasm-wasm_32", {cpu = "generic", cpu_features = "", data_layout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20", link_embedded = false, native_vector_size = 8 : i64, target_triple = "wasm32-unknown-emscripten"}>
  %1 = iree_linalg_ext.attention ins(%query, %key, %value, %scale : tensor<3x3x4xf32>,
       ^