Skip to content

[miopen] Users/randyspauldingamd/gtest fixturemap - #4258

Closed
assistant-librarian[bot] wants to merge 5 commits into
developfrom
import/develop/ROCm_composable_kernel/pr-3706
Closed

[miopen] Users/randyspauldingamd/gtest fixturemap#4258
assistant-librarian[bot] wants to merge 5 commits into
developfrom
import/develop/ROCm_composable_kernel/pr-3706

Conversation

@assistant-librarian

Copy link
Copy Markdown
Contributor

Proposed changes

This is the 2nd step in applying the dependency parser to MIOpen (and by extension, all mathlibs in TheRock). It started from ROCm/composable_kernel#3686. I wasn't able to get a clean diff, so this includes those changes as well.

The scenario is a repo that combines many (hundreds of) individual gtest files into a single test binary. The existing change detection can be adapted by using --gtest_filter and re-mapping from "a list of test files that need to be ran" to "a list of gtest fixtures that need to be ran." In theory, this can be done statically by parsing all of the test files and extracting the fixture names directly from the TEST, TEST_F, and INSTANTIATE_TEST_SUITE_P macros. However, this isn’t straightforward in MIOpen, because many of the test names are built up with helper macros.

Another option would be to use gtest internals to extract them at runtime. This is not ideal because these can change without warning.

Setting those solutions aside for now, another alternative is to build the discrete tests and run them all with --gtest_list_tests. This requires much less lead effort since MIOpen does have this capability. This PR enables collection of the data, definition of the mapping file, and construction of the gtest_filter.

  • Added all_gtest_fixtures.py which extracts all gtest fixtures from all executables in a single folder and constructs a flat map of executable name to the list of gtest fixtures it contains.
  • Added an optional argument to selective_test_filter.py, --fixturemap which provides the filename and enables the filter construction.
  • Assembles the gtest_filter and adds it to the output json.

Checklist

Please put an x into the boxes that apply. You can also fill these out after creating the PR. If you're not sure, please don't hesitate to ask.

  • I have added tests relevant to the introduced functionality, and the unit tests are passing locally
  • I have added the test to REGRESSION_TESTS list defined at the top of CMakeLists.txt in tests/CMakeLists.txt, IF the test takes more than 30 seconds to run.
  • I have added inline documentation which enables the maintainers with understanding the motivation
  • I have removed the stale documentation which is no longer relevant after this pull request
  • (If this change is user-facing) I have added release notes which provide the end users with a brief summary of the improvement from this pull request
  • I have run clang-format on all changed files
  • Any dependent changes have been merged

Discussion

Workflow:
0. Create a symlink to dependency parser, ala: sudo ln -s /home/<user>/repos/composable_kernel/script/dependency-parser /dep

  1. Run MIOpen CMake with MIOPEN_TEST_DISCRETE=ON (I run this in miopen/build_all)
  2. Build: <miopen/build_all># ninja tests (this produces a few hundred gtest binaries)
  3. Run: <miopen/build_all># python3 /dep/src/all_gtest_fixtures.py bin gtests.txt
  4. Create a different build folder (I use miopen/build_one), run MIOpen CMake with MIOPEN_TEST_DISCRETE=OFF, and start building the single gtest binary miopen_gtest
  5. Run the parser: <miopen/build_all># python3 /dep/main.py parse build/build.ninja
  6. Run the selector: <miopen/build_all># python3 /dep/main.py select enhanced_dependency_mapping.json <base_sha> <change_sha> --fixturemap gtests.txt
  7. I use an alias to extract the filter: alias gtf="python3 -c \"import json; print(json.load(open('tests_to_run.json'))['gtest_filter'])\""
  8. Run the tests: ../build_one/bin/miopen_gtest --gtest_filter=$(gtf)

🔁 Imported from ROCm/composable_kernel#3706
🧑‍💻 Originally authored by @randyspauldingamd

@assistant-librarian assistant-librarian Bot added the external contribution Code contribution from users community.. label Feb 3, 2026
@illsilin

Copy link
Copy Markdown
Contributor

Hi @randyspauldingamd, is this still needed or can we close it?

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been inactive for 25 days and will be marked as stale.

If you would like to keep this PR open, please:

  • Add new commits
  • Add a comment explaining why it should remain open

This PR will be automatically closed in 5 days if no further activity occurs.

@github-actions github-actions Bot added the Stale PR has no activity for 25+ days label May 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed due to inactivity (30 days with no updates).

If you'd like to continue working on this, feel free to reopen the PR or create a new one.

@github-actions github-actions Bot closed this May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external contribution Code contribution from users community.. imported pr project: composablekernel Stale PR has no activity for 25+ days

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants