Store expert gate_up_proj and down_proj weights in FP8 E4M3 (1 byte/elem) with per-expert FP32 scale factors. At inference, a fused CUDA kernel dequantizes to BF16 before the existing cuBLAS batched GEMM. Results on gpt-oss-20b (50-problem GSM8K subset): - FP8 TP=1: 47/50 = 94.0% (single RTX 5090, ~25 GB VRAM) - BF16 TP=2: 47/50 = 94.0% (requires 2× RTX 5090, ~39 GB total) No measurable accuracy degradation. Model size: 41.8 GB → 22.7 GB (−46%). New files: - tools/quantize_fp8.py: offline BF16→FP8 conversion script - csrc/quantization/dequant_fp8.cu: per-expert-scale dequant kernel - crates/xserv-kernels/src/quantization.rs: Rust FFI wrapper - tools/eval_gsm8k_batch.sh: GSM8K accuracy evaluation harness Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
30 lines
1.1 KiB
Rust
30 lines
1.1 KiB
Rust
pub mod activation;
|
|
pub mod argmax;
|
|
pub mod attention;
|
|
pub mod dispatch;
|
|
pub mod embedding;
|
|
pub mod gemm;
|
|
pub mod layernorm;
|
|
pub mod moe;
|
|
pub mod quantization;
|
|
pub mod rmsnorm;
|
|
pub mod rope;
|
|
pub mod softmax;
|
|
pub mod transpose;
|
|
|
|
pub use activation::{add, gelu, gpt_oss_glu, mul, scale, silu, silu_mul};
|
|
pub use argmax::{argmax_bf16_single, argmax_bf16_to_host};
|
|
pub use transpose::{merge_heads_gpu, repeat_kv_gpu, reshape_heads_gpu, strided_to_contiguous_gpu, transpose_for_rope_gpu, transpose_from_rope_gpu};
|
|
pub use attention::{attention, decode_attention, flash_attention, flash_attention_sinks, paged_decode_attention, paged_decode_attention_sinks, reshape_and_cache_bf16, reshape_and_cache_batched_bf16};
|
|
pub use embedding::embedding;
|
|
pub use gemm::{batched_matmul, matmul, GemmBackend};
|
|
pub use layernorm::layernorm;
|
|
pub use rmsnorm::{add_rmsnorm, rmsnorm};
|
|
pub use rope::{rope_inplace, RopeCache};
|
|
pub use softmax::softmax;
|
|
|
|
/// Register GPU kernels with the tensor crate. Call once at startup.
|
|
pub fn init() {
|
|
xserv_tensor::register_gpu_contiguous(strided_to_contiguous_gpu);
|
|
}
|