Skip to content

clr: Fix packet batch write logic - #2236

Merged
saleelk merged 1 commit into
developfrom
users/saleelk/bulkpackets
Dec 11, 2025
Merged

saleelk merged 1 commit into
developfrom
users/saleelk/bulkpackets

Conversation

@saleelk

@saleelk saleelk commented Dec 9, 2025

Copy link
Copy Markdown
Contributor
  • When writing bulk packets always invalidate packet headers, Its possible that the CP fetcher can have multiple packets in flight. In such cases we may end up with a malformed packet because the writes are not complete yet CP finds a valid header.

Motivation

Technical Details

JIRA ID

Test Plan

Test Result

Submission Checklist

@saleelk
saleelk requested a review from a team as a code owner December 9, 2025 13:09
Copilot AI review requested due to automatic review settings December 9, 2025 13:09
@saleelk
saleelk requested a review from lmoriche December 9, 2025 13:12

Copilot AI 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.

Pull request overview

This PR fixes a race condition in packet batch write logic where the CP fetcher could read malformed packets. The fix ensures all packet headers are invalidated before writing packet bodies, then validates headers in a specific order to prevent the fetcher from accessing incomplete packets.

  • All packets in a batch now have their headers invalidated before copying to the queue (previously only the first packet)
  • Headers are validated in two stages: inner packets (indices 1 to N-1) first, then the first packet header last to trigger batch execution
  • System scope modifications are now applied to saved header copies rather than modifying packet objects directly

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

* When writing bulk packets always invalidate packet headers, Its
  possible that the CP fetcher can have multiple packets in flight. In
such cases we may end up with a malformed packet because the writes are
not complete yet CP finds a valid header.
@saleelk
saleelk force-pushed the users/saleelk/bulkpackets branch from 11cdb20 to 778f623 Compare December 9, 2025 17:20
@saleelk
saleelk merged commit 1063548 into develop Dec 11, 2025
23 of 24 checks passed
@saleelk
saleelk deleted the users/saleelk/bulkpackets branch December 11, 2025 12:26
systems-assistant Bot pushed a commit to ROCm/clr that referenced this pull request Dec 11, 2025
* When writing bulk packets always invalidate packet headers, Its
  possible that the CP fetcher can have multiple packets in flight. In
such cases we may end up with a malformed packet because the writes are
not complete yet CP finds a valid header.
[rocm-systems] ROCm/rocm-systems#2236 (commit 1063548)
xuchen-amd pushed a commit that referenced this pull request Dec 16, 2025
* When writing bulk packets always invalidate packet headers, Its
  possible that the CP fetcher can have multiple packets in flight. In
such cases we may end up with a malformed packet because the writes are
not complete yet CP finds a valid header.
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