// File: gemm.h
#pragma once
#include <cstdint>

// Per-definition constants for this gemm bf16 specialisation.
// C[m, n] = sum_k A[m, k] * B[n, k]  (B is the [N, K] "weight" matrix, transposed)
// A/B are raw bf16 bit patterns (uint16_t) — bf16 shares fp32's exponent field,
// so widening is an exact `(uint32_t)bits << 16` reinterpret (see kernel.cpp).
// Output accumulates/returns in fp32.
namespace gemm_def {
constexpr int N = 2048;
constexpr int K = 1024;
} // namespace gemm_def

#ifdef __cplusplus
extern "C" {
#endif
// LLM target: implement this in kernel.cpp.
// M is the only var dim. A: (M, K) bf16; B: (N, K) bf16; output: (M, N) float32.
// Bytes are raw bf16 bit patterns — reinterpret_cast<const __bf16*> if your
// target ISA has native bf16 support, or widen manually to fp32 first.
void inner_gemm(const uint16_t* A, float* output, const uint16_t* B, int M);
#ifdef __cplusplus
}
#endif