Skip to content

[ESI][BSP] Support multiple outstanding reads in HostMemReadReqSplitter - #11282

Merged
teqdruid merged 1 commit into
mainfrom
dev/teqdruid/esi/hostmem-multi-outstanding-reads
Oct 13, 2026
Merged

teqdruid merged 1 commit into
mainfrom
dev/teqdruid/esi/hostmem-multi-outstanding-reads

Conversation

@teqdruid

@teqdruid teqdruid commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

HostMemReadReqSplitter accepted one logical read request and refused the next until every response word of the current one had drained. That caps each read client at one request per host round trip.

This adds an optional max_outstanding parameter (default 1, unchanged behavior).

How it works

  • Each accepted request's {word count - 1, final-word valid bytes, single-word} goes into a metadata FIFO of depth max_outstanding.
  • The response framer loads each burst's metadata into registers from the FIFO head, and re-derives last / valid_bytes from them.
  • A request accepted while the FIFO is empty and the framer is idle loads directly, so no latency is added.
  • The upstream must return each splitter's response words in request order. Tags still pass through untouched.

Throughput and timing

  • A single-chunk request can be accepted every cycle: the next request is accepted in the cycle the previous one issues its final chunk.
  • Responses flow one word per cycle with no bubble between bursts.
  • There is no combinational path from resp_in to req_in ready; the in-flight limit is a registered flag.
  • resp_in ready is left ungated, because esi.TaggedDemux ANDs every output's ready.
  • The final-chunk test is registered, and the address/length advance by a constant chunk. Datapath registers are not reset.

Plumbing

  • HostmemReadProcessor and ChannelHostMem take max_outstanding_reads (default 1).
  • CosimBSP / CosimBSP_DMA take it too and default to 4. The cosim host answers reads in order, and this keeps the multi-outstanding path exercised by every cosim test.

Why: on a PCIe-attached Agilex 7 FPGA at 400 MHz, a 256 B read takes ~1 µs to return, so one outstanding read per client limits small reads to about 0.25 GB/s. With 64 outstanding, the same clients reach:

  • about 1.7 GB/s for 32 B requests, vs ~34 MB/s;
  • the 7.1 GB/s link limit for 256 B requests, vs ~0.25 GB/s.

Large single reads, which already overlapped their chunks, are unchanged.

Tests

  • IR generation tests for 64/256-bit words and max_outstanding 1/2/64.
  • A check that max_outstanding=0 is rejected.
  • A cosim test (test_hostmem_read.py, folded in from [ESI][Runtime] Cosim test for multiple outstanding HostMem reads #11284; uses HostMem.start() from [ESI][Runtime] Expose HostMem.start() to Python #11283) with one host-driven read_list client per element width: 24, 32 and 96 bits (3-, 4- and 12-byte strides over the 8-byte cosim host memory word). It runs with max_outstanding_reads 1 and 4. For each width, it:
    1. closes the client's response gate and queues several reads of varied lengths;
    2. checks that exactly min(#reads, N) are accepted while nothing drains, so that many logical requests are genuinely in flight inside the splitter;
    3. opens the gate and checks every returned element, the per-request element counts, and that last lands exactly on each request's final element;
    4. streams short reads back to back and checks them the same way.

Assisted-by: GHCP:Claude Opus 5.5

`HostMemReadReqSplitter` accepted one logical read request and refused the
next until every response word of the current one had drained, capping each
read client at one request per host round trip.

Add an optional `max_outstanding` parameter (default 1, unchanged behavior).
Each accepted request's {word count - 1, final-word valid bytes, single-word}
is queued in a metadata FIFO of that depth; the response framer loads each
burst's metadata into registers from the FIFO head (or directly from a request
accepted while the FIFO is empty and the framer idle, so no latency is added)
and re-derives `last` / `valid_bytes` from them. Requires the upstream to
return each splitter's response words in request order; tags still pass
through untouched.

- A single-chunk request can be accepted every cycle (the next request is
  accepted in the cycle the previous one issues its final chunk); responses
  flow one word per cycle with no bubble between bursts.
- No combinational path from `resp_in` to `req_in` ready: the in-flight limit
  is a registered flag. `resp_in` ready is left ungated, since
  `esi.TaggedDemux` ANDs every output's ready.
- The final-chunk test is registered and the address/length advance by a
  constant chunk; datapath registers are not reset.

Plumb the limit through `HostmemReadProcessor` and `ChannelHostMem` as
`max_outstanding_reads` (default 1). `CosimBSP`/`CosimBSP_DMA` take it too and
default to 4: the cosim host answers reads in order, and it keeps the feature
exercised by every cosim test.

Tests:
- IR-only generation tests for widths 64/256 and max_outstanding 1/2/64, and
  a check that max_outstanding=0 is rejected.
- A cosim test (`test_hostmem_read.py`) with one host-driven `read_list`
  client per element width (24, 32, 96 bits), run with max_outstanding_reads
  1 and 4. It stalls the response side, checks that exactly min(#reads, N)
  requests are held in flight, then checks data, per-request element counts
  and `last` placement, and streams short reads back to back.

Co-authored-by: Copilot <[email protected]>
@teqdruid
teqdruid force-pushed the dev/teqdruid/esi/hostmem-multi-outstanding-reads branch from be4a633 to 65efea6 Compare October 13, 2026 20:40
@circt-bot

circt-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown

Results of circt-tests run for 65efea6 compared to results for a034e7d: no change to test results.

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.

🔵 Needs a closer look

The stateful hardware flow-control and ordering changes warrant final human review despite comprehensive test coverage.

0 open findings

What changed in this PR

Adds configurable multi-outstanding HostMem reads while preserving ordered response framing.

Changes:

  • Adds metadata FIFO and in-flight tracking to the read splitter.
  • Plumbs configurable limits through HostMem and cosim BSP APIs.
  • Adds generation and cosimulation coverage across widths and limits.
File Description
lib/​Dialect/​ESI/​runtime/​python/​esiaccel/​bsp/​common.py Implements multi-request splitting and response framing.
lib/​Dialect/​ESI/​runtime/​python/​esiaccel/​bsp/​cosim.py Configures cosim for multiple outstanding reads.
lib/​Dialect/​ESI/​runtime/​tests/​unit/​test_bsp_common.py Tests generation and invalid limits.
lib/​Dialect/​ESI/​runtime/​tests/​integration/​hw/​hostmem_read.py Defines the cosim test hardware.
lib/​Dialect/​ESI/​runtime/​tests/​integration/​test_hostmem_read.py Validates concurrency, data, and burst framing.
lib/​Dialect/​ESI/​runtime/​CHANGELOG.md Documents the feature and ordering requirement.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@teqdruid
teqdruid merged commit 24108c8 into main Oct 13, 2026
10 checks passed
@teqdruid
teqdruid deleted the dev/teqdruid/esi/hostmem-multi-outstanding-reads branch October 13, 2026 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants