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/ggml-omega/blob/main/tests/empty-graph.c # ggml-omega aien-dev/ggml-omega 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 `ggml-omega / tests / empty-graph.c` 22 lines ยท 987 bytes Raw Blame History 1 // Verification: empty normalization graphs must not invoke chip work. 2 // usage: empty-graph LIB [DEVICE], default DEVICE OmegaGB10. 3 #include "ggml.h" 4 #include "ggml-backend.h" 5 #include 6 int main(int argc,char **argv) { 7 if(argc<2 || argc>3)return 2; 8 if(!ggml_backend_load(argv[1]))return 2; 9 ggml_backend_t b=ggml_backend_init_by_name(argc==3 ? argv[2] : "OmegaGB10",NULL); 10 if(!b)return 2; 11 struct ggml_init_params p={.mem_size=1024*1024,.mem_buffer=NULL,.no_alloc=false}; 12 struct ggml_context *c=ggml_init(p); 13 struct ggml_tensor *x=ggml_new_tensor_2d(c,GGML_TYPE_F32,128,0); 14 struct ggml_tensor *y=ggml_rms_norm(c,x,0.00001f); 15 ggml_set_output(y); 16 struct ggml_cgraph *g=ggml_new_graph(c); 17 ggml_build_forward_expand(g,y); 18 fprintf(stderr,"Empty RMS: elements=%lld rows=%lld dim=%lld\n",(long long)ggml_nelements(y),(long long)ggml_nrows(y),(long long)y->ne[0]); 19 int r=ggml_backend_graph_compute(b,g); 20 ggml_backend_free(b);ggml_free(c); 21 return r!=GGML_STATUS_SUCCESS; 22 }