Repository navigation
Conversation
…cks (#812) Add a backend-independent GPU pass graph in stdlib/gpu_graph.flow: storage buffers/textures, ping-pong and transient resources, dispatch dimensions, workgroup memory/barriers, and pre-codegen hazard checks. Pass dependencies are derived from typed resource access. The same graph emits Metal and WGSL. Fluid and FFT-ocean vgpu families are expressed as Flow graphs. Sampled textures, samplers and geometry types are left to #811. Co-authored-by: Abhishek Shivakumar <[email protected]>
|
Fixed the two CI blockers from run #2814 directly on this branch: registered |
Closes #812 Builds on and supersedes #1362. Co-authored-by: godofecht <[email protected]>
|
Duplicate of draft #1407, which continues the same lib/stdlib/gpu_graph.flow API (identical resource, access, lifetime, pass and error constants) with extra validation (GPU_GRAPH_ERR_INVALID_RESOURCE, launch-size overflow checks), kernels, WGSL export and a host adapter. #1407 is the live #812 graph PR. Docs pieces from this branch that #1407 does not carry are noted for folding there: docs/book/15-media-gpu-and-audio.md, the LANGUAGE_SPEC.md and spec-index.md rows, docs/library/stdlib-api.md entries, docs/coverage.json and tests/tools/lsp/completion.expected. Closing during PR triage; the branch is kept. |
Intent
Linked issue or roadmap item: #812 ([gpu] typed render/compute graph with storage textures and hazard checks). Design context:
docs/project/vgpu-parity.mdP2.What changed, and why is this the smallest useful change?
The vgpu-parity Resource IR is now a Flow library (
lib/stdlib/gpu_graph.flow) rather than new syntax. A sibling session owns #811 (sampled textures, samplers, geometry, vertex/fragment stages); this PR does not define those types. Storage textures appear here only as graph descriptors (kind, format tag, read/write usage, lifetime) so hazards can be checked.gpu frame { ... }stays parse-only.Overlap check
Overlap / dependency notes:
No open PR implements #812. #811 is in flight in a sibling session; this graph binds resources by integer id so those types can plug in later. Open PRs on this repo (#1348, #1346, #1345, affine/codegen work) do not touch the GPU graph surface.
Evidence
Baseline before this change:
gpu frameparsed but did not lower. No storage-texture / ping-pong / hazard API on main. vgpu fluid and FFT-ocean cases did not exist.Targeted proof that exercises the changed behaviour:
./flow test-lang tests/lang/test_gpu_graph.flow— pass (hazards, aliases, derived deps, workgroup/barrier limits, fluid + FFT-ocean graphs, Metal and WGSL emit from one graph)./flow run examples/gpu/vgpu/fluid.flow— exit 0; prints Metal and WGSL for advect + display./flow run examples/gpu/vgpu/fft_ocean.flow— exit 0; prints Metal and WGSL for IFFT + presentWhy that proof would detect the old failure or regression:
The lang test asserts same-pass R/W is
GPU_GRAPH_ERR_SAME_PASS_RWunless feedback is set, conflicting slots fail, ping-pong of one physical id is refused, transients cannot be read before write, and both backend emitters contain the storage-texture / storage-buffer declarations. Those checks fail on a graph that skips validation or only has one backend.Repository gate(s) run:
./flow test-lang tests/lang/test_gpu_graph.flow./flow run examples/gpu/vgpu/fluid.flow./flow run examples/gpu/vgpu/fft_ocean.flow./flow tool gen_stdlib_docs(stdlib-api.md refreshed)./flow tool wiki_nav --problems(exit 0)Generated/bootstrap state, if any:
No
compiler/srcchanges; bootstrap C not regenerated.Risk
Compatibility, performance, security, lifetime, backend, or release implications:
Additive stdlib module. No existing API or codegen path changes. Emitters produce skeleton pass modules (bindings + empty entries), not full fluid/FFT kernel math. Device dispatch is unchanged.
docs/project/Questions.mdupdated if this needs a language-design decision.Compatibility
docs/project/CHANGELOG.md.CHANGELOG records the addition under Unreleased.
Agent handoff
Agent/provider/session, when applicable: Cursor cloud agent, issue #812.
Any remaining blocker is recorded in GitHub rather than only in local/session state:
Part of #812. Remaining gaps:
flow gpu test --suite vgpuharness; no storage-texture runtime on this path yet)gpu frame { }hook onto this IRDo not merge.