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>
#define FUSED_SAMPLER_MAX_BLOCKS 128
// Histogram buffer geometry for mode 3 (top-K/top-P): per row, a coarse and a refinement
// histogram (u64 mass[BUCKETS] + u32 count[BUCKETS] each) plus a control block
#define FUSED_SAMPLER_HIST_BUCKETS 1024
#define FUSED_SAMPLER_HIST_STRIDE (2 * FUSED_SAMPLER_HIST_BUCKETS * 12 + 64)
// Filter flag bits for mode 3
#define FUSED_SAMPLER_F_TOPK 1
#define FUSED_SAMPLER_F_TOPP 2
#define FUSED_SAMPLER_F_MINP 4
void fused_sampler
(
const at::Tensor& logits,
const c10::optional<at::Tensor>& logit_mask,
const c10::optional<at::Tensor>& logit_bitmask,
at::Tensor& out,
at::Tensor& workspace,
int size,
float inv_temp,
float minp_log,
uint32_t random,
int mode,
int filters,
int top_k,
float top_p,
float inv_temp_filter,
const c10::optional<at::Tensor>& histogram
);
void apply_logit_bitmask
(
const at::Tensor& logits_in,
at::Tensor& logits_out,
const at::Tensor& bitmask
);