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/cmdlist_shell_test.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 / cmdlist_shell_test.c` 62 lines · 3923 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 /* Exercise the real shell's record/plan/emit path without opening a device. 3 * The existing Streams C oracle compares every generated method word. */ 4 #define CUDAPP_MIGRATION_PENDING_STREAMS_DIFF 1 5 #include "../src/omega_gpu_cmdlist.c" 6 #include 7 #include 8 void cudapp_streams_diff_note(int same,const char *line) { if(!same) { fprintf(stderr,"FAIL %s\n",line);abort(); } } 9 static uint64_t random_state=`123456789`; 10 static unsigned random_word(void) { random_state^=random_state<<13;random_state^=random_state>>7;random_state^=random_state<<17;return (unsigned)random_state; } 11 int main(void) { 12 OmegaGpuCmdList cl={0};cl.cap=32;cl.words_cap=16384; 13 cl.gen=omega_gpu_session_recoveries();cl.epoch=omega_gpu_session_epoch();cl.record_generation=1; 14 cl.banks.cpu=calloc(cl.cap,1024);cl.banks.va=0x10000000; 15 cl.qmds.cpu=calloc(cl.cap,1024);cl.qmds.va=0x20000000; 16 cl.sems.cpu=calloc(cl.cap,16);cl.sems.va=0x30000000; 17 cl.stamps.va=0x40000000;cl.scratch.va=0x50000000; 18 cl.words=calloc(cl.words_cap,4);cl.native=calloc(cl.cap,sizeof *cl.native); 19 cl.indep=calloc(cl.cap,1);cl.wait_va=calloc(cl.cap,sizeof *cl.wait_va); 20 if(!cl.banks.cpu||!cl.qmds.cpu||!cl.sems.cpu||!cl.words||!cl.native||!cl.indep||!cl.wait_va) return 2; 21 for(unsigned t=0;t<2000;t++) { 22 omega_gpu_cmdlist_reset(&cl);unsigned n=random_word()%33; 23 for(unsigned i=0;i>1)&1};OmegaGpuCmdListProgramPlan p; 45 if(omega_gpu_cmdlist_plan_program(&cl,&o,&p)) return 1; 46 if(n) { 47 prepare_qmd_mode(&cl,&o);cl.program_active=1; 48 size_t words=emit_chunk(&cl,&o,0,n,0x70000000);cl.program_active=0; 49 if(words!=p.words) { fprintf(stderr,"FAIL emitted words %zu != plan %u\n",words,p.words);return 1; } 50 } else { 51 OmegaGpuCmdListStats stats; 52 if(p.words||p.waits||p.submissions||omega_gpu_cmdlist_submit_program(&cl,&o,&stats)|| 53 stats.submits||stats.first_missing!=-1) return 1; 54 } 55 o.first_barrier_none=1; 56 if(omega_gpu_cmdlist_plan_program(&cl,&o,&p)==0) return 1; 57 } 58 free(cl.program);free(cl.barriers);free(cl.banks.cpu);free(cl.qmds.cpu);free(cl.sems.cpu); 59 free(cl.words);free(cl.native);free(cl.indep);free(cl.wait_va); 60 puts("PASS real command-list shell: 2000 record/plan/emit programs, PCAS/INLINE/stamps, exact C method differential; no device opened"); 61 return 0; 62 }