Skip to content

fix(fft): set correct Load/StoreOps on gather-scatter multi-GPU plans - #12602

Merged
evetsso merged 8 commits into
developfrom
users/evetsso/mgpu_jitcb
Oct 10, 2026
Merged

evetsso merged 8 commits into
developfrom
users/evetsso/mgpu_jitcb

Conversation

@evetsso

@evetsso evetsso commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Enable JIT callbacks to work on multi-GPU plans.

JIRA ID: AIFFT-460

Technical Details

Gather-scatter plan creation now creates the gather + scatter items first (if needed), and they apply load/store ops as needed. They now will launch an extra kernel to apply the ops if the first/last op (respectively) is not a kernel.

Once that is done, the single-device plan can then know whether or not it still needs to apply the load/store ops. We then add the required dependencies in the graph once all items exist.

Modified plan execution to allow JIT callbacks and disallow the already-deprecated function pointer callbacks with multi-GPU transforms.

Enable JIT callback tests for multi-GPU. This additional testing uncovered a problem with result scaling in multi-GPU plans, where a real inverse transform might use a transpose kernel that works on reals and also wants result scaling. We were missing some typedefs to allow this case to work.

Test Plan

Implemented new test cases.

Test Result

Test cases pass.

Submission Checklist

Gather-scatter plan creation now creates the gather + scatter items
first (if needed), and they apply load/store ops as needed.  They now
will launch an extra kernel to apply the ops if the first/last op
(respectively) is not a kernel.

Once that is done, the single-device plan can then know whether or not
it still needs to apply the load/store ops.  We then add the required
dependencies in the graph once all items exist.

Modified plan execution to allow JIT callbacks and disallow function
pointer callbacks with multi-GPU transforms.

Enable JIT callback tests for multi-GPU.
@therock-pr-bot

therock-pr-bot Bot commented Sep 25, 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

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

Copy link
Copy Markdown

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

@codecov

codecov Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 24.13793% with 66 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
projects/rocfft/library/src/plan.cpp 25.00% 49 Missing and 2 partials ⚠️
...ojects/rocfft/library/src/include/load_store_ops.h 21.43% 10 Missing and 1 partial ⚠️
projects/rocfft/library/src/transform.cpp 20.00% 0 Missing and 4 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #12602      +/-   ##
===========================================
- Coverage    72.10%   69.97%   -2.12%     
===========================================
  Files         2861     2933      +72     
  Lines       472618   482116    +9498     
  Branches     69810    69511     -299     
===========================================
- Hits        340755   337360    -3395     
- Misses      108125   120561   +12436     
- Partials     23738    24195     +457     
Flag Coverage Δ *Carryforward flag
TensileLite-CPP 48.80% <ø> (-0.23%) ⬇️ Carriedforward from 969ebdd
TensileLite-Unit 77.49% <ø> (-5.79%) ⬇️ Carriedforward from 969ebdd
hipBLAS 90.62% <ø> (ø) Carriedforward from 969ebdd
hipBLASLt 35.28% <ø> (-3.37%) ⬇️ Carriedforward from 969ebdd
hipCUB 82.68% <ø> (ø) Carriedforward from 969ebdd
hipDNN 86.96% <ø> (+0.32%) ⬆️ Carriedforward from 969ebdd
hipFFT 54.32% <ø> (ø) Carriedforward from 969ebdd
hipRAND 76.12% <ø> (ø) Carriedforward from 969ebdd
hipSOLVER 68.96% <ø> (ø) Carriedforward from 969ebdd
hipSPARSE 86.99% <ø> (ø) Carriedforward from 969ebdd
rocBLAS 48.31% <ø> (+0.06%) ⬆️ Carriedforward from 969ebdd
rocFFT 48.45% <24.14%> (-0.33%) ⬇️
rocRAND 57.42% <ø> (-0.03%) ⬇️ Carriedforward from 969ebdd
rocSOLVER 76.83% <ø> (+<0.01%) ⬆️ Carriedforward from 969ebdd
rocSPARSE 74.76% <ø> (+0.13%) ⬆️ Carriedforward from 969ebdd
rocThrust 78.34% <ø> (-14.81%) ⬇️ Carriedforward from 969ebdd

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

Files with missing lines Coverage Δ
projects/rocfft/library/src/include/plan.h 21.74% <ø> (ø)
projects/rocfft/library/src/transform.cpp 27.33% <20.00%> (+2.11%) ⬆️
...ojects/rocfft/library/src/include/load_store_ops.h 16.46% <21.43%> (+0.46%) ⬆️
projects/rocfft/library/src/plan.cpp 28.86% <25.00%> (-0.74%) ⬇️

