Repository navigation
Description
What happened?
#17330 updates our LLVM and torch-mlir commits, pulling in llvm/torch-mlir#3013. Some tests are newly passing, many tests are still failing somewhere (compiler, runtime numerics), and a few tests are hanging on certain platforms.
At least CUDA is hanging on test_resize_downsample_scales_linear:
https://github.com/iree-org/iree/actions/runs/9034897378/job/24828864270?pr=17330#step:9:1813
I can't reproduce that on Windows though.
Steps to reproduce your issue
Generally follow the instructions at https://github.com/nod-ai/SHARK-TestSuite/tree/main/iree_tests and pull the config files from this repo.
For example, to run on CUDA:
pytest onnx/ -k test_resize -rA \
--config-files=D:\dev\projects\iree\build_tools\pkgci\external_test_suite\onnx_gpu_cuda.json \
--ignore-xfails
or Vulkan:
pytest onnx/ -k test_resize -rA \
--config-files=D:\dev\projects\iree\build_tools\pkgci\external_test_suite\onnx_gpu_vulkan.json \
--ignore-xfails
Note that Vulkan has model.mlir:4:10: error: failed to legalize operation 'arith.fptosi' that was explicitly marked illegal
What component(s) does this issue relate to?
Frontends, Compiler, Runtime
Version information
No response
Additional context
No response
Activity
bjacob commentedon May 10, 2024
FYI @AmosLewis this is the reason why llvm/torch-mlir#3013 was ultimately dropped from the integrate #17330.
AmosLewis commentedon May 10, 2024
Will you start a new PR to bump it next? Do you have any idea is it a torch-mlir bug or is it an iree bug?
ScottTodd commentedon May 10, 2024
failed to legalize operation 'arith.fptosi'error is in upstream MLIR SPIRV (missing lowering)AmosLewis commentedon May 10, 2024
nod-ai/AMD-SHARK-ModelDev#616 the model and failure resize mlir are listed in the description
bjacob commentedon May 10, 2024
I don't plan to do it myself. We have an integration rotation schedule and the integrates of this week were already done out-of-schedule :-)
ScottTodd commentedon May 10, 2024
We have a separate rotation for updating torch-mlir (in fact, @AmosLewis is up for next week 🤔). They are usually updated separately but needed to be updated together in this case.
AmosLewis commentedon May 12, 2024
#17358
Integrate torch-mlir@ec6d7aa onnx.resize op (#17358)
Integrate torch-mlir@ec6d7aa onnx.resize op (iree-org#17358)
Integrate torch-mlir@ec6d7aa onnx.resize op (iree-org#17358)
zjgarvey commentedon Feb 18, 2025
@ScottTodd , if it is okay with you, I'd like to re-use this thread to discuss the regressions: https://github.com/iree-org/iree/pull/19976/files#diff-bee4a6131cfebf0dfde5714b80c726dc145acc43b1c76e35e6447634f96071d1R238-R246
Running these locally, I notice that the compilation fails on cpu due to
This is introduced because of an assert added in llvm/torch-mlir#3945. This assert checks that scale values are exactly
1.0for dimensions we expect to be non-spatial. Adding the assert is valuable to guard against unsupported configurations in the ONNX op; however, it seems to be causing some issues. Note: this regression doesn't affect models, since models will typically not have thescaleinput as a graph input (but rather an IR constant), and it will properly fold-out the asserts.Running this test without the flag
--iree-input-demote-f64-to-f32=falsein https://github.com/iree-org/iree-test-suites/blob/f8f2771c932322a2a813a51a9e6ef71ca7eb1f80/onnx_ops/configs/onnx_ops_cpu_llvm_sync.json#L5 will result in the tests passing, but I think we needed this flag for numeric issues in other tests.ScottTodd commentedon Feb 18, 2025
I can respond with some ideas briefly, without taking too big a context switch:
--iree-input-demote-f64-to-f32=falsefor only tests that actually need f64 then let all other tests use the default of=true-O1vs-O2)zjgarvey commentedon Feb 19, 2025
I think I'm going to try and fix the issue with f64 in the VM conversion if possible. That way we can just do f64 and call it a day.
How do you suggest properly guarding against unsupported op configurations which can only be known at runtime? From my perspective, if an op is silently miscompiling (e.g. bad numerics), I'd much rather have an assert that I can grep for in the codebase.
ScottTodd commentedon Feb 19, 2025
I'd prefer to handle such cases in application code, outside of the compiler and runtime. Ideally the entire "model" that the compiler is given will run on an accelerator, and error checking, handling, and propagation on accelerators is complicated and slow.
Short of that, hoist the error checks up to the entry point of the model, rather than have individual operations deep down do their own checking. If a valid input to the program (as defined by what the entry point function accepts and allows to get passed further down) triggers an assert later, that's a bug in the program/compiler/runtime.
benvanik commentedon Feb 19, 2025
We still need a new assert op -
cf.assertis the worst possible op to be emitting in torch. The problem is not runtime checks but that torch is usingcf.assert.benvanik commentedon Feb 19, 2025
oh, I didn't check what kind of asserts these are - a new op would help us with non-device-data-dependent ones - device-data-dependent asserts are always bad and should only be emitted if the user at the torch level explicitly asks for them. If you see any
flow.tensor.load->cf.assertdependency chains that's a massive red flag.[VM] Add some missing `arith-to-vm` patterns (#20079)
[VM] Add some missing `arith-to-vm` patterns (#20079)