Kyojin: open-source engine that runs 100 GB-class open models (GLM-5.3, Qwen3.8, DeepSeek V4.1) on one desktop machine. AMD Strix Halo, NVIDIA RTX and Apple Mac. OpenAI API, built on ExLlamaV3.
Python amdapple-siliconcudadeepseekexl3exllamav3glminferencellmllm-inferencelocal-llmnvidiaopenai-apiquantizationqwenrocmstrix-halo
#pragma once
#include <ATen/Tensor.h>
#include <cuda_runtime.h>
#include "../graph.cuh"
// Fused int8-activation GEMV for mul1 (cb 2) tensors: single cooperative launch covering input
// Hadamard, activation quantization, dp4a GEMV and output Hadamard. EXL3_INT8_GEMV=2 (default) is
// the plain int8 mode, =1 the error-feedback residual mode (~15-16 bit effective activation
// precision), =0 disables the path. Tensors outside the mul1 codebook are unaffected. Arbitrary m is handled as
// sequential row passes within the launch, so intended for the small-m regime.
// See benchmarks/exl3_m1_bench (variants 15-18) for derivation, microbenchmarks and profiling.
bool exl3_gemv_int8_enabled();
// Highest K the int8 path accepts on `device` (per-arch, EXL3_INT8_GEMV_MAX_K override). Also
// bound to Python so the mgemm fusion heuristic can mirror the gate
int exl3_gemv_int8_max_k(int device);
// Returns true if the operation was handled (false -> caller should fall through to the regular kernel)
bool exl3_gemv_int8
(
const at::Tensor& A,
const at::Tensor& B,
at::Tensor& C,
const c10::optional<at::Tensor>& suh,
const c10::optional<at::Tensor>& A_had,
const c10::optional<at::Tensor>& svh,
cudaStream_t stream,
Graph* graph
);
// Two same-shape mul1 GEMVs over one activation tensor in a single launch (see the definition).
bool exl3_gemv_int8_pair
(
const at::Tensor& A,
const at::Tensor& B1, at::Tensor& C1, const c10::optional<at::Tensor>& suh1, const c10::optional<at::Tensor>& svh1,
const at::Tensor& B2, at::Tensor& C2, const c10::optional<at::Tensor>& suh2, const c10::optional<at::Tensor>& svh2,
cudaStream_t stream,
Graph* graph
);
bool exl3_gemv_int8_pair_eager
(
const at::Tensor& A,
const at::Tensor& B1, at::Tensor& C1, const c10::optional<at::Tensor>& suh1, const c10::optional<at::Tensor>& svh1,
const at::Tensor& B2, at::Tensor& C2, const c10::optional<at::Tensor>& suh2, const c10::optional<at::Tensor>& svh2
);
bool exl3_gemv_int8_tri
(
const at::Tensor& A,
const at::Tensor& B1, at::Tensor& C1, const c10::optional<at::Tensor>& suh1, const c10::optional<at::Tensor>& svh1,
const at::Tensor& B2, at::Tensor& C2, const c10::optional<at::Tensor>& suh2, const c10::optional<at::Tensor>& svh2,
const at::Tensor& B3, at::Tensor& C3, const c10::optional<at::Tensor>& suh3, const c10::optional<at::Tensor>& svh3,
cudaStream_t stream,
Graph* graph
);
bool exl3_gemv_int8_tri_eager
(
const at::Tensor& A,
const at::Tensor& B1, at::Tensor& C1, const c10::optional<at::Tensor>& suh1, const c10::optional<at::Tensor>& svh1,
const at::Tensor& B2, at::Tensor& C2, const c10::optional<at::Tensor>& suh2, const c10::optional<at::Tensor>& svh2,
const at::Tensor& B3, at::Tensor& C3, const c10::optional<at::Tensor>& suh3, const c10::optional<at::Tensor>& svh3
);