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_bw_em_q.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 | /* omega_bw_em_q.h: private emitters for the native FP8 ops (W-L1G, 2026-10-14). Include after omega_bw_em.h. |
| 18 | * Both are placeholders patched by omega_qmma_patch_code (omega_blackwell_codegen_qmma.h). */ |
| 19 | #ifndef OMEGA_BW_EM_Q_H |
| 20 | #define OMEGA_BW_EM_Q_H |
| 21 | #include "omega_blackwell_codegen_qmma.h" |
| 22 | /* QMMA.16832.F32.E4M3.E4M3 d = a * b + c (c NOREG = RZ); operands may start at a subregister (b pair inside a quad) */ |
| 23 | static void qmma_s(Em *e, int d, int a, int b, unsigned bsub, int c, uint32_t stall) { |
| 24 | 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; |
| 25 | i.control = CW(stall, SB_NONE, SB_NONE, e->pending); e->pending = 0; |
| 26 | if (omega_bw_ir_append(e->p, &i) < 0) e->err = -1; |
| 27 | } |
| 28 | static void qmma(Em *e, int d, int a, int b, int c, uint32_t stall) { qmma_s(e, d, a, b, 0, c, stall); } |
| 29 | /* F2FP.SATFINITE.E4M3.F32.PACK_AB_MERGE_C Rd, Ra, Rb, RZ: Rd = e4m3(Ra) << 8 | e4m3(Rb) (byte order INFERRED, chip probe checks) */ |
| 30 | static void f2e4(Em *e, int d, int a, unsigned asub, int b, unsigned bsub) { |
| 31 | 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; |
| 32 | emit(e, i, K_FIXED); |
| 33 | } |
| 34 | #endif |