interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / src / omega_gpu_pfhost.h

57 lines · 3285 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#ifndef OMEGA_GPU_PFHOST_H
18#define OMEGA_GPU_PFHOST_H
19/*
20 * omega_gpu_pfhost (OWN-30B W-L1G-D, 2026-10-14): the whole-prompt prefill's router logits and MoE combine on the chip. New file.
21 * Kernels and their exact semantics: omega_blackwell_codegen_pfhost.h (bit-identical to the Rust driver's host loops).
22 * Buffers are omega_gpu_prefill.h buffers (DEVICE or HOST, by VA); every call takes the session lock and is synchronous.
23 *
24 * uint32_t omega_gpu_pf_router_rows(void);
25 * Rows per CTA of the router-logits launch (t). x must have ceil(rows / t) * t readable rows; logits gets that many rows.
26 * size_t omega_gpu_pf_router_packed_bytes(uint32_t e, uint32_t k);
27 * void omega_gpu_pf_router_pack(uint32_t e, uint32_t k, const float *w, float *wq);
28 * w: f32 [e][k] (row ex = expert ex); wq: the packed layout R4 plus the pad group (zeros), packed_bytes bytes.
29 * int omega_gpu_pf_router_logits(uint32_t k, uint32_t e, uint32_t rows, uint64_t x_va, uint64_t wq_va, uint64_t logits_va, uint64_t *ns);
30 * int omega_gpu_pf_moe_combine(uint32_t h, uint32_t top_k, uint32_t rows, uint64_t down_va, uint64_t inv_va, uint64_t wt_va,
31 * uint64_t out_va, uint64_t *ns);
32 * Return codes OMEGA_GPU_PF_*; *ns (when given) gains the chip nanoseconds.
33 */
34#include <stddef.h>
35#include <stdint.h>
36#include "omega_gpu_prefill.h"
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41uint32_t omega_gpu_pf_router_rows(void);
42size_t omega_gpu_pf_router_packed_bytes(uint32_t e, uint32_t k);
43void omega_gpu_pf_router_pack(uint32_t e, uint32_t k, const float *w, float *wq);
44int omega_gpu_pf_router_logits(uint32_t k, uint32_t e, uint32_t rows, uint64_t x_va, uint64_t wq_va, uint64_t logits_va, uint64_t *ns);
45int omega_gpu_pf_moe_combine(uint32_t h, uint32_t top_k, uint32_t rows, uint64_t down_va, uint64_t inv_va, uint64_t wt_va, uint64_t out_va, uint64_t *ns);
46/* Record paths for single-submit command lists (caller holds omega_gpu_session_lock() with device open). */
47struct OmegaGpuCmdList;
48int omega_gpu_pf_router_logits_record(struct OmegaGpuCmdList *cl, uint32_t k, uint32_t e, uint32_t rows, uint64_t x_va, uint64_t wq_va, uint64_t logits_va);
49int omega_gpu_pf_moe_combine_record(struct OmegaGpuCmdList *cl, uint32_t h, uint32_t top_k, uint32_t rows, uint64_t down_va, uint64_t inv_va, uint64_t wt_va, uint64_t out_va);
50/* tests only: kernel mutants (0 restores) and the router's rows per CTA (0 = default 16) */
51void omega_gpu_pf_router_test_set_mutant(int m);
52void omega_gpu_pf_combine_test_set_mutant(int m);
53void omega_gpu_pf_router_set_rows(uint32_t t);
54#ifdef __cplusplus
55}
56#endif
57#endif