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/src/omega_gpu_serving.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 / src / omega_gpu_serving.c` 41 lines ยท 1915 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 2 * Copyright 2026 Drake Stapleton (AIEN / aien-dev) 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /* omega_gpu_serving.c: see omega_gpu_serving.h. Thin wrapper over the per-API reserve calls. */ 18 #include "omega_gpu_serving.h" 19 #include "omega_gpu_attention_api.h" 20 #include "omega_gpu_matmul_api.h" 21 22 int omega_gpu_reserve_serving(const OmegaGpuServingBounds *b) { 23 if (!b) return OMEGA_GPU_MATMUL_BAD_ARGS; 24 int rc = omega_gpu_attention_reserve(b->max_context, b->max_seqs ? b->max_seqs : 1, b->num_q_heads, b->num_kv_heads, b->head_dim, b->kv_block_size); 25 if (rc != 0) return rc; 26 if (b->max_rows > 1) { /* the prompt read's rows path (omega_gpu_gqa_attention_rows_f32): q/out/table for a chunk of rows */ 27 rc = omega_gpu_attention_reserve_rows(b->max_rows, b->num_q_heads, b->head_dim); 28 if (rc != 0) { omega_gpu_attention_unreserve(); return rc; } 29 } 30 rc = omega_gpu_matmul_reserve(b->max_rows, b->max_k, b->max_n, b->max_n_one_row ? b->max_n_one_row : b->max_n, b->kernel_slots); 31 if (rc != 0) omega_gpu_attention_unreserve(); /* the matmul half failed: do not leave half a reservation active */ 32 return rc; 33 } 34 35 void omega_gpu_serving_seal(void) { omega_gpu_matmul_seal(1); } 36 37 void omega_gpu_serving_release(void) { 38 omega_gpu_matmul_seal(0); 39 omega_gpu_attention_unreserve(); 40 omega_gpu_matmul_unreserve(); 41 }