// File: binding.cpp
#include "moe.h"

namespace {
constexpr int64_t kNEmbd       = 2048;
constexpr int64_t kNFf         = 1408;
constexpr int64_t kNExpert     = 60;
constexpr int64_t kNExpertUsed = 4;
} // namespace

extern "C" {
// q8_0: hidden_states + the three projections are ggml block_q8_0 rows (repacked
// by the Python adapter from int8 quants + fp16 scales); router_weight stays
// fp32. Each (quant, scales) pair occupies two ABI slots — the packed buffer at
// the quant slot, NULL at the consumed scales slot:
//   [0]=hidden_states q8_0, [1]=hs_scales NULL, [2]=router_weight fp32,
//   [3]=gate_proj q8_0, [4]=gate_scales NULL, [5]=up_proj q8_0,
//   [6]=up_scales NULL, [7]=down_proj q8_0, [8]=down_scales NULL;
// var_axes: [0]=n_tokens
int armbench_entry_moe(const void* const* inputs, void* output,
                       const int64_t* var_axes)
{
    return armbench_llamacpp_moe(
        inputs[0],
        reinterpret_cast<const float*>(inputs[2]),
        inputs[3], inputs[5], inputs[7],
        reinterpret_cast<float*>(output),
        var_axes[0], kNEmbd, kNFf, kNExpert, kNExpertUsed, /*is_q8=*/true);
}
} // extern "C"