interplane.Get Omega
Read in your language

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

branch main Branches Tags History

CUDApp / src / omega_gpu_attn_any_api.h

37 lines · 1693 bytes Raw Blame History
1/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */
2#ifndef OMEGA_GPU_ATTN_ANY_API_H
3#define OMEGA_GPU_ATTN_ANY_API_H
4#include <stddef.h>
5#include <stdint.h>
6#include "omega_blackwell_codegen.h"
7#ifdef __cplusplus
8extern "C" {
9#endif
10/* Contiguous [head][sequence][component], no padding. Output is always f32.
11 * Causal is top-left aligned: key j is visible iff j <= query i.
12 * Finite inputs and finite intermediate dot products are required.
13 * Inputs are f32, bf16 or IEEE binary16; no 16-bit format is reinterpreted.
14 * This is experimental and host/simulator exercised, not chip qualified. */
15typedef struct {
16 uint32_t seq_q, seq_kv, head_dim, q_heads, kv_heads, causal, dtype;
17 float scale;
18} OmegaGpuAttnAnyShape;
19#define OMEGA_GPU_ATTN_ANY_MAX_HEAD_DIM 256u
20#define OMEGA_GPU_ATTN_ANY_F32 0u
21#define OMEGA_GPU_ATTN_ANY_BF16 1u
22#define OMEGA_GPU_ATTN_ANY_F16 2u
23#define OMEGA_GPU_ATTN_ANY_OK 0
24#define OMEGA_GPU_ATTN_ANY_REFUSED 1
25#define OMEGA_GPU_ATTN_ANY_BAD_ARGS 2
26#define OMEGA_GPU_ATTN_ANY_CODEGEN 3
27#define OMEGA_GPU_ATTN_ANY_CHIP 4
28/* CPU-only code generation; does not open the GPU. Caller supplies program and
29 * code storage, conventionally sizeof(BlackwellIRProgram) and 64 KiB. */
30int omega_gpu_attn_any_codegen(const OmegaGpuAttnAnyShape *shape, BlackwellIRProgram *program, uint8_t *code, size_t capacity, OmegaBlackwellKernel *kernel);
31/* GPU execution: requires the operator's exclusive window and normal preflight.
32 * Unsupported geometry/format is rejected by Omega before the device is opened. */
33int omega_gpu_attn_any(const OmegaGpuAttnAnyShape *shape, const void *q, const void *k, const void *v, float *out);
34#ifdef __cplusplus
35}
36#endif
37#endif