Skip to content

refactor(rocfft): remove is_partial flag and validate fields at construction - #8718

Merged
regan-amd merged 7 commits into
developfrom
users/regan-amd/no_partial_flag_in_data_layout
Oct 2, 2026
Merged

regan-amd merged 7 commits into
developfrom
users/regan-amd/no_partial_flag_in_data_layout

Conversation

@regan-amd

@regan-amd regan-amd commented Jun 23, 2026 •

Copy link
Copy Markdown
Contributor

Motivation (edited 09/08/2026)

The is_partial flag on data_layout_t::axis_t is context-dependent: it's relevant only for layouts attached to field's bricks, it's irrelevant otherwise (supposed and expected to be false) for any non-distributed data, e.g., as for any single-device usage.
Being context-dependent, any modification to the context, i.e., to a field, must trigger a modification to all the bricks' layouts. This is generating unnecessary maintenance costs, and prone to let internally-inconsistent field objects be created.
This PR removes the is_partial flag from data_layout_t::axis_t and tighten up how rocfft_field_t objects (i.e., the context) may be created and/or modified to prevent the creation of internally-inconsistent fields by design.

These changes are also motivated by possible existing bottlenecks for distributed workloads involving fields with large numbers of bricks: caching derived state (global data range, undistributed dimensions) at construction avoids redundant re-computation on every query. The field's constructor takes its bricks by value, so callers can move them in to transfer ownership or pass an lvalue to keep their own copy.

JIRA ID: AIFFT-475

Technical Details (edited 09/08/2026)

  • Remove the is_partial member from data_layout_t::axis_t and all code that sets or reads it (has_some_partial_length_axis(), the flag in make_contiguous_intersection_of, etc.);
  • Make rocfft_field_t::bricks private; expose read-only access via get_bricks(), get_brick(i), num_bricks(), and empty();
  • Move tessellation validation into rocfft_field_t's constructor, making invalid fields unrepresentable (fail-fast on construction rather than relying on separate finalize() + has_valid_tessellation() calls);
  • Precompute the field's global data range and undistributed length dimensions at construction; expose them as read-only via get_global_data_range() and get_undistributed_length_dimensions();
  • Add erase_unit_length_axis() and reorder_length_axes() private member functions to rocfft_field_t that maintain internal invariants (global range, undistributed dimensions set) consistently;
  • Extend data_layout_t::default_full_layout to accept multi-dimensional batches (std::vector<size_t>) alongside a convenience overload for the common single-batch case.
  • Have rocfft_field_t's constructor take its bricks by value (std::vector<rocfft_brick_t>) so ownership transfer is the caller's choice (move in to transfer, pass an lvalue to keep a copy) rather than being mandated via an rvalue reference.

Test Plan

The current multi-device integration tests cover all the suggested changes.

Test Result

Tests pass on 2 or 8 gfx90a devices, using tests for single- or multi-process usage.

Submission Checklist

@codecov-commenter

codecov-commenter commented Jun 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 27.81250% with 231 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
projects/rocfft/library/src/plan.cpp 29.01% 173 Missing and 13 partials ⚠️
projects/rocfft/library/src/include/plan.h 2.86% 34 Missing ⚠️
projects/rocfft/library/src/data_layout.cpp 52.94% 6 Missing and 2 partials ⚠️
projects/rocfft/library/src/transform.cpp 0.00% 2 Missing ⚠️
projects/rocfft/library/src/include/data_layout.h 75.00% 0 Missing and 1 partial ⚠️

