Skip to content

Adding iree-hal-drivers-amdgpu-tests target. - #21389

Merged
benvanik merged 1 commit into
mainfrom
users/benvanik/amdgpu-test
Jul 16, 2025
Merged

benvanik merged 1 commit into
mainfrom
users/benvanik/amdgpu-test

Conversation

@benvanik

Copy link
Copy Markdown
Collaborator

This makes it easy to build all of the AMDGPU HAL tests at once as part of an IDE action. This is accomplished by adding an optional group to cc_test rules that appends each test to a custom target.

@benvanik
benvanik requested a review from ScottTodd July 16, 2025 17:16
@benvanik benvanik added infrastructure Relating to build systems, CI, or testing hal/amdgpu Runtime AMDGPU HAL backend labels Jul 16, 2025
@benvanik
benvanik force-pushed the users/benvanik/amdgpu-test branch from b7df52c to 56ab9e4 Compare July 16, 2025 17:52
Comment on lines 119 to +124
iree_runtime_cc_test(
name = "buffer_pool_test",
srcs = ["buffer_pool_test.cc"],
group = "iree-hal-drivers-amdgpu-tests",

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.

In VSCode, you can also run all tests under a given subdirectory using this setting in https://marketplace.visualstudio.com/items?itemName=fredericbonnet.cmake-test-adapter

"cmakeExplorer.suiteDelimiter": "/",

Just click one of the run buttons:

Image

That won't work across directories but what you are adding here is only under runtime/src/iree/hal/drivers/amdgpu anyways. I'd prefer that style of general solution that requires no new code over the +50 LOC this adds for a single group. If we wanted to add more groups and utility targets that would add lots of extra boilerplate.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

that's what this is for :) unfortunately, that run command only builds whatever the active cmake build target is (so if your build target is iree-compile and you click run on those tests it'll invoke cmake to build iree-compile then run the tests with out of date binaries!). absolutely bonkers. so you have to build each target independently in order to run the directory - this PR is intended as a way to do that (set this build target and then you can run the tests there with up-to-date binaries).

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.

Would fixing #11331 help with the out of date binaries?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

also, cmake tools added native test suite support - now you do "cmake.ctest.testSuiteDelimiter": "/", and no longer need that extension! it's got just as many bugs as the extension just in different ways, but such is cmake :P

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

RE #11331: don't think so; the goal here is to not do a full rebuild of the project to run a few unit tests (building iree-test-deps with a runtime change would trigger a compiler rebuild because of consteval, and then all vmfbs would be regenerated - and not the actual unit tests)

AFAICT the cmake extension just doesn't support building what you request to run via the test explorer

This makes it easy to build all of the AMDGPU HAL tests at once as part
of an IDE action. This is accomplished by adding an optional `group`
to cc_test rules that appends each test to a custom target.
@benvanik
benvanik force-pushed the users/benvanik/amdgpu-test branch from 56ab9e4 to 3976ab7 Compare July 16, 2025 19:00
@benvanik

Copy link
Copy Markdown
Collaborator Author

Updated to not require the global CMakeLists.txt target - now tests can declare themselves part of a group from anywhere and properly be disabled when a subdir is not included (disabled options/etc).

@benvanik
benvanik marked this pull request as ready for review July 16, 2025 19:39
@benvanik
benvanik requested a review from AWoloszyn as a code owner July 16, 2025 19:39
@benvanik
benvanik merged commit 97de04c into main Jul 16, 2025
@benvanik
benvanik deleted the users/benvanik/amdgpu-test branch July 16, 2025 19:39
@AWoloszyn

Copy link
Copy Markdown
Contributor

Awesome!

IanWood1 pushed a commit to IanWood1/iree that referenced this pull request Jul 18, 2025
This makes it easy to build all of the AMDGPU HAL tests at once as part
of an IDE action. This is accomplished by adding an optional `group` to
cc_test rules that appends each test to a custom target.
AWoloszyn pushed a commit that referenced this pull request Dec 1, 2025
This makes it easy to build all of the AMDGPU HAL tests at once as part
of an IDE action. This is accomplished by adding an optional `group` to
cc_test rules that appends each test to a custom target.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hal/amdgpu Runtime AMDGPU HAL backend infrastructure Relating to build systems, CI, or testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants