Honor DSpark Markov scratch row pitches and exercise device oracles

Index Markov scratch by the padded row stride, not a packed width, and
cover the walk plus shared-anchor attention on device.
This commit is contained in:
Constantin committed 2026-11-03 13:56:46 -05:00
1 parent 340ff8781a
commit 445bf8e0d9
5 files changed
+229 -26

No files matched your search

+9 -4
View File
@@ -3366,10 +3366,15 @@ candidates, and what enters the head from the trunk.
|---|---|---|
| `dflash_markov_greedy` | `M` `steps` `rank` `n_vocab` `anchor_stride`/opt `dtype` | `logits`, `anchor`, `pred`w, `succ`w → `tile_scores`, `tile_tokens`, `tokens` |
`dflash_markov_greedy` is the exact DSpark reference walk, not DFlash2's candidate-lattice selector.
For every position it adds `sum_r pred[previous,r] * succ[token,r]` to every vocabulary logit,
chooses the greatest biased score (ties to the lower token id), and uses that id as the next
predecessor. The explicit tile outputs are scratch for the device's vocabulary-wide reduction.
`dflash_markov_greedy` implements the DSpark full-vocabulary greedy walk, not DFlash2's
candidate-lattice selector. For every position it adds `sum_r pred[previous,r] * succ[token,r]`
to every vocabulary logit, chooses the greatest biased score (ties to the lower token id), and
uses that id as the next predecessor. The explicit tile outputs are scratch for the device's
vocabulary-wide reduction; their row pitches may differ. The current graph passes BF16 base logits,
whereas the pinned llama.cpp reference uses F32 logits, and the reduction orders also differ.
Its CPU argmax chooses the last equal maximum; its GPU reduction uses a backend-specific order.
This op's lower-id tie rule is not a claim of reference tie equivalence. Near-tie proposal
equivalence is therefore not established.
### DFlash2