Skip to content

[WebGPU] Add compilation tests for xla_ops/ and tosa_ops/ (again). - #11327

Merged
ScottTodd merged 5 commits into
iree-org:mainfrom
ScottTodd:webgpu-compiler-tests-retry
Nov 29, 2022
Merged

ScottTodd merged 5 commits into
iree-org:mainfrom
ScottTodd:webgpu-compiler-tests-retry

Conversation

@ScottTodd

Copy link
Copy Markdown
Member

This reverts #10918 to roll forward #10909, adding a hack to skip WebGPU testdata compilation when cross compiling. The right way to add this test coverage is likely either

  • Adding a new test macro that just tests compilation without even considering runtime/execution
  • Adding the IREE_HAL_DRIVER_WEBGPU option and running tests with it (this won't really work until I have more tests working, and the tools are updated to somehow handle async readback... so I'm not hopeful about this approach for at least several months)

@ScottTodd ScottTodd added infrastructure Relating to build systems, CI, or testing platform/web 🌐 Web-specific build, execution, benchmarking, and deployment labels Nov 28, 2022
Comment thread build_tools/cmake/iree_check_test.cmake Outdated
# compiler target backends are enabled. Just assume all are enabled and only
# rely on the runtime HAL driver check above for filtering.

# HACK: Always skip WebGPU when cross compiling until it has a HAL driver.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we make this not run the tests if DRIVER is omitted? I see a note about it above but am unclear why we'd allow not passing DRIVER to still run.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soooo....

We already skip running tests if there is no DRIVER, and that's what WebAssembly is relying on today:

# Check WebAssembly compilation (LLVM backend with wasm target triple).
# Note:
# * no 'driver' arg is set, so this does not test execution
# * the test suite name is missing "_driver" from "check_target_driver"
# * this isn't an "end to end" test suite in the same sense as the other
# test suites in this file, but the test coverage is still useful
# Hopefully at some point we can build WebAssembly execution testing into our
# infrastructure and this will no longer bend our testing definitions as much.
iree_check_single_backend_test_suite(
name = "check_llvm-cpu-wasm",

This gets tricky with cross-compilation though. We don't currently have a way to know from the cross-compilation CMake environment which compiler targets were enabled in the host tools build. Since the WebGPU compiler target is not enabled by default, one of our Android builds was trying to build the WebGPU tests. Thinking about this a bit more, I can tweak this hack to skip all tests that omit DRIVER when cross compiling. The real fix is mentioned in the PR description though - stop trying to use iree_check_test for just testing compilation. It's much easier to edit iree_check_test than it is to add a new test type though :/

image

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GMNGeoffrey will you forgive me for the hack in iree_check_test? 😅
(I'll wait a bit before merging to give some time if you'd like to review that part)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eeeew. I'm pretty sure we're just not doing cross compiling correctly... We should be able to query the iree compiler tool to see what backends it supports, shouldn't we? I guess that opens us up to silent failures when the tool isn't compiled as expected though. In CMake you can actually have tests depend on other tests. I've been thinking for a while that that's actually how we should do the compilation tests rather than having them as part of the build system. That would resolve the weird iree-test-deps target too. But that is for another time. I guess this isn't the worst.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you at least add a TODO and file an issue (or attach it to an existing issue)? "Rewrite absolutely all of our tests". "good first issue"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In CMake you can actually have tests depend on other tests. I've been thinking for a while that that's actually how we should do the compilation tests rather than having them as part of the build system.

Yeah, that would be great. I can file an issue for that and add it to my backlog (or someone else can tackle it :D)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed #11354

@ScottTodd
ScottTodd marked this pull request as ready for review November 29, 2022 00:06

@GMNGeoffrey GMNGeoffrey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reluctant approval

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure Relating to build systems, CI, or testing platform/web 🌐 Web-specific build, execution, benchmarking, and deployment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants