Commit Graph
7 Commits
Author SHA1 Message Date
elforeign eb85731d5d metal: retire command buffers on completion (#135) (#301)
* metal: time each host stage of a compute dispatch

The Apple M5 benchmark shows ~215 us host wall per translated dispatch
against ~1.4 us of GPU time, with ~170 us unexplained around submission.
Record buffer allocation, encoding, commit, waitUntilCompleted and
readback in RunProfile and export them, with the remainder, in the
benchmark's results.json and a new report table, so the cost can be
attributed before changing command-buffer retirement (#135).

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>

* metal: retire command buffers on completion (#135)

Every compute dispatch committed and then blocked in waitUntilCompleted,
which the stage timers show is ~94% of the host time not spent compiling
(launch ~78 us and wake ~58 us around ~7 us of GPU work on an M5 Pro).
A caller with several dispatches paid that round trip for each one.

Add submit_words, which commits without blocking and returns a
Submission token, and wait, which collects the result. Command buffers
now use unretained references: an in-flight table owns the pipeline,
buffers, textures and sampler until Metal reports the buffer Completed
or Error. A sweep on every submit and wait then frees those resources,
keeping the result for a live token and discarding it for a dropped
one. At most 16 submissions hold GPU resources; the next submit
returns an in-flight limit error instead of blocking. The existing
synchronous calls run as submit plus wait and keep their results and
error names. The benchmark adds a batched row: 8 dispatches with one
wait each versus 8 synchronous runs.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>

---------

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 08:26:36 -06:00
Ranveer Soni 3133d8eddc docs: overhaul project documentation and maintenance checks
Signed-off-by: Ranveer Soni <git@ranveersoni.me>
2026-11-23 11:08:43 +05:30
Ranveer Soni 6ccb23da1d feat: implement native guest execution and Metal rendering pipeline 2026-11-23 10:43:49 +05:30
Ranveer Soni aff46b0904 test: add native semantic mutation campaign 2026-11-22 18:31:17 +05:30
Ranveer Soni 79df1194eb test: expand Phase 01 validation and benchmark evidence 2026-11-22 16:46:21 +05:30
Ranveer Soni 622d57272a feat: record power source and thermal state in benchmark metadata
A timing run is only protocol-compliant on AC power with the thermal state
noted. Capture both so a battery run can never be mistaken for release
evidence, and add an explicit protocol note to the report when the host is
not on AC power.

Signed-off-by: Ranveer Soni <git@ranveersoni.me>
2026-11-22 14:25:06 +05:30
Ranveer Soni 90e984dc77 feat: add correctness-gated benchmark harness and a second interpreter
Add a manifest-driven benchmark binary that verifies each fixture against
the independent reference and the GPU before timing it, reports per-stage
CPU and GPU durations with medians and quartiles, and writes metadata,
raw JSON and a markdown report. Extend the Metal backend with a profiled
execution path that reads command-buffer GPU start and end times.

Add a structurally independent second interpreter for the demo subset in
the semantic-review suite. It imports neither the decoder, ISA nor
reference and re-derives the encodings from the RDNA 2 field layout. A
differential test compares both interpreters across all three fixtures on
boundary-dense and pseudorandom inputs.

Signed-off-by: Ranveer Soni <git@ranveersoni.me>
2026-11-22 14:20:32 +05:30