[Core] DSpark brick 4c: full block-8 draft composition + exact oracle parity
- k_dspark_split3: split fused qkv [B,5120] -> q/k/v and gate_up [B,18432] -> g/u. - dspark_draft(): the complete Step-1 linear draft — block [8,D] (slot0 = rms(embed(anchor)), rest mask_embed) -> 3 non-causal block-attn layers (fused qkv GEMM + per-head norm/NeoX-RoPE + block_attn over committed bf16 ctx ring + all B draft slots + o_proj) + SwiGLU MLP -> final norm -> 7-step recurrent Markov head (joint=[state;markov_w1[prev];cur[step];context], rnn GEMV, GRU, corr/combine, unembed argmax). f32 activations x bf16 weights throughout. - Parity: full draft vs a complete CPU oracle on REAL mtp weights + synthetic trunk/ctx -> 7 token ids EXACT ([158,104,158,104,158,158,158]). hip 43/43; ld GPU 56/56; CPU -D warnings green.
This commit is contained in:
1 parent
142580e9ca
commit
f9cde4954a
3 files changed
+303
-1
No files matched your search
@@ -65,6 +65,10 @@ mod ffi {
|
||||
cur: *const c_float, corr: *const c_float, bias: *const c_float,
|
||||
out: *mut c_float, d: c_int, stream: *mut c_void,
|
||||
) -> c_int;
|
||||
pub fn vetta_dspark_split3(
|
||||
inp: *const c_float, a: *mut c_float, b: *mut c_float, c: *mut c_float,
|
||||
bb: c_int, na: c_int, nb: c_int, nc: c_int, stream: *mut c_void,
|
||||
) -> c_int;
|
||||
pub fn vetta_embed_bf16_gather(
|
||||
table: *const u16, tokens: *const i32, out: *mut c_float,
|
||||
b: c_int, d: c_int, vocab: c_int, stream: *mut c_void,
|
||||
@@ -503,6 +507,17 @@ pub fn dspark_corr_combine(cur: &DeviceBuf, corr: &DeviceBuf, bias: &DeviceBuf,
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Split fused [B,na+nb+nc] into contiguous a[B,na], b[B,nb], c[B,nc] (c None
|
||||
/// when nc==0). For fused qkv (3072/1024/1024) and gate_up (inter/inter/0).
|
||||
#[cfg(feature = "hip")]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn dspark_split3(inp: &DeviceBuf, a: &DeviceBuf, b: &DeviceBuf, c: Option<&DeviceBuf>, bb: i32, na: i32, nb: i32, nc: i32) -> Result<(), String> {
|
||||
let cp = c.map(|x| x.ptr as *mut f32).unwrap_or(std::ptr::null_mut());
|
||||
let rc = unsafe { ffi::vetta_dspark_split3(inp.ptr as *const f32, a.ptr as *mut f32, b.ptr as *mut f32, cp, bb, na, nb, nc, std::ptr::null_mut()) };
|
||||
if rc != 0 { return Err("dspark_split3 launch failed".into()); }
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Launch k_embed_bf16_gather: `b` token rows from BF16 table `[vocab, d]` → f32.
|
||||
#[cfg(feature = "hip")]
|
||||
pub fn embed_bf16_gather(table: &DeviceBuf, tokens: &DeviceBuf, out: &DeviceBuf, b: i32, d: i32, vocab: i32) -> Result<(), String> {
|
||||
|
||||
Reference in new issue
Block a user