Skip to content

Bind planned streams and codec runs to device addresses - #1251

Closed
mmandina wants to merge 2 commits into
meta:devfrom
mmandina:export-D128343911
Closed

mmandina wants to merge 2 commits into
meta:devfrom
mmandina:export-D128343911

Conversation

@mmandina

@mmandina mmandina commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Summary:
Adds bindDecode, which gives every planned stream and codec run its device address, so the executor can hand each batch to Stream::decodeBatch.

  • A Stored stream uses its address in the frame, read from the chunk's prepared DCtx.
  • A Destination or StreamArena stream uses its arena's base address plus its offset in the layout. Binding gets those addresses from ArenaAddresses, so it does not read the placement format.
  • A StreamRef uses its backing stream's address plus its offset. The planner gives a backing stream a lower index than its aliases, so one pass in stream order resolves a chain of aliases.
  • Each final Stored or StreamRef output gets a terminal copy into the caller's output, in chunk order and then output order.
  • String streams return temporaryLibraryLimitation for now. buildDecodeInfo rejects them, so a decode fails before any allocation.

bindDecode binds the runs of each batch from planDecodeBatches, in the batch's order, and gives each batch a BoundBatch with its kernel and its runs. A run that no batch holds, such as an aliasing run, gets no BoundCodecRun. BoundDecode holds the spans and the arrays they point into, so it is move-only.

viewOf(PreparedGPUChunk&) builds the planner's view of a chunk. decompressChunks and the new testkit::StagedHostFrame both use it, so the tests stage frames exactly as production does, including each chunk's frameIndex.

Reviewed By: Cyan4973

Differential Revision: D128343911

Summary:

`WorkWave` now lists its codec runs in plan order, and `WorkGroup` is gone. `Device::chooseDecodeBatches` groups the runs of a wave by kernel, and each kernel serves one transform, so the device decides every grouping. The schedule decides only which runs can start together, and it no longer reads transforms.

Reviewed By: Cyan4973

Differential Revision: D128407138
Summary:
Adds `bindDecode`, which gives every planned stream and codec run its device address, so the executor can hand each batch to `Stream::decodeBatch`.

- A `Stored` stream uses its address in the frame, read from the chunk's prepared DCtx.
- A `Destination` or `StreamArena` stream uses its arena's base address plus its offset in the layout. Binding gets those addresses from `ArenaAddresses`, so it does not read the placement format.
- A `StreamRef` uses its backing stream's address plus its offset. The planner gives a backing stream a lower index than its aliases, so one pass in stream order resolves a chain of aliases.
- Each final `Stored` or `StreamRef` output gets a terminal copy into the caller's output, in chunk order and then output order.
- String streams return `temporaryLibraryLimitation` for now. `buildDecodeInfo` rejects them, so a decode fails before any allocation.

`bindDecode` binds the runs of each batch from `planDecodeBatches`, in the batch's order, and gives each batch a `BoundBatch` with its kernel and its runs. A run that no batch holds, such as an aliasing run, gets no `BoundCodecRun`. `BoundDecode` holds the spans and the arrays they point into, so it is move-only.

`viewOf(PreparedGPUChunk&)` builds the planner's view of a chunk. `decompressChunks` and the new `testkit::StagedHostFrame` both use it, so the tests stage frames exactly as production does, including each chunk's `frameIndex`.

Reviewed By: Cyan4973

Differential Revision: D128343911
@meta-cla meta-cla Bot added the cla signed label Nov 2, 2026
@meta-codesync

meta-codesync Bot commented Nov 2, 2026

Copy link
Copy Markdown

@mmandina has exported this pull request. If you are a Meta employee, you can view the originating Diff in D128343911.

@meta-codesync

meta-codesync Bot commented Nov 2, 2026

Copy link
Copy Markdown

This pull request has been merged in 516c546.

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.

1 participant