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

// Per-definition constants for this gemm w8a8ch (int8) specialisation.
// C[m, n] = (A[m,:] . B[n,:]) * (input_scale * weight_scales[n])  (no bias)
// input_scale is a per-definition-constant dequant scalar (constant across every
// workload — checked at generation time); weight_scales is a genuine runtime
// per-output-channel tensor, passed as a regular float pointer below.
namespace gemm_def {
constexpr int N = 1000;
constexpr int K = 2048;
constexpr float input_scale = 0.01;
} // namespace gemm_def

#ifdef __cplusplus
extern "C" {
#endif
// LLM target: implement this in kernel.cpp.
// M is the only var dim. A: (M, K) int8; B: (N, K) int8; weight_scales: (N) float32;
// output: (M, N) float32.
// Dequantization: real = int32_acc * scale, where scale = input_scale * weight_scales[n]
// (NOT ncnn's quantization convention int8 = round(real * scale)).
void inner_gemm(const int8_t* A, float* output, const int8_t* B,
                 const float* weight_scales, int M);
#ifdef __cplusplus
}
#endif