Skip to content

test(rocfft): cover data_layout stride and offset arithmetic - #12667

Merged
Abuudiii merged 2 commits into
developfrom
users/Abdullah/rocfft-internal-test-data-layout
Oct 26, 2026
Merged

Abuudiii merged 2 commits into
developfrom
users/Abdullah/rocfft-internal-test-data-layout

Conversation

@Abuudiii

@Abuudiii Abuudiii commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Split from #11272. data_layout stride and offset arithmetic had no direct tests.

Technical Details

  • data_layout_test.cpp - constructor validation, packed default strides, offsets, in-place real/complex layouts and axis ordering
  • shared/ptrdiff.h - adds the missing #include <algorithm> for std::any_of; it did not build without it once the test compiled data_layout.cpp

Test Plan

Built this branch alone on develop and ran every rocfft-internal-test case in its own process on MI210 (gfx90a), ROCm 7.1.0.

Test Result

15/15 new tests pass, 19/19 total.

Submission Checklist

@therock-pr-bot

therock-pr-bot Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ✅ Pass —
🔎 pre-commit ✅ Pass —
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —
🤖 therock-pr-bot ✅ Pass —

🎉 All checks passed! This PR is ready for review.

📖 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

🎉 All checks passed! This PR is ready for review.

@Abuudiii Abuudiii self-assigned this Sep 28, 2026
@Abuudiii
Abuudiii marked this pull request as ready for review September 28, 2026 20:43
@Abuudiii
Abuudiii requested a review from a team as a code owner September 28, 2026 20:43
@codecov

codecov Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #12667      +/-   ##
===========================================
- Coverage    76.01%   75.94%   -0.07%     
===========================================
  Files         2869     2869              
  Lines       475537   475537              
  Branches     71215    71215              
===========================================
- Hits        361460   361131     -329     
- Misses       89533    89922     +389     
+ Partials     24544    24484      -60     
Flag Coverage Δ *Carryforward flag
TensileLite-CPP 49.30% <ø> (ø) Carriedforward from 6168549
TensileLite-Unit 83.65% <ø> (ø) Carriedforward from 6168549
hipBLAS 90.62% <ø> (ø) Carriedforward from 6168549
hipBLASLt 65.22% <ø> (ø) Carriedforward from 6168549
hipCUB 82.68% <ø> (ø) Carriedforward from 6168549
hipDNN 87.00% <ø> (ø) Carriedforward from 6168549
hipFFT 42.00% <ø> (ø) Carriedforward from 6168549
hipRAND 76.12% <ø> (ø) Carriedforward from 6168549
hipSOLVER 69.67% <ø> (ø) Carriedforward from 6168549
hipSPARSE 86.99% <ø> (ø) Carriedforward from 6168549
rocBLAS 68.73% <ø> (ø) Carriedforward from 6168549
rocFFT 47.11% <ø> (-0.99%) ⬇️
rocRAND 57.30% <ø> (ø) Carriedforward from 6168549
rocSOLVER 76.74% <ø> (ø) Carriedforward from 6168549
rocSPARSE 76.92% <ø> (ø) Carriedforward from 6168549
rocThrust 93.15% <ø> (ø) Carriedforward from 6168549

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
projects/rocfft/library/src/include/data_layout.h 62.86% <ø> (+5.71%) ⬆️

... and 58 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@regan-amd regan-amd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Due to our own delayed consideration for this PR, these changes are outdated now unfortunately: please rebase and update the tests as needed to reflect the current status of the code base.

Specifically:

  • #8718 removed the is_partial constructor parameter from data_layout_t. The constructor is now data_layout_t(lower, upper, strides, batch_rank = 1), so every 5-argument call in data_layout_test.cpp no longer compiles against develop.
  • The same change removed the check that rejects a nonzero lower bound on a non-partial layout. The EXPECT_THROW / EXPECT_NO_THROW pair that tests it (around lines 36-40) should be removed rather than adapted. The new check in get_other_inplace_layout_for (a nonzero lower bound on a length axis throws std::logic_error) could be a good replacement test.

@Abuudiii
Abuudiii force-pushed the users/Abdullah/rocfft-internal-test-data-layout branch from 286e758 to 6168549 Compare October 19, 2026 21:52
@Abuudiii

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Rebased on current develop and updated:

  • All constructor calls use the new data_layout_t(lower, upper, strides, batch_rank) signature.
  • Removed the is_partial lower-bound test. In its place, inplace_query_rejects_bad_arguments checks that a nonzero lower bound on a length axis throws std::logic_error, and that one on a batch axis does not.
  • The ptrdiff.h change is gone; develop already has the include.

Tested on gfx1201 (ROCm 7.2.4) across ~56 seeds: 15/15 data_layout tests, 19/19 total. I also checked that the tests catch bugs by breaking data_layout.cpp in 9 ways (dropping the - other.lower term, skipping batch axes in offset_in, skipping the embedding update on reorder, ignoring the odd-length flag, etc.). Each one made a test fail.

