Skip to content

feat(gpu): typed dependency graph and nonempty fluid/ocean Metal+WGSL kernels (#812) - #1407

Merged
godofecht merged 2 commits into
mainfrom
feat/812-typed-graph-rebased
Oct 7, 2026
Merged

godofecht merged 2 commits into
mainfrom
feat/812-typed-graph-rebased

Conversation

@godofecht

@godofecht godofecht commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Part of #812. Does not close it. Rebuilds the GPU graph work of the closed #1385 on current main, without its FFI changes (those landed in #1352).

Change

  • lib/stdlib/gpu_graph.flow: a typed resource and pass graph with storage buffers and textures, explicit access, transient lifetimes, ping-pong resources, compute and render passes. Validation covers conflicting slots, same-pass read/write hazards, transient-before-write, ping-pong aliasing, overflowing launch sizes, workgroup memory and barrier prerequisites, and formats and byte sizes. Dependency derivation fails at its 32-edge capacity instead of truncating.
  • lib/stdlib/gpu_graph_kernels.flow: WGSL and Metal bodies for the fluid passes (advect, curl, vorticity, divergence, pressure, projection, dye, display) and the ocean passes (synthetic spectrum, 64-point inverse DFT on rows and columns, displacement, normals, foam, present). Unknown kernels emit nothing.
  • lib/stdlib/gpu_graph_export.flow and gpu-graph-host.mjs: a JSON export and a WebGPU host, runFlowWebGpuGraph, that submits the passes in dependency order.
  • docs/library/gpu-graph.md, examples fluid.flow, fft_ocean.flow and the two export programs.

Changed in this rebase:

These are generated kernels and a host. Nothing here compiles them on Metal or compares rendered output with vgpu references.

Evidence

Rebased onto main e2205a7.

  • ./flow test-lang 275/0, including test_gpu_graph.
  • ./flow run of fluid.flow, fft_ocean.flow and export_fluid_graph.flow: exit 0.
  • node --test tests/webgpu/graph-host.test.mjs: 4/4 (mocked device; feat(webgpu): execute chained Flow kernels over persistent device resources (#814) #1408's webgpu_hosts.flow runs it once both land).
  • gen_stdlib_docs --check, doc_coverage, wiki_nav, doc_links: clean. ./flow tool tests/tools/lsp/run.flow: 9/9.
  • ./flow test-runtime 34/0. ./flow tool tests/cli/run.flow 152 passed, 2 failed (jit_hello, test_mlir: golden drift on main).

A real-device run was tried in Deno (Metal backend). The host requires the readonly_and_readwrite_storage_textures WGSL feature, and Deno 2.7 does not expose wgslLanguageFeatures, so the graph host could not run there. It needs a browser with that feature.

Merge notes

@godofecht
godofecht force-pushed the feat/812-typed-graph-rebased branch from 1aeec4e to 9b3c4c3 Compare October 7, 2026 13:38
@godofecht
godofecht marked this pull request as ready for review October 7, 2026 13:39
godofecht added a commit that referenced this pull request Oct 7, 2026
…odules

gpu_stage_codegen reassigned immutable lets (components, uv_type,
tex_type, uv_expr), so the strict check failed and ./flow test-lang had
never run test_gpu_stage_codegen. They are now let mut, and the struct
fields carry commas like the rest of the stdlib. Added coverage, nav and
stdlib-map entries for gpu_resource_types and gpu_stage_codegen,
regenerated stdlib-api.md and the LSP completion golden. Two comments
reworded for the prose hook (string.flow matches #1401, #1406, #1407).
@godofecht
godofecht added this pull request to the merge queue Oct 7, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 7, 2026
…WGSL kernels (#812)

Rebuilt on main 8712405 as one commit. Conflicts resolved per hunk:
both webgpu-host.js copies keep the #1408 kernel-chain export and the
graph-host export; string.flow keeps main's comment wording. stdlib-api.md
and the LSP completion golden were regenerated.
…st.js (#812)

webgpu-host.js re-exports runFlowWebGpuGraph from ./gpu-graph-host.mjs, and the crossing builder from #1408 copies every re-exported module, so the seven gpu pages now write gpu-graph-host.mjs and the new host.
@godofecht
godofecht force-pushed the feat/812-typed-graph-rebased branch from 9b3c4c3 to 12881de Compare October 7, 2026 22:45
@godofecht
godofecht enabled auto-merge October 7, 2026 22:45
@godofecht
godofecht added this pull request to the merge queue Oct 7, 2026
Merged via the queue into main with commit ab9fc5f Oct 7, 2026
28 checks passed
@godofecht
godofecht deleted the feat/812-typed-graph-rebased branch October 12, 2026 23:02
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.

1 participant