brotensor/
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
12 / 12
100.0%
Branches:
-
-%
Functions:
1 / 1
100.0%

src/kernels/mir_conv_cm.h
Line Branch Exec Source
1 #pragma once
2
3 // 16x16x16 cooperative-matrix 2D implicit-GEMM convolution MIR builder replacing:
4 // conv_cm.comp (FP16 / BF16, optional INT8 weights QA=QF_INT8, BVEC=0/1/2,
5 // DIRECT fragment epilogue & shared-scratch epilogue, bias, accum, act).
6
7 #include "mir_gemm_cm.h"
8
9 #include <cstdint>
10
11 namespace brotensor::kernels {
12
13 21 struct ConvCmSpec {
14 21 Dtype dt = Dtype::FP16;
15 21 std::uint32_t cfg_idx = 1; // index into kGemmCmTiles (0, 2, 3)
16 21 std::uint32_t act = 0; // LACT_*
17 21 std::uint32_t bvec = 0; // 0: 8x u16, 1: 1x1 aligned i32x4, 2: stride-1 shifted 2x i32x4
18 21 std::uint32_t qa = 0; // 0 or QF_INT8
19 21 bool avec = true;
20 21 bool direct = false;
21 21 bool has_bias = false;
22 21 bool rowch = false;
23 21 bool accum = false;
24 21 int kh = 3, kw = 3, sh = 1, sw = 1, ph = 1, pw = 1, dh = 1, dw = 1;
25 };
26
27 // Params (16):
28 // ptrs[0..4]: x, w, y, bias, scale
29 // ints[5..15]: m, n, k, h, wd, wo, cin, cout, groups, tm0, tn0
30 brass::Function* build_conv_cm_mir(brass::Module& mod, const ConvCmSpec& spec);
31
32 } // namespace brotensor::kernels
33