Skip to content

fix(clr): Remove premature staging buffer flush in batch copy operations - #9743

Closed
kardarra-amd wants to merge 1 commit into
developfrom
users/kardarra/fix-laghos-batch-copy-regression
Closed

fix(clr): Remove premature staging buffer flush in batch copy operations#9743
kardarra-amd wants to merge 1 commit into
developfrom
users/kardarra/fix-laghos-batch-copy-regression

Conversation

@kardarra-amd

@kardarra-amd kardarra-amd commented Aug 6, 2026

Copy link
Copy Markdown

No description provided.

## Summary

Fixes a ~15% performance regression in Laghos cube_922_hex benchmark on
4-GPU MI300A systems introduced in commit fb484f3. The regression was
caused by premature staging buffer flushes in `WriteBufferBatch` and
`ReadBufferBatch` that created artificial synchronization points.

### Root cause

Commit fb484f3 ("Add batched version of writeBuffer and readBuffer")
introduced staging buffer size checks that would flush accumulated batch
operations before they exceeded `StagingXferSize`. While intended to
prevent resource exhaustion, these checks created unnecessary sync points:

- Each flush forces all queued copies to complete before continuing
- In MPI-heavy workloads with `--no-gpu-aware-mpi`, this creates a
  GPU→Host→MPI→Host→GPU data transfer pattern that gets serialized
- The CG (H1) kernel time increased from 1.287s to 1.551s (+20.5%)

The staging pool already handles rotation naturally, and `getBuffer()`
will handle resource exhaustion if needed. The premature flush checks
were overly conservative.

### Fix

Remove the premature flush checks in both `WriteBufferBatch` and
`ReadBufferBatch`. Operations now accumulate and flush only at the end
of the full batch, matching the behavior of the original non-batch
`writeBuffer()` and `readBuffer()` paths.

## Test Results

**Before fix (commit fb484f3, TheRock nightly 7.15.0-20260707):**
- 4-GPU Laghos FOM: 3821.02 Mdofs*timestep/sec
- CG (H1) time: 1.551s

**After fix (with library swap validation):**
- 4-GPU Laghos FOM: 4554.13 Mdofs*timestep/sec (+19.2%)
- CG (H1) time: 1.287s (restored to pre-regression level)

**Test command:**
```
mpirun -np 4 ./laghos -pa -p 1 -tf 0.6 -m data/cube_922_hex.mesh \
  --ode-solver 7 --max-steps 4 --cg-tol 0 --cg-max-steps 50 \
  -ok 3 -ot 2 -rs 3 -rp 1 -d hip -f -pt 221 --no-gpu-aware-mpi
```

**Impact:**
- 1-GPU and 2-GPU configurations: unaffected (no MPI communication overhead)
- 4-GPU configuration: regression scales with MPI rank count
- Fix verified on MI300A gfx942 hardware

## Related Issues

Regression reported in TheRock nightly performance tracking between
7.15.0-20260706 (good) and 7.15.0-20260707 (bad).
@kardarra-amd
kardarra-amd requested a review from a team as a code owner August 6, 2026 00:36
@therock-pr-bot

therock-pr-bot Bot commented Aug 6, 2026

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/clr/rocclr/device/rocm/rocblit.cpp; 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

therock-pr-bot Bot commented Aug 6, 2026

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.

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

!

@kardarra-amd
kardarra-amd deleted the users/kardarra/fix-laghos-batch-copy-regression branch August 6, 2026 19:18
@kardarra-amd
kardarra-amd restored the users/kardarra/fix-laghos-batch-copy-regression branch August 6, 2026 20:31
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.

2 participants