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/omega-mv/blob/main/bench/m1/block2_profile.c # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / bench / m1 / block2_profile.c` 45 lines ยท 3666 bytes Raw Blame History 1 /* M1 block 2 profile (omega-mv#575): time each backend callback of the Blackwell engine 2 * by wrapping the real backend table. Run under flock /tmp/aien-gb10.lock. */ 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include "omega_gpu_engine.h" 9 #include "omega_blackwell_engine.h" 10 #include "omega_blackwell_encoder.h" 11 12 static const OmegaGpuBackend *R; 13 static double T[16]; static long N[16]; 14 static const char *NAMES[16]={"open_device","create_channel","alloc","copy_in","fill_poison","build","submit","wait_marker","wait_marker2","wait_release_semaphore","barrier","copy_out","diagnostics","free_buf","close"}; 15 static double now(void){struct timespec t;clock_gettime(CLOCK_MONOTONIC,&t);return t.tv_sec+t.tv_nsec*1e-9;} 16 #define W0(i,call) static int w_##i(void*c){double t=now();int r=R->call(R->ctx);T[i]+=now()-t;N[i]++;return r;} 17 #define W1(i,call,A,a) static int w_##i(void*c,A){double t=now();int r=R->call(R->ctx,a);T[i]+=now()-t;N[i]++;return r;} 18 W0(0,open_device) W0(1,create_channel) 19 static int w_2(void*c,int role,size_t b){double t=now();int r=R->alloc(R->ctx,role,b);T[2]+=now()-t;N[2]++;return r;} 20 static int w_3(void*c,int role,const void*s,size_t b){double t=now();int r=R->copy_in(R->ctx,role,s,b);T[3]+=now()-t;N[3]++;return r;} 21 static int w_4(void*c,const uint32_t*w,size_t n){double t=now();int r=R->fill_poison(R->ctx,w,n);T[4]+=now()-t;N[4]++;return r;} 22 static int w_5(void*c,const OmegaGpuJob*j){double t=now();int r=R->build(R->ctx,j);T[5]+=now()-t;N[5]++;return r;} 23 W0(6,submit) 24 W1(7,wait_marker,uint64_t ms,ms) W1(8,wait_marker2,uint64_t ms,ms) W1(9,wait_release_semaphore,uint64_t ms,ms) W1(10,barrier,uint64_t ms,ms) 25 static int w_11(void*c,void*d,size_t b){double t=now();int r=R->copy_out(R->ctx,d,b);T[11]+=now()-t;N[11]++;return r;} 26 static void w_12(void*c,OmegaGpuBackendDiag*d){double t=now();R->diagnostics(R->ctx,d);T[12]+=now()-t;N[12]++;} 27 static int w_13(void*c,int role){double t=now();int r=R->free_buf(R->ctx,role);T[13]+=now()-t;N[13]++;return r;} 28 W0(14,close) 29 30 int main(int argc,char**argv){ 31 if(argc<2||strcmp(argv[1],"--chip")){puts("NOT_RUN");return 2;} 32 long NJ=argc>2?atol(argv[2]):50; 33 R=omega_blackwell_engine_backend(); 34 OmegaGpuBackend B={0};B.ctx=(void*)1;B.open_device=w_0;B.create_channel=w_1;B.alloc=w_2;B.copy_in=w_3;B.fill_poison=w_4;B.build=w_5;B.submit=w_6;B.wait_marker=w_7;B.wait_marker2=w_8;B.wait_release_semaphore=w_9;B.barrier=w_10;B.copy_out=w_11;B.diagnostics=w_12;B.free_buf=w_13;B.close=w_14; 35 omega_gpu_engine_set_backend(&B); 36 uint8_t code[OMEGA_BW_VECADD_CODE_SIZE];size_t cb=0;omega_blackwell_encode_vecadd(code,sizeof code,&cb); 37 uint32_t n=65,a[65],b[65],out[65],poison[65];for(uint32_t i=0;i