Skip to content

Fix demux R channel backpressure#37

Open
phsauter wants to merge 2 commits into
mainfrom
phsauter/rready-fix
Open

Fix demux R channel backpressure#37
phsauter wants to merge 2 commits into
mainfrom
phsauter/rready-fix

Conversation

@phsauter
Copy link
Copy Markdown
Contributor

@phsauter phsauter commented May 28, 2026

When rready is used, obi_demux could expose a downstream response directly to the upstream manager and then let it change while the manager was stalled (rready is not there but demux moves on).
Add a one-entry response hold stage so stalled R-channel payload remains stable until accepted.

@phsauter phsauter requested a review from micprog May 28, 2026 21:43
@micprog
Copy link
Copy Markdown
Member

micprog commented May 28, 2026

Nice catch! I'm wondering if it would make more sense to stall the request that changes the select_q instead of buffering the full response inside the demux - the same performance could be achieved then by adding a cut module or a module based on a fall-through reg, enabling flexibility and tighter area overhead control.

@phsauter
Copy link
Copy Markdown
Contributor Author

I felt like I was missing some better way to do it, yeah I think I agree, your proposal is better. I will change it accordingly.

@phsauter phsauter force-pushed the phsauter/rready-fix branch from e17fa4c to a4833cc Compare May 31, 2026 16:36
@phsauter
Copy link
Copy Markdown
Contributor Author

phsauter commented May 31, 2026

OUTDATED

Your proposal alone did not fix the bug, so I started again from the spec:
OBI UseRReady makes the R channel a valid/ready handshaked channel.
Once a response phase is active, rvalid and the response payload must remain stable while rvalid && !rready, and the response must only retire once the rvalid && rready transfer completes.
So we must keep routing state stable during a stalled R phase.

MUX:
The mux now tracks the active response owner. While a response is stalled, it keeps routing rvalid/r to that same subordinate port and derives upstream rready from that owner.
The owners FIFO is only popped on rvalid && rready, so the next response owner cannot be selected before the current response transfer completes.

DEMUX:
The demux now tracks the active response source when UseRReady is enabled.
While a response is stalled, it keeps the upstream response selected from that same manager port and blocks switching requests to a different manager source until the stalled response phase completes. (basically what you suggested)
The in-flight counter retires responses only on rvalid && rready.

This adds state per port on both mux and demux. Its not insignificant but I was not able to find a better solution that guarantees compliance without tanking performance.

phsauter added 2 commits June 3, 2026 16:42
The mux could let the response route and upstream rready disagree while a destination R phase was backpressured. Derive rready from the existing response FIFO head so UseRReady keeps response payloads stable without adding owner state or buffering the payload.
The demux could change its selected response source while the upstream R phase was stalled. Keep routing responses through the existing selected source and block source changes until the response phase completes so the upstream response remains stable.
@phsauter phsauter force-pushed the phsauter/rready-fix branch from a4833cc to 517ae25 Compare June 3, 2026 14:46
@phsauter
Copy link
Copy Markdown
Contributor Author

phsauter commented Jun 3, 2026

Turns out if you are not tired this is actually way easier to fix and doesn't cost more state at all.
Thanks on pushing back on my tried and lazy ass ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants