feat(rocprim) Replace index-based test filters in rtest.xml by names - #11453
Merged
amd-hsong merged 24 commits intoSep 18, 2026
Merged
Conversation
✅ All Checks Passed — Ready for Review
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🎉 All checks passed! This PR is ready for review. |
Contributor
|
@amd-hsong There are build failures in CI: |
Contributor
Author
|
@stanleytsang-amd The Windows build failure has been fixed. |
…generators The four GTEST_FILTER vars in rtest.xml selected typed tests by numeric type-list index (e.g. *Tests/16*), which silently retarget a different type whenever a TYPED_TEST_SUITE type list is added to, removed from, or reordered. Mirror the rocRAND fix (#11000): give the warp_/block_ typed suites stable, type-derived names and filter by name, selecting exactly the same set of test cases as before. - test_utils_types.hpp: make typed_test_suite_def variadic to forward an optional 4th name-generator arg to TYPED_TEST_SUITE; add type_tag<T>() and warp/block/vector/class param name generators. - 13 warp_/block_ suites: pass the matching name generator. - rtest.xml: rewrite SMOKE/SMOKE_OLD/REGRESSION/EXTENDED to name-based patterns, verified to expand to the identical selection over the built test list. Device value-param suites remain index-based (follow-up). test_categories.yaml is unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
… rtest filters Add type-derived TYPED_TEST_SUITE name generators for RocprimDeviceSelectTests, RocprimDeviceBinarySearch and RocprimDeviceRunLengthEncode so their rtest.xml filters select by stable name instead of instantiation index. Extends the shared type_tag<> with `unsigned long`. Selection is byte-for-byte equivalent across all four filter sets (smoke, smoke_old, regression, extended); test_categories.yaml is untouched and its CustomHugeType1024Int name preserved. Phase 3b batch 1.
Add name generators for RocprimDeviceMergeTests and RocprimDeviceSegmentedScan so their rtest.xml filters reference tests by type-derived names instead of numeric instantiation indices. Extend type_tag with char, long long, custom_short2, and custom_large. Verified selecting the identical test set across all four filter vars. Co-Authored-By: Claude <noreply@anthropic.com>
…tch 3) Add input-type name generators for RocprimConstantIteratorTests and RocprimTransformIteratorTests. RocprimCountingIteratorTests is left indexed: its unsigned long and size_t instantiations are the same type under LP64, so no type-derived name can distinguish them. Verified identical selection across all four filter vars. Co-Authored-By: Claude <noreply@anthropic.com>
… (batch 4) Add name generators for RocprimDeviceUniqueByKeyTests (key/value + flags), RocprimIntrinsicsTests (element type, with local custom types), and RocprimThreadTests (block dimensions). Extend type_tag with custom_huge_type<1024, int>. Verified identical selection across all four filter vars. Co-Authored-By: Claude <noreply@anthropic.com>
Add a config-encoding name generator for RocprimDeviceSegmentedReduce (input/output type + block-reduce algorithm + init/segment lengths + identity/graphs flags). use_default_config disambiguates the default-algorithm instantiation, whose enum value aliases using_warp_reduce. Verified identical selection across all four filter vars. Co-Authored-By: Claude <noreply@anthropic.com>
Add a config-encoding name generator for RocprimDeviceReduceTests (input/output type + block-reduce algorithm + size limit + identity/graphs/ deterministic flags) and expose the deterministic template parameter as a struct member so instantiations differing only in determinism are namable. Verified identical selection across all four filter vars (exact name-level). Co-Authored-By: Claude <noreply@anthropic.com>
Add name generators for RocprimDeviceScanFutureTests (input/output type + flags, with a local tag for custom_test_array_type) and RocprimDevicePartitionTests (input/output type + identity/graphs). Extend type_tag with custom_type<long long, long long, true>. RocprimDeviceScanTests stays indexed: indices 25 and 28 are identical instantiations that SMOKE_TEST_OLD excludes different test methods from, so no single name can reproduce the selection. Verified identical selection (exact name-level). Co-Authored-By: Claude <noreply@anthropic.com>
…atch 8) Add config-encoding name generators for RocprimDeviceReduceByKey (key/value type + segment lengths + identity/graphs/deterministic) and RocprimDeviceBatchMemcpyTests (value/size type + memcpy-vs-copy, shuffled, buffer count, max size, indirect). Both handle their file-local custom types locally. Verified identical selection (exact name-level). Co-Authored-By: Claude <noreply@anthropic.com>
Add name generators for RocprimDeviceAdjacentDifferenceTests (input/output type + left/right + api_variant + config/identity/graphs/indirect) and its Large variant (left/right + api_variant + graphs). This suite's type list drifted from the pre-migration golden, so selection was verified against the committed filters on the current build (the tests that run today). Co-Authored-By: Claude <noreply@anthropic.com>
Add config-encoding name generators for all four histogram suites (Even/Range/MultiEven/MultiRange), encoding sample type, bin/level/channel parameters, level/counter types, and graph/indirect flags. Verified identical selection across all four filter vars (exact name-level). Co-Authored-By: Claude <noreply@anthropic.com>
Add a name generator for RocprimDeviceSortTests (key/value type + graphs/ indirect/config flags), with local tags for its custom key types (custom_type_copyable, custom_float_type, custom_test_array_type, custom_huge_type<2048,float>). Verified identical selection (exact name-level). Co-Authored-By: Claude <noreply@anthropic.com>
Add a name generator for RocprimDevicePartialSortTests (cv-stripped key type + config/decomposer/graphs/indirect flags), with local tags for its custom key types. RocprimDeviceNthelementTests stays indexed: its signed char and int8_t instantiations are the same type, so no type-derived name can distinguish them. Verified identical selection (exact name-level). Co-Authored-By: Claude <noreply@anthropic.com>
…(batch 13) Add name generators for RocprimThreadOperationTests (element type), RocprimLookbackReproducibilityTests (input type), and HipcubBlockRunLengthDecodeTest (item/length type + block/run/decode sizes). Extend type_tag with custom_type<unsigned long, unsigned long, true>. Verified identical selection (exact name-level). Co-Authored-By: Claude <noreply@anthropic.com>
… 14) Add name generators for WarpLoadTest and WarpStoreTest (type + items/warp size + method), and WarpExchangeTest/WarpExchangeScatterTest (type + items/warp size + exchange op). Extend type_tag with float2. WarpExchange's type list drifted from the pre-migration golden, so selection was verified against the committed filters on the current build. Co-Authored-By: Claude <noreply@anthropic.com>
Wire the existing class_params_name_generator into the block_load_store stamped suites (RocprimBlockLoadStoreClassTests First/Second/ThirdPart) by passing it as the name-generator argument of typed_test_suite_def. Names encode element type, load/store method, block size, and items per thread. Verified identical selection (exact name-level). Co-Authored-By: Claude <noreply@anthropic.com>
WarpExchangeTest has 55 instantiations (indices 0-54); the /55 reference was left over from a since-removed type and matched no test on the current build. It was also redundant with the WarpExchangeTest/* wildcard in the same filter, so removing it leaves selection unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
Remove the two remaining value-parameterized index groups in SMOKE_TEST. Add a value-param name generator to RocprimDevicePartitionLargeInputTest (/0..3 -> /Size2,/Size2048,/Size38713,/Size38713Graphs) and collapse the full-range RocprimDeviceSelectLargeInputFlaggedTest tokens to wildcards. Selection is exactly equivalent (verified per-suite on gfx942); test methods and test_categories.yaml are unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
The RocprimDeviceAdjacentDifferenceTests name generator omitted the config type, so two pairs of distinct instantiations collided on one name: default_config (idx0) with custom_size_limit_config<64> (idx16), and custom_size_limit_config<8192> (idx17) with <10240> (idx18). Under a "*" filter GoogleTest aborts with "same test fixture class"; under the SMOKE_OLD "Int_Int_Left_NoAlias.*" token it over-selected idx16. Encode the size-limit configs as _Sl64/_Sl8192/_Sl10240 tags; default_config stays suffix-free so Int_Int_Left_NoAlias still resolves to idx0 and no rtest.xml change is needed. Co-Authored-By: Claude <noreply@anthropic.com>
Both name generators omitted a distinguishing field, so a future same-type instantiation would collide on one name (a runtime fatal plus silent filter mis-selection, as seen in adjacent_difference). Encode the missing fields: - binary_search: append _Cfg when config is use_custom_config. - segmented_scan: append _S<min>_<max> segment-length range. The renamed instantiations are referenced by rtest.xml, so the matching SMOKE_TEST_OLD/EXTENDED_TEST tokens are updated in lockstep. Verified per-binary that all four filter vars select the identical (suite, position, method) set before and after (test_categories.yaml untouched). Co-Authored-By: Claude <noreply@anthropic.com>
added 2 commits
September 9, 2026 15:19
amd-hsong
force-pushed
the
users/amd-hsong/rocprim_replace_rtest_indices
branch
from
September 9, 2026 19:20
e85ffd8 to
16758b0
Compare
stanleytsang-amd
approved these changes
Sep 18, 2026
assistant-librarian Bot
pushed a commit
to ROCm/rocPRIM
that referenced
this pull request
Sep 18, 2026
feat(rocprim) Replace index-based test filters in rtest.xml
by names (#11453)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
## Motivation
<!-- Explain the purpose of this PR and the goals it aims to achieve.
-->
This PR replaces index-based test filters in rocPRIM's **rtest.xml** by
names.
JIRA ID: AIPRIMS-221
## Technical Details
<!-- Explain the changes along with any relevant GitHub links. -->
Using numerical indices for test filters has consistency issues when
test cases are removed/added/re-ordered as they won't refer to the same
tests anymore. To remove/replace these indices, two mechanisms are used:
### Mechanism A — full-range collapse to a wildcard (no source change)
When a filter enumerates the **entire** instantiation range of a
suite/test, the whole enumeration is replaced with a single `*`
wildcard. This is valid only when the enumerated indices equal the
complete instantiation set.
**Example:** the `Select` large-input test has 5 parameter values
(`0..4`), and SMOKE selected all of them for both test methods:
```
# before — 10 numeric tokens
RocprimDeviceSelectLargeInputFlaggedTest/*.LargeInputFlagged/0
RocprimDeviceSelectLargeInputFlaggedTest/*.LargeInputFlagged/1
... /2 /3 /4
RocprimDeviceSelectLargeInputFlaggedTest/*.LargeInputUnique/0
... /1 /2 /3 /4
# after — 2 wildcards, no source edit
RocprimDeviceSelectLargeInputFlaggedTest/*.LargeInputFlagged/*
RocprimDeviceSelectLargeInputFlaggedTest/*.LargeInputUnique/*
```
The same mechanism collapses full typed ranges elsewhere, e.g.
`RocprimDeviceRadixSort/0..N.SortKeys` →
`RocprimDeviceRadixSort/*.SortKeys`.
### Mechanism B — name generator for partial selection (source change)
When a filter selects a **subset** of a suite's instantiations, the
index cannot simply be dropped. Instead we give each instantiation a
stable, attribute-derived name and filter on that name.
**B1 — typed suites (`TYPED_TEST_SUITE`).** A generator functor derives
a readable name from the type parameters and is passed as the suite's
name generator; the filter then references the name instead of the
position. Example (warp-reduce family):
```
# before: 489 numeric patterns (SMOKE) enumerating type positions
WarpReduceTestsIntegral/0.ReduceSum* : WarpReduceTestsIntegral/1.* : ...
# after: names derived from warp_params<int,4u,1u> -> "Int_w4_i1"
WarpReduceTestsIntegral/*
-WarpReduceTestsIntegral/Int_w4_i1.ReduceSum : -WarpReduceTestsIntegral/Int_w4_i1.ReduceSumValid
```
**B2 — value-parameterized suites (`INSTANTIATE_TEST_SUITE_P`).** A free
naming function is supplied as the 4th argument of
`INSTANTIATE_TEST_SUITE_P`; it maps each `TestParamInfo` to a
`[A-Za-z0-9_]`-safe name. Example (partition large-input) — the param is
`std::pair<size_t /*size*/, bool /*use_graphs*/>`:
```cpp
INSTANTIATE_TEST_SUITE_P(
RocprimDevicePartitionLargeInputTest,
RocprimDevicePartitionLargeInputTests,
::testing::Values(std::make_pair(2, false), // -> Size2
std::make_pair(2048, false), // -> Size2048
std::make_pair(38713, false), // -> Size38713
std::make_pair(38713, true)), // -> Size38713Graphs
[](const ::testing::TestParamInfo<RocprimDevicePartitionLargeInputTests::ParamType>& info)
{
std::string name = "Size" + std::to_string(std::get<0>(info.param));
if(std::get<1>(info.param))
name += "Graphs";
return name;
});
```
```
# before # after
.../LargeInputPartition/0 -> .../LargeInputPartition/Size2
.../LargeInputPartition/1 -> .../LargeInputPartition/Size2048
.../LargeInputPartitionThreeWay/1 -> .../LargeInputPartitionThreeWay/Size2048
.../LargeInputPartitionThreeWay/2 -> .../LargeInputPartitionThreeWay/Size38713
.../LargeInputPartitionThreeWay/3 -> .../LargeInputPartitionThreeWay/Size38713Graphs
.../LargeInputPartitionTwoWay/1 -> .../LargeInputPartitionTwoWay/Size2048
```
### Residual indices
A small set of numeric indices is intentionally kept, because they
cannot be replaced by any type-derived name.
The name generator derives an instance's name from its C++ type. When
two instantiations inside one suite resolve to the **identical** type,
both would generate the **identical** name — and GoogleTest requires
instance names to be unique within a suite (a duplicate name is a hard
build error). So no type-derived name can distinguish them; only the
numeric position can. This is a blocker **only** when a filter treats
the duplicates differently (selects one but not the other, or excludes
different test methods from each).
**Example — `RocprimDeviceTransformTests` index 5 vs index 9.** On the
LP64 platform the type list contains both `unsigned long` and
`uint64_t`, which are the same underlying type, so both instantiations
print byte-for-byte identically:
```
index 5: DeviceTransformParams<unsigned long, unsigned long, false, 4294967295u, false>
index 9: DeviceTransformParams<unsigned long, unsigned long, false, 4294967295u, false>
```
A generator would emit the same name for both (build failure), and the
filters select them differently — so these tokens stay numeric. The
below table shows all the residual indices in `rtest.xml` after the
changes of this PR:
| Suite (as it appears in filters) | Indices still referenced | Reason
(same-type duplicate) |
|---|---|---|
| `RocprimDeviceScanTests` / `DeviceScanTests` / `ScanTests` | `0,1..31`
(per var) | idx 25 == idx 28 both `custom_type<int,int>`; SMOKE_OLD
excludes *different* test methods from each |
| `RocprimDeviceTransformTests` / `TransformTests` /
`DeviceTransformTests` | `0,3,4,7,8,9,11,12,15` | `unsigned long` ==
`uint64_t` (idx 5 == idx 9) |
| `TypedRadixKeyCodecTest` | `0..14` | `int8_t`==`signed char`,
`int16_t`==`short`, `uint16_t`==`unsigned short` |
| `RocprimCountingIteratorTests` | `0..3` | `unsigned long` == `size_t`
|
| `RocprimDeviceNthelementTests` | `15` | `signed char` == `int8_t` |
Everything else that was type-derivable has been converted.
## Test Plan
<!-- Explain any relevant testing done to verify this PR. -->
1. Make sure the existing test filters in `test_categories.yaml`
continue working as before;
2. Test filters in rtest.xml refer to **exactly** the same set as before
the changes, i.e.,
```
python3 rtest.py -t smoke
```
runs the same set of tests as before. Same for `-t extended` and `-t
regression` as well.
## Test Result
<!-- Briefly summarize test outcomes. -->
Confirmed test filters in `test_categories.yaml` and `rtest.xml` stay
exactly the same.
## Submission Checklist
- [ ] Look over the contributing guidelines at
https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
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.
Motivation
This PR replaces index-based test filters in rocPRIM's rtest.xml by names.
JIRA ID: AIPRIMS-221
Technical Details
Using numerical indices for test filters has consistency issues when test cases are removed/added/re-ordered as they won't refer to the same tests anymore. To remove/replace these indices, two mechanisms are used:
Mechanism A — full-range collapse to a wildcard (no source change)
When a filter enumerates the entire instantiation range of a suite/test, the whole enumeration is replaced with a single
*wildcard. This is valid only when the enumerated indices equal the complete instantiation set.Example: the
Selectlarge-input test has 5 parameter values (0..4), and SMOKE selected all of them for both test methods:The same mechanism collapses full typed ranges elsewhere, e.g.
RocprimDeviceRadixSort/0..N.SortKeys→RocprimDeviceRadixSort/*.SortKeys.Mechanism B — name generator for partial selection (source change)
When a filter selects a subset of a suite's instantiations, the index cannot simply be dropped. Instead we give each instantiation a stable, attribute-derived name and filter on that name.
B1 — typed suites (
TYPED_TEST_SUITE). A generator functor derives a readable name from the type parameters and is passed as the suite's name generator; the filter then references the name instead of the position. Example (warp-reduce family):B2 — value-parameterized suites (
INSTANTIATE_TEST_SUITE_P). A free naming function is supplied as the 4th argument ofINSTANTIATE_TEST_SUITE_P; it maps eachTestParamInfoto a[A-Za-z0-9_]-safe name. Example (partition large-input) — the param isstd::pair<size_t /*size*/, bool /*use_graphs*/>:Residual indices
A small set of numeric indices is intentionally kept, because they cannot be replaced by any type-derived name.
The name generator derives an instance's name from its C++ type. When two instantiations inside one suite resolve to the identical type, both would generate the identical name — and GoogleTest requires instance names to be unique within a suite (a duplicate name is a hard build error). So no type-derived name can distinguish them; only the numeric position can. This is a blocker only when a filter treats the duplicates differently (selects one but not the other, or excludes different test methods from each).
Example —
RocprimDeviceTransformTestsindex 5 vs index 9. On the LP64 platform the type list contains bothunsigned longanduint64_t, which are the same underlying type, so both instantiations print byte-for-byte identically:A generator would emit the same name for both (build failure), and the filters select them differently — so these tokens stay numeric. The below table shows all the residual indices in
rtest.xmlafter the changes of this PR:RocprimDeviceScanTests/DeviceScanTests/ScanTests0,1..31(per var)custom_type<int,int>; SMOKE_OLD excludes different test methods from eachRocprimDeviceTransformTests/TransformTests/DeviceTransformTests0,3,4,7,8,9,11,12,15unsigned long==uint64_t(idx 5 == idx 9)TypedRadixKeyCodecTest0..14int8_t==signed char,int16_t==short,uint16_t==unsigned shortRocprimCountingIteratorTests0..3unsigned long==size_tRocprimDeviceNthelementTests15signed char==int8_tEverything else that was type-derivable has been converted.
Test Plan
Make sure the existing test filters in
test_categories.yamlcontinue working as before;Test filters in rtest.xml refer to exactly the same set as before the changes, i.e.,
runs the same set of tests as before. Same for
-t extendedand-t regressionas well.Test Result
Confirmed test filters in
test_categories.yamlandrtest.xmlstay exactly the same.Submission Checklist