Use F32 draft logits for the DSpark Markov walk

Score the walk on F32 head logits, reject non-I32 anchors in libref, and
assert the real proposal path. Near-tie policy vs the reference is still
open.
This commit is contained in:
Constantin committed 2026-11-03 13:56:46 -05:00
1 parent 445bf8e0d9
commit 9ca20a1fba
14 files changed
+284 -56

No files matched your search

+85 -8
View File
@@ -11,6 +11,7 @@
#include <cstdlib>
#include <cstring>
#include <dlfcn.h>
#include <fstream>
#include <vector>
using Fn = int (*)(const RadArgs*, RadStream);
@@ -31,7 +32,7 @@ static RadParam pi(const char* k, long long v) { RadParam p{}; p.key=k; p.kind=R
static RadParam ps(const char* k, const char* v) { RadParam p{}; p.key=k; p.kind=RAD_P_STR; p.sval=v; return p; }
static Fn symbol(void* h, const char* name) { auto f = reinterpret_cast<Fn>(dlsym(h,name)); check(f != nullptr, name); return f; }
static void markov(Fn fn, int R) {
static void markov(Fn fn, int R, bool f32) {
constexpr int M=2, S=2, V=130, T=3, LP=137, SP=5, TP=7, OP=4;
std::vector<uint16_t> l(M*S*LP,bf(0)), p(V*R,bf(0)), u(V*R,bf(0));
for (int m=0;m<M;++m) for(int v=0;v<16;++v) l[(m*S)*LP+v]=bf(100-v);
@@ -41,8 +42,10 @@ static void markov(Fn fn, int R) {
p[80*R+3]=bf(1); u[101*R+3]=bf(90);
std::vector<int> anchor{1,-1,2,-1}, ti(M*TP,-777), out(M*OP,-777);
std::vector<float> ts(M*SP,-777.f);
Device<uint16_t> dl(l), dp(p), du(u); Device<int> da(anchor), di(ti), dout(out); Device<float> ds(ts);
RadTensor a[]={t(dl.p,RAD_BF16,{M*S,V}),t(da.p,RAD_I32,{M,2}),t(dp.p,RAD_BF16,{V,R}),t(du.p,RAD_BF16,{V,R}),t(ds.p,RAD_F32,{M,T}),t(di.p,RAD_I32,{M,T}),t(dout.p,RAD_I32,{M,S})};
std::vector<float> lf(l.size()); for(size_t i=0;i<l.size();++i) lf[i]=fb(l[i]);
Device<uint16_t> dl(l), dp(p), du(u); Device<int> da(anchor), di(ti), dout(out);
Device<float> ds(ts), dlf(lf);
RadTensor a[]={t(f32 ? (void*)dlf.p : (void*)dl.p,f32 ? RAD_F32 : RAD_BF16,{M*S,V}),t(da.p,RAD_I32,{M,2}),t(dp.p,RAD_BF16,{V,R}),t(du.p,RAD_BF16,{V,R}),t(ds.p,RAD_F32,{M,T}),t(di.p,RAD_I32,{M,T}),t(dout.p,RAD_I32,{M,S})};
a[0].stride[0]=LP; a[4].stride[0]=SP; a[5].stride[0]=TP; a[6].stride[0]=OP;
RadParam par[]={pi("M",M),pi("steps",S),pi("rank",R),pi("n_vocab",V),pi("anchor_stride",2),ps("dtype","bf16")};
RadArgs args{}; args.t=a; args.n_t=7; args.p=par; args.n_p=6;
@@ -73,11 +76,11 @@ static void markov(Fn fn, int R) {
a[4].stride[1]=2; check(fn(&args,nullptr)!=RAD_OK,"reject non-unit scratch inner stride"); a[4].stride[1]=1;
a[5].stride[0]=T-1; check(fn(&args,nullptr)!=RAD_OK,"reject overlapping scratch rows");
a[5].stride[0]=LLONG_MAX; check(fn(&args,nullptr)!=RAD_OK,"reject overflowing scratch span");
std::printf("markov rank=%d padded scores=%d tokens=%d: PASS\n",R,SP,TP);
std::printf("markov logits=%s rank=%d padded scores=%d tokens=%d: PASS\n",f32?"f32":"bf16",R,SP,TP);
}
// A controlled precision counterexample, not a measurement of real checkpoint logits.
static void near_tie(Fn fn) {
static void near_tie(Fn fn, Fn fn_f32) {
constexpr int R=32, V=2;
std::vector<uint16_t> l{bf(1.001f),bf(1.002f)}, w(V*R,bf(0));
std::vector<int> anchor{0}, token{-1}, tile{-1}; std::vector<float> score{-1};
@@ -88,9 +91,39 @@ static void near_tie(Fn fn) {
RadArgs args{}; args.t=a; args.n_t=7; args.p=par; args.n_p=4;
check(fn(&args,nullptr)==RAD_OK,"near tie launch"); hipcheck(hipDeviceSynchronize());
check(dout.get()[0]==0 && 1.002f>1.001f,"BF16/F32 near tie divergence");
std::vector<float> full{1.001f,1.002f}; Device<float> df(full);
a[0]=t(df.p,RAD_F32,{1,V});
check(fn(&args,nullptr)!=RAD_OK,"BF16 op refuses F32 logits");
check(fn_f32(&args,nullptr)==RAD_OK,"F32 near tie launch"); hipcheck(hipDeviceSynchronize());
check(dout.get()[0]==1,"F32 near tie retains winner");
a[0]=t(dl.p,RAD_BF16,{1,V});
check(fn_f32(&args,nullptr)!=RAD_OK,"F32 op refuses BF16 logits");
std::puts("near tie: F32 argmax=1, BF16 input argmax=0: PASS (synthetic)");
}
// Real device head -> F32 Markov chain, with an exactly representable BF16-input near tie.
static void head_chain(Fn head, Fn walk) {
constexpr int K=8, V=2, R=32;
std::vector<uint16_t> x(K,bf(0)), w(V*K,bf(0)), cb(V*R,bf(0));
x[0]=bf(1); x[1]=bf(0.001953125f); w[0]=bf(1); w[K]=bf(1); w[K+1]=bf(1);
std::vector<float> logits(V,-1), scores(1,-1);
std::vector<int> anchor{0}, tile{-1}, out{-1};
Device<uint16_t> dx(x), dw(w), dc(cb); Device<float> dl(logits), ds(scores);
Device<int> da(anchor), dt(tile), dout(out);
RadTensor h[]={t(dx.p,RAD_BF16,{1,K}),t(dw.p,RAD_BF16,{V,K}),t(dl.p,RAD_F32,{1,V})};
RadParam hp[]={pi("M",1),pi("n_vocab",V),pi("n_embd",K),ps("dtype","bf16")};
RadArgs ha{}; ha.t=h; ha.n_t=3; ha.p=hp; ha.n_p=4;
check(head(&ha,nullptr)==RAD_OK,"F32 logits head launch"); hipcheck(hipDeviceSynchronize());
auto got=dl.get(); check(got[0]==1.f && got[1]==1.001953125f,"F32 logits head CPU dot oracle");
check(bf(got[0])==bf(got[1]),"head-chain BF16 negative control");
RadTensor a[]={t(dl.p,RAD_F32,{1,V}),t(da.p,RAD_I32,{1}),t(dc.p,RAD_BF16,{V,R}),t(dc.p,RAD_BF16,{V,R}),t(ds.p,RAD_F32,{1,1}),t(dt.p,RAD_I32,{1,1}),t(dout.p,RAD_I32,{1,1})};
RadParam par[]={pi("M",1),pi("steps",1),pi("rank",R),pi("n_vocab",V),ps("dtype","bf16")};
RadArgs args{}; args.t=a; args.n_t=7; args.p=par; args.n_p=5;
check(walk(&args,nullptr)==RAD_OK,"head-chain walk launch"); hipcheck(hipDeviceSynchronize());
check(dout.get()[0]==1,"F32 head-chain winner");
std::puts("F32 head -> Markov near tie and BF16 negative control: PASS");
}
static void attention(Fn shared, Fn ordinary, int G, int ctx0, int ctx1, int causal) {
constexpr int M=2, Q=7, H=256, BS=16, W=513;
const int ctx[M]={ctx0,ctx1}, blocks=(std::max(ctx0,ctx1)+15)/16, nblocks=M*blocks;
@@ -141,12 +174,56 @@ static void attention(Fn shared, Fn ordinary, int G, int ctx0, int ctx1, int cau
std::printf("attention gqa=%d ctx=%d,%d causal=%d shared oracle and negative control: PASS\n",G,ctx0,ctx1,causal);
}
// Real checkpoint head slice, but synthetic BF16 activations and zero Markov weights. This tests
// head arithmetic, not full-graph/reference equivalence or real hidden-state acceptance.
static void checkpoint_head(Fn head, Fn walk, const char* weights_path) {
constexpr int M=16, V=1025, K=2560, R=32, T=(V+63)/64;
std::vector<uint16_t> w((size_t)V*K), x((size_t)M*K), cb((size_t)V*R,bf(0));
std::ifstream f(weights_path,std::ios::binary); check((bool)f,"open checkpoint head slice");
f.read(reinterpret_cast<char*>(w.data()),w.size()*sizeof(uint16_t));
check((size_t)f.gcount()==w.size()*sizeof(uint16_t) && f.peek()==EOF,"exact head slice size");
uint32_t rng=123456789; for(auto& v:x) { rng=rng*1664525u+1013904223u; v=bf(((int)(rng>>24)-128)/128.f); }
std::vector<float> logits((size_t)M*V,0), scores((size_t)M*T,0);
std::vector<int> anchor(M,0), tile((size_t)M*T,-1), out(M,-1);
Device<uint16_t> dx(x), dw(w), dc(cb); Device<float> dl(logits), ds(scores);
Device<int> da(anchor), dt(tile), dout(out);
RadTensor h[]={t(dx.p,RAD_BF16,{M,K}),t(dw.p,RAD_BF16,{V,K}),t(dl.p,RAD_F32,{M,V})};
RadParam hp[]={pi("M",M),pi("n_vocab",V),pi("n_embd",K),ps("dtype","bf16")};
RadArgs ha{}; ha.t=h; ha.n_t=3; ha.p=hp; ha.n_p=4;
check(head(&ha,nullptr)==RAD_OK,"checkpoint head launch"); hipcheck(hipDeviceSynchronize());
auto got=dl.get(); double maxerr=0, se=0, sr=0, minmargin=INFINITY; int changed=0,ties=0;
std::vector<int> refwin(M);
for(int m=0;m<M;++m) { double best=-INFINITY, second=-INFINITY; int winner=0;
for(int v=0;v<V;++v) { double ref=0; for(int k=0;k<K;++k) ref+=(double)fb(x[m*K+k])*fb(w[(size_t)v*K+k]);
double err=std::abs(got[(size_t)m*V+v]-ref); maxerr=std::max(maxerr,err); se+=err*err; sr+=ref*ref;
check(std::isfinite(got[(size_t)m*V+v]),"finite checkpoint head logits");
if(ref>best) {second=best;best=ref;winner=v;} else if(ref>second) second=ref;
}
refwin[m]=winner; minmargin=std::min(minmargin,best-second);
int gw=0,bw=0,nmax=0; float gmax=-INFINITY, bmax=-INFINITY;
for(int v=0;v<V;++v) {float y=got[(size_t)m*V+v], by=fb(bf(y));
if(y>gmax) {gmax=y;gw=v;} if(by>bmax) {bmax=by;bw=v;nmax=1;} else if(by==bmax) ++nmax;
}
if(gw!=bw) ++changed; if(nmax>1) ++ties;
check(gw==winner,"checkpoint head F32 top1 versus FP64 oracle");
}
RadTensor a[]={t(dl.p,RAD_F32,{M,V}),t(da.p,RAD_I32,{M}),t(dc.p,RAD_BF16,{V,R}),t(dc.p,RAD_BF16,{V,R}),t(ds.p,RAD_F32,{M,T}),t(dt.p,RAD_I32,{M,T}),t(dout.p,RAD_I32,{M,1})};
RadParam p[]={pi("M",M),pi("steps",1),pi("rank",R),pi("n_vocab",V),ps("dtype","bf16")};
RadArgs args{};args.t=a;args.n_t=7;args.p=p;args.n_p=5;
check(walk(&args,nullptr)==RAD_OK,"checkpoint head walk"); hipcheck(hipDeviceSynchronize());
auto picks=dout.get(); for(int m=0;m<M;++m) check(picks[m]==refwin[m],"checkpoint F32 chain top1");
std::printf("real head slice V=%d K=%d synthetic rows=%d: max_abs=%.9g rel_l2=%.9g min_top_margin=%.9g F32_vs_FP64_top1_mismatch=0 BF16_rounded_top1_changed=%d BF16_top_ties=%d\n",V,K,M,maxerr,std::sqrt(se/sr),minmargin,changed,ties);
}
int main(int argc,char** argv) {
check(argc==2,"usage: dspark_device_test libr4d.so"); void* h=dlopen(argv[1],RTLD_NOW|RTLD_LOCAL);
check(argc==2 || (argc==4 && !std::strcmp(argv[2],"--head-weights")),"usage: dspark_device_test libr4d.so [--head-weights file]"); void* h=dlopen(argv[1],RTLD_NOW|RTLD_LOCAL);
if(!h) { std::fprintf(stderr,"dlopen: %s\n",dlerror()); return 1; }
Fn fn=symbol(h,"r4d_rad_dflash_markov_greedy");
for(int r:{32,64,128,512}) markov(fn,r);
near_tie(fn);
Fn fn_f32=symbol(h,"r4d_rad_dflash_markov_greedy_f32");
if(argc==4) { checkpoint_head(symbol(h,"r4d_rad_logits_gemm"),fn_f32,argv[3]); dlclose(h); return 0; }
for(int r:{32,64,128,512}) { markov(fn,r,false); markov(fn_f32,r,true); }
near_tie(fn,fn_f32);
head_chain(symbol(h,"r4d_rad_logits_gemm"),fn_f32);
for(int g:{1,2}) {
const char* shared=g==1?"r4d_rad_attn_anchor_window_h256_gqa1_bf16kv":"r4d_rad_attn_anchor_window_h256_gqa2_bf16kv";
const char* ordinary=g==1?"r4d_rad_attn_window_h256_gqa1_bf16":"r4d_rad_attn_window_h256_gqa2_bf16";
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env python3
"""Extract a read-only BF16 head slice for dspark_device_test --head-weights.
The device probe expects the first 1025 rows of a [131072, 2560] BF16 embedding.
Output is created exclusively, never overwriting an existing artifact or model.
"""
import argparse
import hashlib
import json
from pathlib import Path
import struct
p = argparse.ArgumentParser(description=__doc__)
p.add_argument("safetensors", type=Path)
p.add_argument("output", type=Path)
args = p.parse_args()
with args.safetensors.open("rb") as f:
raw = f.read(8)
if len(raw) != 8:
raise ValueError("short safetensors header")
n = struct.unpack("<Q", raw)[0]
if n > 100_000_000:
raise ValueError("unreasonably large safetensors header")
header = json.loads(f.read(n))
t = header["model.embedding.weight"]
if t["dtype"] != "BF16" or t["shape"] != [131072, 2560]:
raise ValueError("expected Spark BF16 embedding [131072, 2560]")
start, end = t["data_offsets"]
size = 1025 * 2560 * 2
if end - start < size:
raise ValueError("short tensor")
f.seek(8 + n + start)
data = f.read(size)
if len(data) != size:
raise ValueError("short read")
with args.output.open("xb") as f:
f.write(data)
print(f"{args.safetensors}: model.embedding.weight rows 0..1024; "
f"bytes={len(data)} sha256={hashlib.sha256(data).hexdigest()} -> {args.output}")
+25 -1
View File
@@ -1068,7 +1068,7 @@ TEST(op_vocabulary) {
/* The fused fp8 forms. A host run needs every op covered, so these keep a host-backend run
* from failing with "site 'host' is unavailable for this band". */
"rmsnorm_quant_fp8", "gated_quant_fp8", "gemm_nt_q_gated", "dflash_select",
"dflash_markov_greedy",
"dflash_markov_greedy", "dflash_markov_greedy_f32",
/* Tree verification (rad_drafter_tree): the drafter's tree and the attention over it. */
"dflash_tree", "attn_paged_tree", "attn_paged_anchor_window",
"rmsnorm_had_quant_i8",
@@ -9480,6 +9480,27 @@ TEST(dflash_markov_greedy_scans_full_vocab_and_keeps_sequences_independent) {
CHECK_EQ(tile_scores.at(2), 0.0f);
}
TEST(dflash_markov_f32_preserves_a_near_tie_and_refuses_bf16) {
T logits(RAD_F32, {1, 2}); logits.f({1.001f, 1.002f});
T anchor(RAD_I32, {1}); anchor.n({0});
T pred(RAD_BF16, {2, 32}), succ(RAD_BF16, {2, 32});
T score(RAD_F32, {1, 1}), token(RAD_I32, {1, 1}), out(RAD_I32, {1, 1});
A a; a.t(logits).t(anchor).t(pred).t(succ).t(score).t(token).t(out)
.i("M", 1).i("steps", 1).i("rank", 32).i("n_vocab", 2).s("dtype", "bf16");
CHECK_OK(run("dflash_markov_greedy_f32", a));
CHECK_EQ(out.iat(0), 1);
T bad_anchor(RAD_F32, {1}); bad_anchor.f({0});
a.ts[1] = bad_anchor.t;
CHECK_EQ(run("dflash_markov_greedy_f32", a), RAD_E_SHAPE);
a.ts[1] = anchor.t;
CHECK(run("dflash_markov_greedy", a) != RAD_OK);
T bf_logits(RAD_BF16, {1, 2}); bf_logits.f({1.001f, 1.002f});
a.ts[0] = bf_logits.t;
CHECK(run("dflash_markov_greedy_f32", a) != RAD_OK);
CHECK_OK(run("dflash_markov_greedy", a));
CHECK_EQ(out.iat(0), 0);
}
/* Independent pitches in the two scratch arrays are part of the tensor contract. Guard cells
* distinguish correct row addressing from treating both outputs as tightly packed. */
TEST(dflash_markov_greedy_padded_scratch_rows) {
@@ -10056,6 +10077,9 @@ std::vector<Geo> geometries() {
G("dflash_markov_greedy", "M", 2, a.i("M", R).i("steps", 3).i("rank", 32)
.i("n_vocab", 130).i("anchor_stride", 1)
.s("dtype", "bf16")),
G("dflash_markov_greedy_f32", "M", 2, a.i("M", R).i("steps", 3).i("rank", 32)
.i("n_vocab", 130).i("anchor_stride", 1)
.s("dtype", "bf16")),
G("dflash_tree", "M", 2, a.i("M", R).i("steps", 3).i("top_k", 4).i("rank", 8)
.i("n_vocab", 30).i("nodes", 3).s("dtype", "bf16")),
G("gemm_nt", "M", 3, a.i("M", R).i("N", 20).i("K", 40).s("dtype", "f32")),
+37 -16
View File
@@ -564,7 +564,7 @@ TEST(a_dspark_drafter_is_declared_over_the_trunk) {
CHECK_EQ(pstr(&o, "act"), std::string("gelu")); /* exact erf, as the trunk's */
}
CHECK_EQ(count_op(b, "rope") >= 4 * 2 + 1, true);
const RecOp* markov = find_op(b, "dflash_markov_greedy", 0);
const RecOp* markov = find_op(b, "dflash_markov_greedy_f32", 0);
REQUIRE(markov);
CHECK_EQ(pint(markov, "steps"), 7);
CHECK_EQ(pint(markov, "rank"), 256);
@@ -585,8 +585,8 @@ TEST(a_dspark_drafter_is_declared_over_the_trunk) {
const RecBuf* dlog = nullptr;
for (const auto& bf : b.bufs) if (bf.name == "ds_dlog") dlog = &bf;
REQUIRE(dlog != nullptr);
CHECK_EQ(dlog->d.dtype, (uint32_t)RAD_BF16);
CHECK_EQ(count_op(b, "logits_gemm"), 1); /* the trunk's head; the draft's is a GEMM */
CHECK_EQ(dlog->d.dtype, (uint32_t)RAD_F32);
CHECK_EQ(count_op(b, "logits_gemm"), 2); /* trunk and draft F32 heads */
CHECK(count_op(b, "gemm_nt") > 0);
/* The drafter is declared after the trunk, and the graph resolves: no op the plugin declared is
@@ -621,18 +621,31 @@ TEST(the_drafter_passes_run_and_the_draft_is_proposed_from_the_block) {
* writes the proposal buffer -- and no trunk layer at all. */
RadCtx& q = *v[2];
int attn = 0, gemm = 0;
bool selected = false, proposed = false;
bool selected = false, proposed = false, draft_head = false;
rad_buf head_logits = 0;
for (const auto& i : q.issues) {
const RecOp* o = b.op_of(i.op);
REQUIRE(o != nullptr);
if (o->op == "attn_paged_anchor_window") ++attn;
if (o->op == "gemm_nt") ++gemm;
if (o->op == "dflash_markov_greedy") {
if (o->op == "logits_gemm") {
REQUIRE_EQ(i.opd.size(), (size_t)3);
REQUIRE_EQ(i.opd[2].kind, (uint8_t)RAD_OPK_BUF);
head_logits = i.opd[2].handle;
REQUIRE(head_logits > 0 && head_logits <= b.bufs.size());
CHECK_EQ(b.bufs[head_logits - 1].d.dtype, (uint32_t)RAD_F32);
draft_head = true;
}
if (o->op == "dflash_markov_greedy_f32") {
selected = true;
REQUIRE_EQ(i.opd.size(), (size_t)7); /* logits, anchor, pred, succ, tiles, tokens */
proposed = true;
CHECK_EQ(i.opd[0].handle, head_logits);
CHECK_EQ(i.opd[6].kind, (uint8_t)RAD_OPK_BUF);
CHECK_EQ(i.opd[6].handle, b.drafter.proposal);
proposed = i.opd[6].handle == b.drafter.proposal;
}
}
CHECK(draft_head);
CHECK_EQ(attn, 5);
CHECK(gemm > 0);
CHECK(selected);
@@ -640,25 +653,33 @@ TEST(the_drafter_passes_run_and_the_draft_is_proposed_from_the_block) {
/* The context pass stores K and V for every committed token and proposes nothing. */
RadCtx& h = *v[1];
int stores = 0, selects = 0;
int stores = 0;
for (const auto& i : h.issues) {
const RecOp* o = b.op_of(i.op);
REQUIRE(o != nullptr);
if (o->op == "kv_store") ++stores;
if (o->op == "dflash_select") ++selects;
}
CHECK_EQ(stores, 5);
CHECK_EQ(selects, 0);
auto drafter_silent = [&](const RadCtx& pass) {
for (const auto& i : pass.issues) {
const RecOp* o = b.op_of(i.op);
if (!o || o->op == "dflash_markov_greedy_f32" || o->op == "dflash_select")
return false;
for (const auto& operand : i.opd)
if (operand.kind == RAD_OPK_BUF &&
(operand.handle == b.drafter.proposal || operand.handle == head_logits))
return false;
}
return true;
};
CHECK(drafter_silent(h));
CHECK(!drafter_silent(q)); /* negative control: a real draft pass must fail the silence test */
/* And the trunk's own step, with the drafter silent. */
const auto dec = kit(b, { 1, 1, 1, 1 }, {});
const auto d = run_passes(b, spark25_bf16::step, { dec.get() });
CHECK_PASSES(b, d);
for (const auto& i : d[0]->issues) {
const RecOp* o = b.op_of(i.op);
REQUIRE(o != nullptr);
CHECK(o->op != "dflash_select");
}
CHECK(drafter_silent(*d[0]));
}
TEST(a_drafter_is_refused_when_the_pair_or_the_depth_is_wrong) {
@@ -696,7 +717,7 @@ TEST(a_drafter_is_refused_when_the_pair_or_the_depth_is_wrong) {
}
/* A library that only has the older per-query window or candidate-pruned selector must refuse
* DSpark declaration, not silently substitute an operation with different semantics. */
for (const char* op : {"attn_paged_anchor_window", "dflash_markov_greedy"}) {
for (const char* op : {"attn_paged_anchor_window", "dflash_markov_greedy_f32"}) {
MetaKV k = with_dspark(spark_meta());
RadBuilder b;
b.refuse.insert(op);
@@ -751,7 +772,7 @@ TEST(the_int8_trunk_carries_the_same_drafter) {
CHECK_EQ(b.drafter.window, 513);
CHECK(find_w(b, "dspark.fc.weight") != nullptr);
CHECK_EQ(count_op(b, "attn_paged_anchor_window"), 1);
CHECK_EQ(count_op(b, "dflash_markov_greedy"), 1);
CHECK_EQ(count_op(b, "dflash_markov_greedy_f32"), 1);
CHECK_EQ(count_op(b, "dflash_select"), 0);
const auto ver = kit(b, std::vector<int>(4, 8), {});
const auto ctx_pass = context_pass(b, *ver);