@Abuudiii
Abuudiii removed this pull request from stack #14066 October 24, 2026 23:27
@Abuudiii
Abuudiii added this pull request to stack #14361 October 24, 2026 23:27
Replace the hand-written --seed argument loop in internal_test_main.cpp
with CLI11 (shared/CLI11.hpp), as used by rocfft-test and the other
rocFFT tools. Accepts --seed <value> and --seed=<value>, rejects unknown
arguments, and adds --help.
@Abuudiii
Abuudiii merged commit a0b31d5 into develop Oct 26, 2026
96 of 97 checks passed
@Abuudiii
Abuudiii deleted the users/Abdullah/rocfft-internal-test-data-layout branch October 26, 2026 19:43
@assistant-librarian

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

regan-amd added a commit that referenced this pull request Nov 2, 2026
#14505)

## Motivation

Follow-up to #12667. The optional dimension-ordering argument of
`default_strides`,
`default_distances` and `default_distance` has a half-baked contract
(e.g., silently invalid
strides for real in-place transforms whose last dimension is not
contiguous), and it only ever
served one consumer: `setup_nondefault_dim_ordering_plan` in
`hipfftw_test.cpp`.

That unclear contract invited misuse and confusion about its purpose,
both in #12667 and earlier in
#5761. Rather than patching it, this PR simplifies the helpers' contract
altogether and moves the
consumer-specific logic into the one test that needs it.

JIRA ID: AIFFT-543

## Technical Details

- `client_data_layout_helpers.h`: remove `dim_order` / `len_dim_order`
from `default_strides`,
`default_distances` and `default_distance`, along with the related
validation and docs. The
rocFFT and hipFFT copies remain identical. All other callers only used
the default arguments,
  for which the behavior is unchanged.
- `hipfftw_test.cpp` (`setup_nondefault_dim_ordering_plan`): compute the
packed data extents per
side (Hermitian-reduced last dimension, plus padding on the real side of
in-place transforms),
then derive strides and distances with a local `packed_layout` lambda
from the shuffled
  dimension ordering.
- Test coverage is unchanged: for a given seed, the generated test cases
are identical. Random
draws happen in the same order, and the strides and distances match the
previous values.

## Test Plan

- Locally checked that the new strides and distances in
`setup_nondefault_dim_ordering_plan` match
the previous helper-based values exactly, on 20,000 random
configurations generated the same way
  as in the test (all transform types and placements, ranks 2-3).
- Compiled the hipFFT library sources that include the header
(`hipfft.cpp`, `hipfftw.cpp`) and
  `hipfftw_test.cpp`.
- Run `hipfftw-test` and the regular hipFFT and rocFFT client test
suites in CI.

## Test Result

- Local equivalence check: 0 mismatches out of 20,000.
- Local compilation: OK.
- CI: pending.

## Submission Checklist

- [x] Look over the contributing guidelines at
  https://github.com/ROCm/TheRock/blob/main/GOVERNANCE.md#pull-requests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Abuudiii added a commit that referenced this pull request Nov 3, 2026
## Motivation

JIRA ID : AIFFT-561

Renames `data_layout_t` to `data_set_t` before the struct is extended to
describe a full data set in a buffer, not only its layout. No functional
change.

Depends on #12667, which adds the test file renamed here.

## Technical Details

- `data_layout.{h,cpp}` -> `data_set.{h,cpp}`, `data_layout_test.cpp` ->
`data_set_test.cpp`, CMake lists updated. The name avoids confusion with
the existing `data_descriptor.h` (solution-map serializer).
- Members that refer to a layout are renamed: `full_layout` ->
`full_range`, `default_full_layout` -> `default_full_range`,
`get_layout_for_len_axes` -> `get_data_set_for_len_axes`,
`get_embedding_layout` -> `get_embedding_data_set`,
`get_other_inplace_layout_for` -> `get_other_inplace_data_set_for`.
- The struct's documentation states that it describes in-buffer data
without holding any.
- `plan.{h,cpp}`, `tree_node.{h,cpp}`: uses of the type and members
renamed.
- Members outside the struct (`rocfft_brick_t::layout`,
`input_layout`/`output_layout`, `undistributed_layout_for`) are left for
a separate mechanical PR at the end of the stack. Public
`rocfft_plan_description_set_data_layout` is unchanged.

## Test Plan

Built `rocfft` and `rocfft-internal-test` on Navi4x (gfx1201), ROCm
7.2.4, and ran every `rocfft-internal-test` case in its own process.

## Test Result

19/19 pass, including the 15 `data_set_test` cases.

## Submission Checklist

- [x] Look over the contributing guidelines at
https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
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.

3 participants