AIRUNTIME-1933: (refactor) remove redundant hiptest macros - #10921
Open
JDas-AMD wants to merge 3 commits into
Open
AIRUNTIME-1933: (refactor) remove redundant hiptest macros#10921JDas-AMD wants to merge 3 commits into
JDas-AMD wants to merge 3 commits into
Conversation
…nfig.hh macros
The generated hip_tests_config.hh macros included a redundant title
string as the first element that was never used and complicated macro
expansion. The current implementation generates macros like
#define {name} "{name}", "{tags}" which requires extra preprocessor
indirection (SECOND_ARG and GET_TAGS macros) to extract the tags.
This change simplifies to #define {name} "{tags}" and eliminates
the unnecessary preprocessor complexity.
Changes:
- Modified parse_config.py (line 60) to generate macros in the
simplified format: #define {name} "{tags}" instead of
#define {name} "{name}", "{tags}"
- Updated hip_test_common.hh (lines 24-32) to eliminate SECOND_ARG
and GET_TAGS indirection, reducing from 4 macros to 2 macros:
* Before: #define HIP_TEST_CASE(name) TEST_CASE(#name, GET_TAGS(name))
* After: #define HIP_TEST_CASE(name) TEST_CASE(#name, name)
Benefits:
- Reduces generated header size
- Removes unnecessary preprocessor complexity
- Simplifies macro expansion
JIRA ID: AIRUNTIME-1933
(cherry picked from commit 8634170)
Fix raw TEST_CASE/TEMPLATE_TEST_CASE call sites and hip_test_common.hh wrapper macros broken by parse_config.py now emitting a single concatenated string literal instead of a name+tags pair. (cherry picked from commit 3db634f)
The guide described the removed GET_TAGS/SECOND_ARG indirection and the old compile error. Update it to the current expansion and the error a missing YAML entry now produces. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> (cherry picked from commit 468973d)
❌ PR Check — Action Required
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🚫 Please fix the failed policies before requesting reviews. The following policy checks failed:
The |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Jira: AIRUNTIME-1933
Each generated macro in
hip_test_config.hhpreviously carried the test nametwice — once as a literal string and once as the macro name itself:
The name is already available at the call site via #name stringification, so
the first argument was pure duplication. Every macro now emits only the tags:
Changes
catch/config/parse_config.py — emit #define {name} "{tags}" instead of
the two-argument form.
catch/include/hip_test_common.hh — 4 macros collapse to 2. The
SECOND_ARG / GET_TAGS preprocessor indirection that existed only to peel
the redundant first argument is deleted:
The #else (no ENABLE_YAML_TAGS) branch keeps the same shape with an empty
tag string, so behaviour is unchanged when YAML tags are off.
7 unit test files — convert the remaining raw TEST_CASE()
call sites to HIP_TEST_CASE(...). These are required, not cosmetic: with a
single-string macro, a raw TEST_CASE(Unit_Foo) would name the test after its
tag string rather than after Unit_Foo.
catch/contract/AUTHORING.md — a test case with no YAML entry now fails
with use of undeclared identifier '' instead of a SECOND_ARG error.
Verification
Generated header contains 4853 defines, zero in the old two-argument form.
0 raw TEST_CASE() call sites remain; 4482 converted sites.
Static cross-check: every HIP_TEST_CASE / HIP_TEMPLATE_TEST_CASE call site resolves to a generated #define (the only apparent misses are token-pasting macros such as HIP_TEST_CASE(Unit_hipMemsetFunctional_##suffix)).
Full hip-tests build on gfx1201.
Impact
No test names, tags, levels, or ctest labels change. This is a
preprocessor-level cleanup: same generated Catch2 registrations, less duplication
in the generated header, and one fewer layer of macro indirection to read through.