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
omega-mv / src / omega_gpu_mem_cached.h
| 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 | #ifndef OMEGA_GPU_MEM_CACHED_H |
| 18 | #define OMEGA_GPU_MEM_CACHED_H |
| 19 | /* GPU-cached device-visible memory for read-only weights (OWN-30B L2 kernel-time cut). |
| 20 | * |
| 21 | * The session's own allocations are GPU-uncached (nvos.h NVOS32_ATTR2_GPU_CACHEABLE: "For system memory this will not |
| 22 | * be coherent with direct CPU mappings"). Weights are written once by the CPU before their first GPU use |
| 23 | * (omega_gpu_session_sync_to_gpu), are never host-polled and never rewritten, so the GPU may cache them. Same descriptor |
| 24 | * as omega_gpu_prefill.c in omega-own30b-tc (W-L1G, T3b 4a84906b) minus CPU_READ: the platform allows GPU-cached data buffers |
| 25 | * only without CPU_READ / HOST_POLLED. Invariant here: the CPU writes the buffer once (fresh allocation, never read by the GPU |
| 26 | * yet, so no stale L2 line exists), omega_gpu_session_sync_to_gpu flushes the CPU side, then only the GPU reads it, ever. |
| 27 | * The caller holds the session lock with the device |
| 28 | * open (as for omega_gpu_session_alloc); the buffer is freed and synced through the session like any other. */ |
| 29 | #include <stddef.h> |
| 30 | #include "omega_gpu_session.h" |
| 31 | #ifdef __cplusplus |
| 32 | extern "C" { |
| 33 | #endif |
| 34 | int omega_gpu_session_alloc_cached(size_t bytes, OmegaGpuMem *out); |
| 35 | #ifdef __cplusplus |
| 36 | } |
| 37 | #endif |
| 38 | #endif |