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_bw_em_q.h

23 lines · 1514 bytes Raw Blame History
1/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */
2/* omega_bw_em_q.h: private emitters for the native FP8 ops (W-L1G, 2026-10-14). Include after omega_bw_em.h.
3 * Both are placeholders patched by omega_qmma_patch_code (omega_blackwell_codegen_qmma.h). */
4#ifndef OMEGA_BW_EM_Q_H
5#define OMEGA_BW_EM_Q_H
6#include "omega_blackwell_codegen_qmma.h"
7/* QMMA.16832.F32.E4M3.E4M3 d = a * b + c (c NOREG = RZ); operands may start at a subregister (b pair inside a quad) */
8static void qmma_s(Em *e, int d, int a, int b, unsigned bsub, int c, uint32_t stall) {
9 BlackwellIRInsn i = I0(BW_IR_HMMA_BF16); i.dst_vreg = d; i.src1_vreg = a; i.src2_vreg = b; i.src2_subreg = (uint8_t)bsub; i.src3_vreg = c; i.imm = OMEGA_QMMA_MARK;
10#ifdef BW_EM_C_PRIMARY
11 i.control = CW(stall, SB_NONE, SB_NONE, e->pending); e->pending = 0;
12#else
13 if (em_step(e, 7, stall, 0, 0, 0, &i.control) < 0) { e->err = -1; return; }
14#endif
15 if (omega_bw_ir_append(e->p, &i) < 0) e->err = -1;
16}
17static void qmma(Em *e, int d, int a, int b, int c, uint32_t stall) { qmma_s(e, d, a, b, 0, c, stall); }
18/* F2FP.SATFINITE.E4M3.F32.PACK_AB_MERGE_C Rd, Ra, Rb, RZ: Rd = e4m3(Ra) << 8 | e4m3(Rb) (byte order INFERRED, chip probe checks) */
19static void f2e4(Em *e, int d, int a, unsigned asub, int b, unsigned bsub) {
20 BlackwellIRInsn i = I0(BW_IR_FMNMX_MAX); i.dst_vreg = d; i.src1_vreg = a; i.src1_subreg = (uint8_t)asub; i.src2_vreg = b; i.src2_subreg = (uint8_t)bsub; i.imm = OMEGA_QMMA_MARK_F2E4;
21 emit(e, i, K_FIXED);
22}
23#endif