... and 339 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.

@af-ayala af-ayala 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.

I left minor improvement suggestions, it looks very good overall.
In docs/how-to/load-store-callbacks.rst, it still says JIT+fields is unsupported and callback-data length is always 1. Now it's enabled.

Comment thread projects/rocfft/CHANGELOG.md Resolved
Comment thread projects/rocfft/library/src/plan.cpp Resolved
Comment thread projects/rocfft/library/src/plan.cpp Resolved
Comment thread projects/rocfft/library/src/plan.cpp Resolved
The non-pencil general branch re-applied load callbacks to transposed temp buffers for non-contiguous dims, so callbacks ran twice with temp-buffer cbdata. Add pencil-to-slab tokens (with and without JIT callbacks) covering this path.

@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.

Two additional comments/notes:

  • I believe there is a (pre-existing) bug that this feature generalization would make reachable now, can you please give a look to #13102? We may want to integrate that along with these changes.
  • The rocfft.h's doxygen needs to be updated, e.g., this note can be removed now.

Comment thread projects/rocfft/library/src/plan.cpp Resolved
Comment thread projects/rocfft/CHANGELOG.md Resolved
Comment thread projects/rocfft/library/src/plan.cpp Resolved
Comment thread projects/rocfft/CHANGELOG.md Resolved
- fields or bricks -> fields
- default std::nullopt on transpose_brick
- remove antecedents arg from CreateInput and CreateOutput, make them only
  return the items needed to figure out dependencies
- explicitly doc expectations for multi-gpu + jit callbacks
- remove other notes saying jit cb + multi-gpu is disallowed
@evetsso
evetsso merged commit 466f650 into develop Oct 10, 2026
154 of 159 checks passed
@evetsso
evetsso deleted the users/evetsso/mgpu_jitcb branch October 10, 2026 03:14
@assistant-librarian

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

regan-amd added a commit that referenced this pull request Oct 13, 2026
)

## Motivation

Follow-up to #12602, which was merged with some review feedback marked
as resolved without a response or a corresponding change:

- [Comment on the legacy section of
`load-store-callbacks.rst`](#12602 (comment)),
asking to remove the paragraphs that follow the new note: they still
describe one function pointer per brick (with 4-brick and 6-brick
examples) and the "same logical operation" rule, which contradicts the
note added right above them.
- [Review
comment](#12602 (review))
asking for the `rocfft.h` doxygen to be updated: the JIT-callback notes
were removed, but the doxygen of the deprecated
`rocfft_execution_info_set_load_callback` and
`rocfft_execution_info_set_store_callback` still describes per-brick
arrays and does not mention the new restriction.

This also removes an unused local left over by #13102 (merged into
#12602).

JIRA ID: AIFFT-460

## Technical Details

#12602 made `rocfft_execute` return `rocfft_status_invalid_arg_value`
when function pointer callbacks are combined with fields
(`have_funcptr_callbacks && have_multigpu_plan` in `transform.cpp`). A
function pointer callback can therefore only run on a plan without
fields, which has a single input brick and a single output brick:

- the single-device execution plan reads/writes the user's buffers at
index 0 (`BufferPtr::user_input(0, ...)` / `BufferPtr::user_output(0,
...)` in `plan.cpp`);
- the callback function pointer and data are looked up at that same
index (`execPlan.inputPtr.get(...)` / `execPlan.outputPtr.get(...)` in
`powX.cpp`).

So the per-brick array semantics, the "all functions must perform the
same logical operation" rule and the "at least one brick on the current
device" requirement no longer apply to function pointer callbacks.
Changes:

- `docs/how-to/load-store-callbacks.rst`: keep the gfx1250 note as it
was; replace the per-brick paragraphs with the single-entry rule and the
returned error.
- `library/include/rocfft/rocfft.h`: same update in the doxygen of
`rocfft_execution_info_set_load_callback` and
`rocfft_execution_info_set_store_callback`.
- `library/src/plan.cpp`: drop the unused `loadOps` local in
`BuildOptMultiDevicePlan`'s `nonContiguousDims` loop; load ops are
applied once by the `contiguousInputDims` FFT.

## Test Plan

- Regular test suite

## Test Result

- Regular test suite passes

## Submission Checklist

- [x] Look over the contributing guidelines at
https://github.com/ROCm/TheRock/blob/main/GOVERNANCE.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.

4 participants