Skip to content

Satisfy debug-layer buffer validation - #39

Merged
antirez merged 1 commit into
antirez:mainfrom
mitsuhiko:fix-metal-debug
May 9, 2026
Merged

Satisfy debug-layer buffer validation#39
antirez merged 1 commit into
antirez:mainfrom
mitsuhiko:fix-metal-debug

Conversation

@mitsuhiko

Copy link
Copy Markdown
Contributor

This PR allows you to run ds4 with MTL_DEBUG_LAYER=1. Without this I got a failure like so:

validateComputeFunctionArguments:1066: failed assertion `Compute Function(kernel_set_rows_f32_i32): Read-only bytes are being bound at index 2 to a shader argument with write access enabled (did you mean to use const or constant in the shader?).'
[1]    8708 abort      MTL_DEBUG_LAYER=1 ./ds4 -p "What's the capital of France"

Use typed char pointers for get_rows/set_rows sources so Metal reflects read-only access correctly, and bind dummy values for inactive router finalize arguments required by API validation.
@antirez

antirez commented May 9, 2026

Copy link
Copy Markdown
Owner

👍

@mitsuhiko
mitsuhiko deleted the fix-metal-debug branch May 9, 2026 21:23
zensh pushed a commit to ldclabs/ds4 that referenced this pull request May 10, 2026
Satisfy debug-layer buffer validation
Entrpi added a commit to Entrpi/ds4 that referenced this pull request May 20, 2026
Entrpi added a commit to Entrpi/ds4 that referenced this pull request May 20, 2026
…tirez#39)

The raw-KV sliding-window attention runs in a 'growing' regime
(window base at row 0) until pos+1 exceeds raw_window, then 'slides'
(raw_start advances 1,2,3...).  decode_scalars (raw_start/n_raw) are
live on graph replay -- verified -- but the captured attention/KV path
bakes a pre-saturation assumption when captured with raw_start==0, so a
growing-regime graph replayed once the window slides produced wrong
output (first divergence at pos=128 == DS4_N_SWA).  Add a
window_sliding bit to the per-layer graph key so the two regimes get
distinct captured graphs; the sliding-regime graph reads raw_start live
so one capture covers all raw_start>0 positions.
Entrpi added a commit to Entrpi/ds4 that referenced this pull request May 20, 2026
…irez#31-antirez#39)

The per-kernel FNV-1a hash-dump subsystem, the emit-chain / router-bias /
decode-scalars / per-warp MMVQ probes, and the SKIP_LAYER0 / SKIP_EMIT /
HASH_DUMP / LGRAPH_PROBE / ROUTER_ARG_PROBE env flags were all scaffolding
built to bisect the captured-vs-eager output divergence; that investigation
is complete so they are removed here.

The three correctness fixes the investigation produced are retained: the
antirez#36 token-stable decode_scalars substrate, the antirez#38 layer-graph-replay
counter advance, and the antirez#39 window_sliding layer-graph key bit.
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.

2 participants