Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Each release's page on GitHub has its notes and measurements. See [the 1.0.0 rel

## Unreleased

- Hy4 Flash CUDA gains paged absorbed MLA and C1/C2 kernels with exact paging/indexed-list contracts and five-SM launch records (#5109). Thanks to @GrgaPalcic.

- Tests: the Qwen27 mixed-input Metal byte checks now run their 2,048-row cases on GPUs without tensor units too (#5587, fixes #2940).

- Server: `--confidential` refuses image, video and PDF input and loads libraries only from the engine's folder, system folders or listed CUDA names (#5344, part of #5176). Thanks to @kotevcode.
Expand Down
1 change: 1 addition & 0 deletions zig/build/cuda.zig
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ pub fn targets(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.bu
runner.addImport("hy4_engram_fp8", b.createModule(.{ .root_source_file = b.path("zig/src/families/hy4_flash/engram_fp8_cuda.zig"), .target = target, .optimize = optimize, .imports = &.{.{ .name = "cuda", .module = cuda }} }));
runner.addImport("ernie5_5_index_cuda", b.createModule(.{ .root_source_file = b.path("zig/src/families/ernie5_5/cuda_index.zig"), .target = target, .optimize = optimize, .imports = &.{.{ .name = "cuda", .module = cuda }} }));
runner.addImport("ernie5_5_mhc_cuda", b.createModule(.{ .root_source_file = b.path("zig/src/families/ernie5_5/cuda_mhc.zig"), .target = target, .optimize = optimize, .imports = &.{.{ .name = "cuda", .module = cuda }} }));
runner.addImport("hy4_mla_paged_cuda", b.createModule(.{ .root_source_file = b.path("zig/src/families/hy4_flash/mla_paged_cuda.zig"), .target = target, .optimize = optimize, .imports = &.{.{ .name = "cuda", .module = cuda }} }));
runner.addImport("gemma4_cuda", @import("gemma4_cuda.zig").module(b, target, optimize, cuda, mods.core, mods.lanes));
runner.addImport("spark25", @import("spark25.zig").module(b, target, optimize, cuda, mods.core, mods.lanes));
// the served family and its engine, for the dots runner
Expand Down
3 changes: 3 additions & 0 deletions zig/build/cuda_kernels.zig
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ pub const kernels = [_]Kernel{
.{ .name = "hy4_dfly2_glue", .src = "hy4_flash/dfly2_glue", .flags = glue },
.{ .name = "ernie5_5_index", .src = "ernie5_5/index", .flags = &.{"-O3"} }, // ours: ERNIE 5.5's DSA key lists
.{ .name = "ernie5_5_mhc", .src = "ernie5_5/mhc", .flags = &.{"-O3"} }, // ours: ERNIE 5.5's mHC pre side
.{ .name = "hy4_mla_paged", .src = "hy4_flash/mla_paged", .flags = glue },
.{ .name = "hy4_mla_attn_paged", .src = "hy4_flash/mla_attn_paged", .flags = glue },
.{ .name = "hy4_mla_c2", .src = "hy4_flash/mla_c2", .flags = glue },
.{ .name = "minimax_m3", .flags = glue }, // ours: MiniMax-M3.1-Flash's glue (norms, RoPE prep, routing, DSpark, tower RoPE)
.{ .name = "minimax_m3_attn", .flags = glue }, // ours: MiniMax-M3.1-Flash's indexer and block-sparse attention
.{ .name = "idol", .flags = glue }, // ours: Idol's denoiser glue and its fp16 head-64 attention
Expand Down
1 change: 1 addition & 0 deletions zig/kernels/cuda/contract_controls_set.cu
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@
#include "contract_int4_controls.cuh"
#include "contract_hy4_engram_fp8_controls.cuh"
#include "contract_mhc_controls.cuh"
#include "contract_hy4_mla_paged_controls.cuh"
50 changes: 50 additions & 0 deletions zig/kernels/cuda/contract_hy4_mla_paged_controls.cuh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Planted controls for hy4_mla.cu: each kernel instantiated with each tf_hy4::Fault, red at its corresponding gate.
#pragma once

#include "hy4_flash/mla_paged.cuh"

#define TF_HY4_CTL_ABSORB(tag, fault) \
extern "C" __global__ void __launch_bounds__(128) tf_ctl_hy4_mla_absorb_##tag( \
const __nv_bfloat16* q, int64_t qs, const __nv_bfloat16* kvb, float* ql, int rows, int heads) { \
tf_hy4::absorb<fault>(q, qs, kvb, ql, rows, heads); \
}

#define TF_HY4_CTL_ATTN(tag, fault) \
extern "C" __global__ void __launch_bounds__(256) tf_ctl_hy4_mla_attn_##tag( \
const float* ql, const __nv_bfloat16* qr, const __nv_bfloat16* cache, const int* pos, const int* idx, \
const float* sinks, float* ol, int heads, int window, int nidx, int ring, float scale) { \
tf_hy4::attn<fault>(ql, qr, cache, pos, idx, sinks, ol, heads, window, nidx, ring, scale); \
}

#define TF_HY4_CTL_ATTN_ROWS(tag, fault) \
extern "C" __global__ void __launch_bounds__(256) tf_ctl_hy4_mla_attn_rows_##tag( \
const float* ql, const __nv_bfloat16* qr, const unsigned long long* caches, const int* pos, const int* idx, \
const float* sinks, float* ol, int heads, int window, int nidx, int ring, float scale) { \
tf_hy4::attn_rows<fault>(ql, qr, caches, pos, idx, sinks, ol, heads, window, nidx, ring, scale); \
}

#define TF_HY4_CTL_VALUE(tag, fault) \
extern "C" __global__ void __launch_bounds__(128) tf_ctl_hy4_mla_value_##tag( \
const float* ol, const __nv_bfloat16* kvb, const __nv_bfloat16* gate, int64_t gs, __nv_bfloat16* out, \
int64_t os, int rows, int heads) { \
tf_hy4::value<fault>(ol, kvb, gate, gs, out, os, rows, heads); \
}

#define TF_HY4_CTL_POST(tag, fault) \
extern "C" __global__ void __launch_bounds__(256) tf_ctl_hy4_mla_post_##tag( \
const float* parts, int64_t plane, int world, const __nv_bfloat16* w, __nv_bfloat16* out, int width, \
float eps) { \
tf_hy4::post<fault>(parts, plane, world, w, out, width, eps); \
}

#define TF_HY4_CTL_ALL(K) \
K(bad_nan, tf_hy4::kBadNan) \
K(bad_repeat, tf_hy4::kBadRepeat) \
K(bad_tail, tf_hy4::kBadTail) \
K(bad_sums, tf_hy4::kBadSums)

TF_HY4_CTL_ALL(TF_HY4_CTL_ABSORB)
TF_HY4_CTL_ALL(TF_HY4_CTL_ATTN)
TF_HY4_CTL_ALL(TF_HY4_CTL_ATTN_ROWS)
TF_HY4_CTL_ALL(TF_HY4_CTL_VALUE)
TF_HY4_CTL_ALL(TF_HY4_CTL_POST)
Loading
Loading