llvm / torch-mlir

The Torch-MLIR project aims to provide first class support from the PyTorch ecosystem to the MLIR ecosystem.
Other
1.35k stars 507 forks source link

Need E2E ONNX op tests in CI #3520

Open renxida opened 4 months ago

renxida commented 4 months ago

Problem: We don't test onnx ops in our CI

For example, we have these Onnx Ops that have made their way into torch-mlir but ultimately don't run in IREE's test suites:

If we have some onnx node tests in torch-mlir CI:

Problems with existing solutions

our existing test-suite

We have an existing test-suite in projects/pt1 that imports a lot of pytorch ops, and performs numerical comparison with native pytorch via a variety of paths, including ONNX.

There are two main problems with these:

testing downstream in IREE

Our downstream project IREE does run good torch node tests, but reports many of the onnx ops that we've lowered as failing. I haven't found a way to view the error messages, and it's also hard to tell whether these failures are due to IREE or torch-mlir.

Proposed solution:

We should add a CI script and some testing scripts to torch-mlir that:

renxida commented 4 months ago

https://github.com/nod-ai/onnxruntime/tree/iree_ep/onnxruntime/core/providers/iree

Maybe we can use onnxruntime to directly plug into onnx's tests and not have to write additional data / model preprocessing scripts.

ScottTodd commented 4 months ago

Our downstream project IREE does run good torch node tests, but reports many of the onnx ops that we've lowered as failing. I haven't found a way to view the error messages, and it's also hard to tell whether these failures are due to IREE or torch-mlir.

I archived some historical logs here:

At the time I decided that the full output would be too noisy to include on all CI runs. The list of failures may be small enough now to revise that decision. Generally, you can run pytest with -rA (https://docs.pytest.org/en/stable/how-to/output.html) to see output from XFAIL'd tests, or run with --ignore-xfails (see other custom flags in the conftest.py file).

renxida commented 4 months ago

@rsuderman got some references I could see on how to run torch-mlir and get numerical results w/o using IREE?

mgehre-amd commented 4 months ago

We had some good experience with the onnx.reference evaluator where onnxruntime would lack support for some ops or dtypes (e.g. bfloat16).

vinayakdsci commented 3 months ago

@renxida Hi! When you say that these ops fail, do you expect them to have linalg lowerings?

renxida commented 3 months ago

@vinayakdsci yup! I'm expecting them to work e2e.

In an ideal world, instead of pushing many ops through layer by layer, then coming back to try to push them through the next layer while trying to remember how our old implementations work, I'd like us to push each op through the whole way before moving on to the next thing.

vinayakdsci commented 3 months ago

@renxida I agree :) But I just wanted to point this out that many ops could be failing because of missing torch to linalg lowerings. And don't worry, I am sure we will be able to push them through!