❌ Your project check has failed because the head coverage (47.97%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8718      +/-   ##
===========================================
+ Coverage    70.23%   70.28%   +0.06%     
===========================================
  Files         2810     2810              
  Lines       462535   462582      +47     
  Branches     68103    68105       +2     
===========================================
+ Hits        324833   325123     +290     
+ Misses      114182   113886     -296     
- Partials     23520    23573      +53     
Flag Coverage Δ *Carryforward flag
TensileLite-CPP 46.40% <ø> (ø) Carriedforward from a8b6476
TensileLite-Unit 76.08% <ø> (ø) Carriedforward from a8b6476
hipBLAS 90.62% <ø> (ø) Carriedforward from a8b6476
hipBLASLt 35.24% <ø> (ø) Carriedforward from a8b6476
hipCUB 82.68% <ø> (ø) Carriedforward from a8b6476
hipDNN 87.02% <ø> (ø) Carriedforward from a8b6476
hipFFT 43.07% <ø> (ø) Carriedforward from a8b6476
hipRAND 76.12% <ø> (ø) Carriedforward from a8b6476
hipSOLVER 68.92% <ø> (ø) Carriedforward from a8b6476
hipSPARSE 86.99% <ø> (ø) Carriedforward from a8b6476
rocBLAS 48.31% <ø> (ø) Carriedforward from a8b6476
rocFFT 47.97% <27.81%> (+0.81%) ⬆️
rocRAND 56.90% <ø> (ø) Carriedforward from a8b6476
rocSOLVER 76.83% <ø> (ø) Carriedforward from a8b6476
rocSPARSE 74.61% <ø> (ø) Carriedforward from a8b6476
rocThrust 91.60% <ø> (ø) Carriedforward from a8b6476

*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 57.14% <75.00%> (+4.02%) ⬆️
projects/rocfft/library/src/transform.cpp 27.29% <0.00%> (ø)
projects/rocfft/library/src/data_layout.cpp 35.19% <52.94%> (+1.86%) ⬆️
projects/rocfft/library/src/include/plan.h 21.74% <2.86%> (-4.68%) ⬇️
projects/rocfft/library/src/plan.cpp 29.66% <29.01%> (+1.65%) ⬆️

... and 48 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 force-pushed the users/regan-amd/no_partial_flag_in_data_layout branch 3 times, most recently from 8ab70b8 to 10482e9 Compare June 23, 2026 18:40
@regan-amd
regan-amd marked this pull request as ready for review June 23, 2026 19:58
@regan-amd
regan-amd requested a review from a team as a code owner June 23, 2026 19:58
@github-actions

github-actions Bot commented Aug 5, 2026

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 Aug 5, 2026
@regan-amd

Copy link
Copy Markdown
Contributor Author

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.

Other priorities have taken precedence. I will get back to this work hopefully soon!

@github-actions github-actions Bot removed the Stale PR has no activity for 25+ days label Aug 6, 2026
@github-actions

github-actions Bot commented Sep 7, 2026

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 Stale PR has no activity for 25+ days and removed Stale PR has no activity for 25+ days labels Sep 7, 2026
@regan-amd regan-amd changed the title [rocfft] Remove is_partial flag from data_layout_t and make rocfft_field_t validate bricks at construction refactor(rocfft): remove is_partial flag and validate fields at construction Sep 8, 2026
@regan-amd
regan-amd force-pushed the users/regan-amd/no_partial_flag_in_data_layout branch from 10482e9 to fa93634 Compare September 8, 2026 22:55
@therock-pr-bot

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

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
📝 PR Description ✅ Pass —
⛔ 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/rocfft/library/src/data_layout.cpp, projects/rocfft/library/src/include/data_layout.h, projects/rocfft/library/src/include/plan.h, projects/rocfft/library/src/plan.cpp, projects/rocfft/library/src/transform.cpp; no test file found
🔎 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

therock-pr-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown

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

Add an overload accepting a vector of batch sizes for multi-batch layouts, and keep a convenience single-batch inline wrapper for backward compatibility.
Make bricks private with accessor methods (get_bricks, get_brick, num_bricks,
empty). Compute global_data_range and undistributed_length_dimensions eagerly
in a validating constructor that checks tessellation. Add field-level
erase_unit_length_axis() and reorder_length_axes() operations.
Remove the is_partial member and all code that sets/reads it. Replace
has_some_partial_length_axis() with direct lower-bound checks where needed.
Change accessor exception type to std::out_of_range for semantic correctness.
Let callers choose to move (transfer ownership) or copy (keep their own
vector for reuse) rather than mandating ownership transfer via rvalue ref.
… transpose

The RCCL-guarded GlobalTransposeRCCL and InitRCCLCommunicator code accessed
the private bricks member of rocfft_field_t directly, which failed to compile
with ROCFFT_RCCL_ENABLE=ON. Switch to the public num_bricks()/get_brick()/
get_bricks() accessors.
@regan-amd
regan-amd force-pushed the users/regan-amd/no_partial_flag_in_data_layout branch from dcc9166 to cc0607f Compare September 14, 2026 17:55
Comment thread projects/rocfft/library/src/plan.cpp Resolved
Comment thread projects/rocfft/library/src/plan.cpp Resolved
@regan-amd
regan-amd merged commit 5b7f5d4 into develop Oct 2, 2026
114 of 116 checks passed
@regan-amd
regan-amd deleted the users/regan-amd/no_partial_flag_in_data_layout branch October 2, 2026 16:18
ScottTodd pushed a commit that referenced this pull request Oct 2, 2026
…icks (#12967)

## Motivation

#8718 made `rocfft_field_t::bricks` private, breaking the contiguity
check in `plan.cpp`.

## Technical Details

Self-explanatory 

## Test Plan

Re-build and test.

## Test Result

Build succeeds.

## Submission Checklist

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

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

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.

4 participants