Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/tests/model_graphs_decode_fixture.c # CUDApp CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / tests / model_graphs_decode_fixture.c` 52 lines · 3086 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 #include "model_graphs_fixture.h" 3 #ifdef MODEL_GRAPHS_NESTED 4 #include "model_graphs_nested_objects.h" 5 #endif 6 #include "../src/omega_gpu_decode_graph.c" 7 int mg_decode_run(const MgCase *c){ 8 OmegaGpuDecodeGraph g={0}; 9 g.cfg.layers=c->layers;g.cfg.vocab=248320;g.cfg.eps=1e-6f;g.cfg.attn=(void*)0x2000;g.cfg.lm_head=(void*)0x200; 10 g.am_ctas=122;g.in_token=1;g.final_set=1;g.cl=mg_fixture_list();g.buf.va=c->seed; 11 g.xq_layer=(c->flags&64)?(int)c->layer:-1;g.mutant=c->mutant; 12 g.lo.x=UINT64_C(0x100000); 13 g.lo.xq=UINT64_C(0x200000); 14 g.lo.qkv=UINT64_C(0x300000); 15 g.lo.attn=UINT64_C(0x400000); 16 g.lo.o=UINT64_C(0x500000); 17 g.lo.gu=UINT64_C(0x600000); 18 g.lo.act=UINT64_C(0x700000); 19 g.lo.dn=UINT64_C(0x800000); 20 g.lo.hidden=UINT64_C(0x900000); 21 g.lo.logits=UINT64_C(0xa00000); 22 g.lo.am_v=UINT64_C(0xb00000); 23 g.lo.am_i=UINT64_C(0xc00000); 24 g.lo.token=UINT64_C(0xd00000); 25 g.lo.norms=UINT64_C(0xe00000); 26 g.lo.fnorm=UINT64_C(0xf00000); 27 g.lo.tabs=UINT64_C(0x1000000); 28 g.lo.pf_x=UINT64_C(0x1100000); 29 g.lo.pf_y=UINT64_C(0x1200000); 30 for(unsigned i=0;iflags>>1)&1;g_prefetch=c->flags&1;g_prefetch_red=(c->flags>>2)&1; 32 for(unsigned i=0;ilayers;i++){g.layer[i].set=1;g.layer[i].qkv=(void*)0x10;g.layer[i].o=(void*)0x20;g.layer[i].gu=(void*)0x30;g.layer[i].dn=(void*)0x40;} 33 if(c->mode)g.hidden_ready=(c->flags>>7)&1; 34 #ifdef MODEL_GRAPHS_NESTED 35 g.cfg.lm_head=mg_nested_bf16(0,g.cfg.vocab,OMEGA_GPU_DGRAPH_HIDDEN);g.cfg.attn=mg_nested_attn(0,c->layers); 36 g.cfg.router=mg_nested_router(c->layers,128,0); 37 for(unsigned l=0;llayers;l++){ 38 g.layer[l].qkv=mg_nested_fp8(0,1,OMEGA_GPU_DGRAPH_QKV,OMEGA_GPU_DGRAPH_HIDDEN); 39 g.layer[l].o=mg_nested_fp8(1,1,OMEGA_GPU_DGRAPH_HIDDEN,OMEGA_GPU_DGRAPH_ATTN); 40 g.layer[l].gu=mg_nested_fp8(2,128,2*OMEGA_GPU_DGRAPH_INTER,OMEGA_GPU_DGRAPH_HIDDEN); 41 g.layer[l].dn=mg_nested_fp8(3,128,OMEGA_GPU_DGRAPH_HIDDEN,OMEGA_GPU_DGRAPH_INTER); 42 } 43 mg_nested_record_begin(); 44 #endif 45 int rc=0;if(c->mode<2)rc=c->mode?omega_gpu_decode_graph_record_final(&g):omega_gpu_decode_graph_record_layer(&g,c->layer,c->pos); 46 if(c->mode==2){g.xq_layer=-1;g.hidden_ready=0;rc=0;for(unsigned l=0;llayers&&!rc;l++)rc=omega_gpu_decode_graph_record_layer(&g,l,c->pos);if(!rc)rc=omega_gpu_decode_graph_record_final(&g);} 47 if(c->mode==3){const unsigned modes[3]={OMEGA_DEC_RES_NORM,OMEGA_DEC_RES_ADD,OMEGA_DEC_RES_COMBINE|OMEGA_DEC_RES_NORM};rc=omega_gpu_decode_graph_record_res(&g,modes[c->flags%3],c->seed,c->seed+16,c->seed+32,c->seed+48,c->seed+64,g.cfg.eps,0x1p-64f);} 48 if(c->mode==4)rc=omega_gpu_decode_graph_record_swiglu(&g,c->seed,c->seed+16,0x1p-64f); 49 uint64_t state[16]={g.n_kind,g.failed,g.xq_layer+1,g.hidden_ready};mg_record(200,state,16); 50 for(unsigned i=0;i