Repository navigation
feat(gpu): real Metal tensor model kernels on current main (#814) - #1406
Merged
Merged
Conversation
This was referenced Oct 6, 2026
godofecht
force-pushed
the
feat/814-real-metal-tensor-rebased
branch
from
October 7, 2026 12:48
b33f188 to
205c80a
Compare
godofecht
marked this pull request as ready for review
October 7, 2026 12:49
7 of 8 tasks
godofecht
added a commit
that referenced
this pull request
Oct 7, 2026
gpu_graph and gpu_tensor (#1406) both exported GPU_ACCESS_READ, _WRITE and _READ_WRITE, and a program cannot import two modules that export the same const. The graph constants are now GPU_GRAPH_ACCESS_*. Added coverage, nav and stdlib-map entries for gpu_graph, gpu_graph_export and gpu_graph_kernels, regenerated stdlib-api.md and the LSP completion golden, and rewrote the Backends section of gpu-graph.md plainly. Prose fixes the commit hook asked for in gpu-graph.md, gpu_graph_kernels.flow and one string.flow comment (the same edit as #1401 and #1406).
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
enabled auto-merge
October 7, 2026 17:03
godofecht
force-pushed
the
feat/814-real-metal-tensor-rebased
branch
from
October 8, 2026 00:48
50ffef8 to
5feb996
Compare
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Oct 8, 2026
Native Metal tensor compute over shared GPU resources, typed allocation and kernel-count guards, fail-closed Metal error semantics, rejection of overlapping GEMM output, gpu_tensor docs and index entries, and the gpu_tensor and gpu_model tests wired into flow ml test.
…#814) The Linux runner reports 'CASE mnist [metal] UNSUPPORTED w=- ... reason=device-execution', so the check for 'UNSUPPORTED reason=device-execution' as one string failed in the Native tools job.
…814) flow ml test now runs both, so tests/mlir_commands ml_test differed by those two lines in the goldens job.
godofecht
enabled auto-merge
October 8, 2026 02:52
godofecht
force-pushed
the
feat/814-real-metal-tensor-rebased
branch
from
October 8, 2026 02:52
2bc63b4 to
874546b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #814. Does not close it. This is the older #1364 branch rebased onto current main, without replacing the existing vgpu conformance runner.
Change
lib/stdlib/gpu_tensor.flow: shaped, typed tensor views overGpuBufferwith shape, dtype and access checks, overflow-checked dimensions, shared-storage views and explicit host and private-buffer transfers.runtime/gpu_metal.m: Metal compute kernelsscale_bias_f32,relu_f32,invert_clamp01_f32andgemm_f32, with element-count and capacity checks before any uint32 conversion, GEMM output aliasing refused, and a counter of completed device dispatches. The non-Apple stub returns -1.lib/stdlib/gpu_memory.flow: externs for the model kernels andgpu_model_dispatch_count. The allocation, copy and f32 kernel guards landed in fix(gpu): reject oversized transfers and f32 kernel counts before the backend (#814) #1403.examples/gpu/vgpu/mnist.flowanddepth_estimation.flowrun a small deterministic model on the GPU path and compare it with a hostTensorreference. They printGPU_DEVICE_EXECUTED metalonly after a Metal command buffer completes.tools/gpu_test: themnistanddepthcases reportNUMERICALon Metal only when the reference matches and the device marker is present.Added in the rebases:
docs/library/stdlib-api.mdand the LSP completion golden regenerated on current main; nav, coverage and stdlib-map entries forgpu_tensornext to the #1405 and #1407 entries;test_gpu_tensorandtest_gpu_modellisted inflow ml test.Added for the merge queue, which runs gates the PR job skips:
tests/gpu/expected/examples_gpu_vgpu_{mnist,depth_estimation}_flow_{metal,wgsl}: the examples now have one kernel per stage, sotests/gpu/run.flowfailed 4 cases. Recorded from the Flow tool withGPU_GATE_SAVE; 40/0.compiler/fixtures/mlir/corpus.txt:parity_mlir --record, keeping only the rows this PR changes (gpu_memory, its stub, the mnist and depth examples, the memory bounds test) and the new gpu_tensor module and tests.The examples are fixed-shape models. They do not classify the MNIST test set or run a trained depth network.
Evidence
On main 0b73094, macOS arm64 with a Metal device.
./flow run examples/gpu/vgpu/mnist.flow:GPU_DEVICE_EXECUTED metal,match 1.depth_estimation.flow:GPU_DEVICE_EXECUTED metal,match 1../flow gpu test --suite vgpu --all-backends: gradient EXACT on both backends; mnist and depthNUMERICALon metal (metal-device-dispatch),UNSUPPORTEDon webgpu../flow ml test,./flow test-gpu: pass../flow test-scripts gpu_tensor gpu_vgpu: all passed.parity_mlirPASS,tests/gpu/run.flow40/0,tests/gpu/crossing.flow16/0.gen_stdlib_docs --check,doc_coverage,doc_links,wiki_nav: clean. LSP transcripts 9/9../flow test-lang,./flow test-runtime: all pass.Merge notes
runtime/gpu_metal.mbounds check was reconciled with fix(gpu): reject oversized transfers and f32 kernel counts before the backend (#814) #1403: it keeps this PR's comment and callsflow_gpu_f32_launch_fitsbefore compute init.