Skip to content

AIRUNTIME-1933: (refactor) remove redundant hiptest macros - #10921

Open
JDas-AMD wants to merge 3 commits into
ROCm:developfrom
JDas-AMD:users/zifan/AIRUNTIME-1933-remove-redundant-hiptest-macros
Open

AIRUNTIME-1933: (refactor) remove redundant hiptest macros#10921
JDas-AMD wants to merge 3 commits into
ROCm:developfrom
JDas-AMD:users/zifan/AIRUNTIME-1933-remove-redundant-hiptest-macros

Conversation

@JDas-AMD

Copy link
Copy Markdown
Contributor

Summary

Jira: AIRUNTIME-1933

Each generated macro in hip_test_config.hh previously carried the test name
twice — once as a literal string and once as the macro name itself:

#define Unit_Foo_Positive "Unit_Foo_Positive", "[unit][level_1][gfx1201]"

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:

#define Unit_Foo_Positive "[unit][level_1][gfx1201]"

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:

#define HIP_TEST_CASE(name)               TEST_CASE(#name, name)
#define HIP_TEMPLATE_TEST_CASE(name, ...) TEMPLATE_TEST_CASE(#name, name, __VA_ARGS__)

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.

Zixuan Fan and others added 3 commits August 28, 2026 18:33
…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)
@JDas-AMD
JDas-AMD requested a review from a team as a code owner August 28, 2026 22:41
@JDas-AMD JDas-AMD changed the title Users/zifan/airuntime 1933 remove redundant hiptest macros AIRUNTIME-1933: (refactor) remove redundant hiptest macros Aug 28, 2026
@therock-pr-bot

Copy link
Copy Markdown

❌ PR Check — Action Required

Check Status Details
📝 PR Description ❌ Fail Error: PR description must reference a JIRA ID, ISSUE ID, or a GitHub closing keyword.
Expected: include a JIRA ID / ISSUE ID line (separator : or -, or omitted; value may be a JIRA key, a number with/without #, or a link), OR a closing keyword + issue reference. Accepted examples:
JIRA ID : TESTAUTO-6039
JIRA ID - #330
JIRA ID #330
JIRA ID (on separate line)
ROCM-25757
ISSUE ID : TESTUTO-3334
ISSUE ID #3334
ISSUE ID - TESTAUTO-3433
ISSUE ID (on separate line)
AIRUNTIME-2352
ISSUE ID : https://github.com/<org_name>/<repo_name>/issues/1234
Closes #10
Fixes octo-org/octo-repo#100
Resolves: #123
#123
https://github.com/<org_name>/<repo_name>/issues/123
Current: no valid JIRA/ISSUE/closing-keyword reference found
Forbidden Files ✅ Pass
🧪 Unit Test ⚠️ Warning Error: Source/code files changed without an accompanying unit test.
Expected: add at least one test file named like test_<name>.py / test_<name>.cpp (or <name>_test.*).
Current: code file(s) changed: projects/hip-tests/catch/config/parse_config.py, projects/hip-tests/catch/unit/atomics/unsafeAtomicAdd.cc, projects/hip-tests/catch/unit/cooperativeGrps/thread_block_tile.cc, projects/hip-tests/catch/unit/deviceLib/AtomicAdd_Coherent.cc, projects/hip-tests/catch/unit/deviceLib/AtomicAdd_NonCoherent.cc (+3 more); no test file found
🔎 pre-commit ⏳ Pending ⏳ Still running…
🚫 Draft PR 🔜 To Be Enabled
🚩 Feature Flag 🔜 To Be Enabled
📊 Code Coverage 🔜 To Be Enabled

⚠️ 1 policy check(s) failed. Please address the issues above before this PR can be Reviewed.

🚫 Please fix the failed policies

  • ❌ PR Description

The Not ready to Review label was added to this PR. Once all policies pass, the label is removed automatically.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@therock-pr-bot

Copy link
Copy Markdown

🚫 Please fix the failed policies before requesting reviews.

The following policy checks failed:

  • ❌ PR Description

The Not ready to Review label has been added to this PR.
Once all policies pass, the label will be removed automatically.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant