fix(rebase): adapt to dev's split tensor_upload/_g API + fault-injection hook
Dev split coli_cuda_tensor_upload into two symbols: the plain 7-arg tensor_upload (no gs) for fmt!=4, and tensor_upload_g (8-arg, with gs) for fmt=4 grouped. The DLL-side _g sets a g_upload_gs global the plain upload reads internally. Adapted all call sites: - colibri.c: qt_cuda_upload already dispatches (_g for fmt=4, plain otherwise) — kept dev's version. layer_cuda_shard_kvb was calling the plain upload with gs; switched to tensor_upload_g. - backend_loader.c: the C-API wrapper matches dev's 7-arg signature; tensor_upload_g dispatched separately. - backend_cuda.cu: cache-hit check uses g_upload_gs (not a gs param); coli_cuda_matmul dispatches _g when gs>0; the grouped-expert host fallback quant_matmul calls pass gs=0,ng=1 (host tier is per-row). - Kept dev's fault-injection hook, scale_count field, and fmt=4 support in the grouped-expert path (all_q4/any_g4 tracking). - tests: kept dev's comprehensive tensor_upload test (cached reuse, temp-buffer survival, upload-failure accounting, fault injection). Build-verified: colibri.exe + coli_cuda.dll both compile clean.
This commit is contained in:
+1
-1
@@ -1013,7 +1013,7 @@ static void layer_cuda_shard_kvb(Layer *l,int H,int Q,int V){
|
||||
int hn=H/g_cuda_ndev+(d<H%g_cuda_ndev),rows=hn*(Q+V);
|
||||
const void *part=weights+(int64_t)h0*(Q+V)*rb;
|
||||
const float *scale=l->kv_b.s+(int64_t)h0*(Q+V)*(l->kv_b.gs>0?(l->kv_b.I+l->kv_b.gs-1)/l->kv_b.gs:1);
|
||||
if(!coli_cuda_tensor_upload(&l->kv_b_shard[d],part,scale,l->kv_b.fmt,l->kv_b.I,rows,g_cuda_devices[d],l->kv_b.gs))return;
|
||||
if(!coli_cuda_tensor_upload_g(&l->kv_b_shard[d],part,scale,l->kv_b.fmt,l->kv_b.I,rows,g_cuda_devices[d],l->kv_b.gs))return;
|
||||
l->shard_h0[d]=h0;l->shard_hn[d]=hn;l->n_kv_b_shard++;h0+=hn;
|
||||
}
|
||||
int old=-1;for(int i=0;i<g_cuda_ndev;i++)if(g_cuda_devices[i]==l->kv_b.cuda_device)old=i;
|
||||
|
||||
Reference in New Issue
Block a user