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
11 changes: 11 additions & 0 deletions docs/kernel-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,17 @@ for a row whose tile or block reads a non-finite value at a key masked for that
`gemma_decode_attention` for a decode row whose 32-key step reads one: P = 0 times Inf inside the P x V mma, where
float64 leaves the masked key out. These were seen on the M5, where their cases run. Each kernel has an entry of its own
that plants such a value and carries the finding, so its other entries keep a clean gate 1.
Hy4-flash's `tf_hy4_attend_chunks` and `tf_hy4_attend_scored` give NaN for a row and head whose 512-key chunk starts
with a -Inf score, where float64 leaves that key out: the running max is still -Inf there, so the first rescale is
exp(-Inf - -Inf). Its `tf_hy4_attend_nax` gives NaN for a row whose 32-key tile reads a non-finite value at a key it
masks (0 x Inf inside the P x V mma), and 0 for a row whose every score is NaN, where float64 gives NaN: Metal's `max`
drops the NaN, so the running max stays -Inf and the kernel's guard weighs every key 0. Each has an entry of its own.
Hy4-flash's `tf_hy4_route_select_rank` ranks a NaN key 0, since every comparison with it is false, so it races the
row's best expert for the first pick; the core select it stands beside never picks a NaN key.
Hy4-flash's `tf_hy4_group_scores` scores a NaN dot as 0 where float64 keeps the NaN: its relu is `max(dot, 0.0f)`.
Hy4-flash's SwiGLU clip, in `tf_affine_experts_up_4` and `_8` and in affine_mm's `am_swiglu`, gives a finite output for
a NaN gate or up sum where float64 keeps the NaN: `min(gate, 10)` and `clamp(up, -10, 10)` drop it. Its 4-bit tensor
gathers carry affine_mm's +128 code offset finding above.

HIP’s MLX stream tile keeps its finite dot2 sums unchanged. A non-finite result with an actual non-finite
operand is recomputed by full quantization groups using the factored float64 formula. The plain tile is
Expand Down
19 changes: 19 additions & 0 deletions zig/src/core/contract/hy4_attend_records.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//! Hy4-flash's attend launches on Metal (tests/contract/metal_hy4_attend.zig), M1 and M2 limits from --offline.
const std = @import("std");
const M = @import("limits.zig").MetalLaunch;
/// Attention.attend's 128-thread groups; scored stages 16 keys in threadgroup memory; controls compile their edits.
pub const records = [_]M{
.{ .name = "hy4 mla_attention tf_hy4_attend_chunks", .threads = 128, .tg_memory = 0, .m1 = 640, .m2 = 640 },
.{ .name = "hy4 mla_attention tf_hy4_attend_merge", .threads = 128, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 mla_attention tf_hy4_attend_scores", .threads = 128, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 mla_attention tf_hy4_attend_scored", .threads = 128, .tg_memory = 16384, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 mla_attention control drop-last tf_hy4_attend_chunks", .threads = 128, .tg_memory = 0, .m1 = 640, .m2 = 640 },
.{ .name = "hy4 mla_attention control no-sink tf_hy4_attend_merge", .threads = 128, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 mla_attention control half-sums tf_hy4_attend_chunks", .threads = 128, .tg_memory = 0, .m1 = 768, .m2 = 768 },
.{ .name = "hy4 mla_attention control skip-nan tf_hy4_attend_merge", .threads = 128, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 mla_attention control shuffle tf_hy4_attend_scored", .threads = 128, .tg_memory = 16384, .m1 = 1024, .m2 = 1024 },
};

test "Hy4-flash's attend launches fit every Apple family" {
try std.testing.expectEqual(@as(usize, 0), try @import("registry.zig").checkMetal(std.testing.allocator, &records, true));
}
44 changes: 44 additions & 0 deletions zig/src/core/contract/hy4_experts_records.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//! Hy4-flash's experts launches on Metal (tests/contract/metal_hy4_experts*.zig), M1 and M2 limits from --offline.
const M = @import("limits.zig").MetalLaunch;

/// affine_experts_metal.Kernels.run: four simdgroups a group, one output each, no threadgroup memory.
fn portable(comptime name: []const u8, m1: u32, m2: u32) M {
return .{ .name = "hy4 affine_experts " ++ name, .threads = 128, .tg_memory = 0, .m1 = m1, .m2 = m2 };
}

/// metal_tensor_experts' affine_mm (tensor units only): row sums 24 groups wide, every product 128 threads.
fn units(comptime bits: []const u8) [8]M {
const head = "hy4 units affine_mm " ++ bits ++ " ";
var out: [8]M = undefined;
out[0] = .{ .name = head ++ "tf_affine_row_sums", .threads = 24, .tg_memory = 0, .offline = false };
// every pipeline the loader builds; Hy4's rows a job launch only the 32-row GLU and scatter gathers
inline for (.{ "tf_affine_mm", "tf_affine_gather_32", "tf_affine_gather_64", "tf_affine_gather_scatter_32", "tf_affine_gather_scatter_64", "tf_affine_gather_glu_32", "tf_affine_gather_glu_64" }, 1..) |f, i| {
out[i] = .{ .name = head ++ f, .threads = 128, .tg_memory = 9728, .offline = false };
}
return out;
}

/// tensor_dispatch.metal (tensor units only): the row split's 128 threads, the job tables' one group of 256 or 1,024.
fn dispatch(comptime name: []const u8, threads: u32, tg: u32) M {
return .{ .name = "hy4 units tensor_dispatch " ++ name, .threads = threads, .tg_memory = tg, .reserved = if (threads > 256) threads else 0, .offline = false };
}

pub const records = [_]M{
portable("tf_affine_experts_up_4", 928, 928),
portable("tf_affine_experts_down_4", 1024, 1024),
portable("tf_affine_experts_up_8", 928, 928),
portable("tf_affine_experts_down_8", 1024, 1024),
portable("silu-unrounded tf_affine_experts_up_4", 928, 928),
portable("weight-unrounded tf_affine_experts_down_8", 1024, 1024),
portable("half-sums tf_affine_experts_down_4", 1024, 1024),
} ++ units("q4") ++ units("q8") ++ [_]M{
.{ .name = "hy4 units affine_mm q4 map-ignored-glu tf_affine_gather_glu_32", .threads = 128, .tg_memory = 9728, .offline = false },
.{ .name = "hy4 units affine_mm q8 mlx-sigmoid tf_affine_gather_glu_32", .threads = 128, .tg_memory = 9728, .offline = false },
.{ .name = "hy4 units affine_mm q8 map-ignored-scatter tf_affine_gather_scatter_32", .threads = 128, .tg_memory = 9728, .offline = false },
dispatch("tf_hy4_qkv_split", 128, 0),
dispatch("tf_hy4_active_experts", 256, 32),
dispatch("tf_hy4_group_pairs", 1024, 20608),
dispatch("kv-short tf_hy4_qkv_split", 128, 0),
dispatch("pair0-dropped tf_hy4_active_experts", 256, 32),
dispatch("own-row tf_hy4_group_pairs", 1024, 20608),
};
34 changes: 34 additions & 0 deletions zig/src/core/contract/hy4_ihc_records.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//! Hy4-flash's ihc and DFly2 glue launches on Metal (tests/contract/metal_hy4_ihc.zig), M1/M2 limits from --offline.
const std = @import("std");
const M = @import("limits.zig").MetalLaunch;
pub const records = [_]M{
.{ .name = "hy4 ihc tf_hy4_ihc_collapse_g4", .threads = 256, .tg_memory = 304, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 ihc tf_hy4_ihc_collapse_g8", .threads = 256, .tg_memory = 304, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 ihc tf_hy4_ihc_partials_g4", .threads = 32, .tg_memory = 0, .m1 = 928, .m2 = 928 },
.{ .name = "hy4 ihc tf_hy4_ihc_partials_g8", .threads = 32, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 ihc tf_hy4_ihc_finish_g4", .threads = 256, .tg_memory = 16, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 ihc tf_hy4_ihc_finish_g8", .threads = 256, .tg_memory = 16, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 ihc tf_hy4_tail_g4", .threads = 256, .tg_memory = 640, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 ihc tf_hy4_tail_g8", .threads = 256, .tg_memory = 640, .m1 = 832, .m2 = 832 },
.{ .name = "hy4 ihc tf_hy4_head_g4", .threads = 256, .tg_memory = 64, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 ihc tf_hy4_head_g8", .threads = 256, .tg_memory = 64, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 ihc tf_hy4_seam_g4", .threads = 256, .tg_memory = 704, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 ihc tf_hy4_seam_g8", .threads = 256, .tg_memory = 704, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 ihc tf_hy4_ihc_add", .threads = 256, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 ihc tf_hy4_draft_fuse", .threads = 128, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 ihc tf_hy4_draft_residual", .threads = 128, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
// the planted controls' pipelines, each compiled from its own edit of ihc.metal
.{ .name = "hy4 ihc control flush tf_hy4_ihc_collapse_g8", .threads = 256, .tg_memory = 304, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 ihc control seven tf_hy4_ihc_collapse_g8", .threads = 256, .tg_memory = 304, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 ihc control half tf_hy4_ihc_collapse_g8", .threads = 256, .tg_memory = 304, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 ihc control slot0 tf_hy4_ihc_finish_g8", .threads = 256, .tg_memory = 16, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 ihc control unweighted tf_hy4_tail_g8", .threads = 256, .tg_memory = 640, .m1 = 832, .m2 = 832 },
.{ .name = "hy4 ihc control once tf_hy4_seam_g8", .threads = 256, .tg_memory = 704, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 ihc control onegate tf_hy4_ihc_add", .threads = 256, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 ihc control gain0 tf_hy4_draft_fuse", .threads = 128, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 ihc control subtract tf_hy4_draft_residual", .threads = 128, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
};

test "Hy4-flash's ihc launches fit every Apple family" {
try std.testing.expectEqual(@as(usize, 0), try @import("registry.zig").checkMetal(std.testing.allocator, &records, true));
}
18 changes: 18 additions & 0 deletions zig/src/core/contract/hy4_index_records.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//! Hy4-flash's index launches on Metal with --offline's M1/M2 limits; a word before the function names a control.
const std = @import("std");
const M = @import("limits.zig").MetalLaunch;
pub const records = [_]M{
.{ .name = "hy4 index_build tf_hy4_index_keys", .threads = 128, .tg_memory = 16, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 index_build unrounded tf_hy4_index_keys", .threads = 128, .tg_memory = 16, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 index_build tf_hy4_index_groups", .threads = 128, .tg_memory = 2064, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 index_build slot0-bias tf_hy4_index_groups", .threads = 128, .tg_memory = 2064, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 index_recall tf_hy4_group_scores", .threads = 128, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 index_recall head15 tf_hy4_group_scores", .threads = 128, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 index_recall tf_hy4_recall_groups", .threads = 256, .tg_memory = 3152, .m1 = 928, .m2 = 928 },
.{ .name = "hy4 index_recall signed-zero tf_hy4_recall_groups", .threads = 256, .tg_memory = 3152, .m1 = 928, .m2 = 928 },
.{ .name = "hy4 index_recall own-token tf_hy4_recall_groups", .threads = 256, .tg_memory = 3152, .m1 = 928, .m2 = 928 },
};

test "Hy4-flash's index launches fit every Apple family" {
try std.testing.expectEqual(@as(usize, 0), try @import("registry.zig").checkMetal(std.testing.allocator, &records, true));
}
30 changes: 30 additions & 0 deletions zig/src/core/contract/hy4_lane_records.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//! Hy4-flash's tensor-unit lane projections at each served width: reg kernel, inline-sums twin and sums pass.
const std = @import("std");
const M = @import("limits.zig").MetalLaunch;

/// [n, k, K splits]: the dense projections, then the q/kv inputs and the queries at 64 and 32 heads.
pub const shapes = [_][3]u32{
.{ 3072, 16384, 8 }, .{ 3072, 8192, 8 }, .{ 1536, 3072, 4 }, .{ 3072, 1536, 2 },
.{ 13824, 3072, 4 }, .{ 3072, 13824, 8 }, .{ 120832, 3072, 4 }, .{ 17984, 3072, 4 },
.{ 9792, 3072, 4 }, .{ 16384, 1024, 2 }, .{ 8192, 1024, 2 },
};

/// Reg threadgroup bytes: later splits' 16 x 32 fp32 partials, plus inline sums' K splits x groups a split x 16 rows.
fn regBytes(k: u32, sk: u32, sums: bool) u32 {
const groups = k / 64;
return (sk - 1) * 2048 + if (sums) sk * ((groups + sk - 1) / sk) * 16 * 4 else 0;
}

pub const records = blk: {
@setEvalBranchQuota(20000);
var out: [shapes.len * 2 * 3]M = undefined;
var at = 0;
for ([_]u32{ 4, 8 }) |bits| for (shapes) |s| {
const head = std.fmt.comptimePrint("hy4 units lane q{d} n{d} k{d} sk{d}", .{ bits, s[0], s[1], s[2] });
out[at] = .{ .name = head ++ " tf_lane_reg", .threads = 32 * s[2], .tg_memory = regBytes(s[1], s[2], false), .offline = false };
out[at + 1] = .{ .name = head ++ " inline tf_lane_reg", .threads = 32 * s[2], .tg_memory = regBytes(s[1], s[2], true), .offline = false };
out[at + 2] = .{ .name = head ++ " tf_lane_sums", .threads = 256, .tg_memory = 0, .m1 = 1024, .m2 = 1024 };
at += 3;
};
break :blk out;
};
16 changes: 16 additions & 0 deletions zig/src/core/contract/hy4_nax_records.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//! Hy4-flash's nax launches on Metal (tests/contract/metal_hy4_nax*.zig), as mla_metal.zig's Nax encodes them.
const std = @import("std");
const M = @import("limits.zig").MetalLaunch;
// nax.h's tensor ops keep every pipeline but the combine from an M1/M2 build ahead of time: 128 threads each.
pub const records = [_]M{
.{ .name = "hy4 units mla_nax tf_hy4_absorb_nax", .threads = 128, .tg_memory = 0, .offline = false },
.{ .name = "hy4 units mla_nax tf_hy4_expand_gated_nax", .threads = 128, .tg_memory = 0, .offline = false },
// part[4][16][32] floats: each simdgroup's slice of a tile's scores
.{ .name = "hy4 units mla_nax tf_hy4_attend_nax", .threads = 128, .tg_memory = 4 * 16 * 32 * 4, .offline = false },
.{ .name = "hy4 units mla_nax tf_hy4_attend_nax_split", .threads = 128, .tg_memory = 4 * 16 * 32 * 4, .offline = false },
.{ .name = "hy4 units mla_nax tf_hy4_attend_combine", .threads = 128, .tg_memory = 0, .m1 = 928, .m2 = 928 },
};

test "Hy4-flash's nax launches fit every Apple family" {
try std.testing.expectEqual(@as(usize, 0), try @import("registry.zig").checkMetal(std.testing.allocator, &records, true));
}
20 changes: 20 additions & 0 deletions zig/src/core/contract/hy4_project_records.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//! Hy4-flash's project launches on Metal (tests/contract/metal_hy4_project.zig), M1/M2 limits from --offline.
const M = @import("limits.zig").MetalLaunch;
pub const records = [_]M{
.{ .name = "hy4 mla_project tf_hy4_rotary_table", .threads = 32, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 mla_project tf_hy4_rotate", .threads = 32, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 mla_project tf_hy4_cache_keys", .threads = 128, .tg_memory = 16, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 mla_project tf_hy4_gate_values", .threads = 128, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 mla_project tf_hy4_absorb_q", .threads = 32, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 mla_project tf_hy4_expand_v", .threads = 32, .tg_memory = 0, .m1 = 928, .m2 = 928 },
.{ .name = "hy4 mla_project tf_hy4_expand_v_gated", .threads = 32, .tg_memory = 0, .m1 = 928, .m2 = 928 },
// the planted controls' own pipelines (metal_hy4_project.zig's controls)
.{ .name = "hy4 mla_project time-axis tf_hy4_rotary_table", .threads = 32, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 mla_project turned-back tf_hy4_rotate", .threads = 32, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 mla_project norm-unrounded tf_hy4_cache_keys", .threads = 128, .tg_memory = 16, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 mla_project gate-unrounded tf_hy4_gate_values", .threads = 128, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 mla_project short-sum tf_hy4_absorb_q", .threads = 32, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 mla_project half-sum tf_hy4_absorb_q", .threads = 32, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 mla_project short-sum tf_hy4_expand_v", .threads = 32, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 mla_project gate-unrounded tf_hy4_expand_v_gated", .threads = 32, .tg_memory = 0, .m1 = 928, .m2 = 928 },
};
10 changes: 10 additions & 0 deletions zig/src/core/contract/hy4_records.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//! Hy4-flash's launches: a records file for each group of tests/contract/metal_hy4_*.zig.
pub const metal = @import("hy4_index_records.zig").records ++
@import("hy4_project_records.zig").records ++
@import("hy4_attend_records.zig").records ++
@import("hy4_nax_records.zig").records ++
@import("hy4_ihc_records.zig").records ++
@import("hy4_route_records.zig").records ++
@import("hy4_experts_records.zig").records ++
@import("hy4_rows_records.zig").records ++
@import("hy4_lane_records.zig").records;
20 changes: 20 additions & 0 deletions zig/src/core/contract/hy4_route_records.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//! Hy4-flash's route launches on Metal (tests/contract/metal_hy4_route*.zig), M1 and M2 limits from --offline.
const std = @import("std");
const M = @import("limits.zig").MetalLaunch;
// The last four are the planted controls' texts; tf_add_bf16 at Nemotron's groups of 256 (Hy4 never dispatches it).
pub const records = [_]M{
.{ .name = "hy4 moe_route tf_route_logits", .threads = 256, .tg_memory = 512, .m1 = 896, .m2 = 896 },
.{ .name = "hy4 moe_route tf_route_select", .threads = 512, .tg_memory = 9408, .m1 = 576, .m2 = 576 },
.{ .name = "hy4 route_rows tf_hy4_route_select_rows", .threads = 32, .tg_memory = 0, .m1 = 640, .m2 = 640 },
.{ .name = "hy4 route_rows tf_hy4_route_select_rank", .threads = 512, .tg_memory = 2112, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 affine_experts tf_hy4_routed_sum", .threads = 128, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 elementwise tf_add_bf16", .threads = 256, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 moe_route half-sums tf_route_logits", .threads = 256, .tg_memory = 512, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 route_rows nan-picked tf_hy4_route_select_rows", .threads = 32, .tg_memory = 0, .m1 = 640, .m2 = 640 },
.{ .name = "hy4 route_rows ties-high tf_hy4_route_select_rank", .threads = 512, .tg_memory = 2112, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 affine_experts half-sums tf_hy4_routed_sum", .threads = 128, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
};

test "Hy4-flash's route launches fit every Apple family" {
try std.testing.expectEqual(@as(usize, 0), try @import("registry.zig").checkMetal(std.testing.allocator, &records, true));
}
22 changes: 22 additions & 0 deletions zig/src/core/contract/hy4_rows_records.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//! Hy4-flash's rows launches on Metal (tests/contract/metal_hy4_rows.zig) with the M1 and M2 limits --offline recorded.
const M = @import("limits.zig").MetalLaunch;
pub const records = [_]M{
// rows.metal on the wide core row source (metal_linears.zig's Rows.load), the same text on every chip
.{ .name = "hy4 rows tf_hy4_rows_r2_q4", .threads = 128, .tg_memory = 0, .m1 = 384, .m2 = 384 },
.{ .name = "hy4 rows tf_hy4_rows_r2_q8", .threads = 128, .tg_memory = 0, .m1 = 384, .m2 = 384 },
.{ .name = "hy4 rows bad-tail tf_hy4_rows_r2_q4", .threads = 128, .tg_memory = 0, .m1 = 384, .m2 = 384 },
.{ .name = "hy4 rows tf_hy4_argmax", .threads = 1024, .tg_memory = 256, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 rows bad-tie tf_hy4_argmax", .threads = 1024, .tg_memory = 256, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 rows bad-nan tf_hy4_argmax", .threads = 1024, .tg_memory = 256, .m1 = 1024, .m2 = 1024 },
// engram.metal (metal_engram.zig's Kernels.load)
.{ .name = "hy4 engram tf_hy4_engram_lookup", .threads = 32, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 engram bad-scale tf_hy4_engram_lookup", .threads = 32, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 engram tf_hy4_engram_apply", .threads = 128, .tg_memory = 80, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 engram bad-gain tf_hy4_engram_apply", .threads = 128, .tg_memory = 80, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 engram tf_hy4_engram_gather", .threads = 256, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 engram bad-group tf_hy4_engram_gather", .threads = 256, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
// core embed_norm.metal's lookups at Hy4's hidden width (metal_model.zig's Head.upload)
.{ .name = "hy4 embed_norm tf_embed_b4_g64", .threads = 128, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 embed_norm tf_embed_b8_g64", .threads = 128, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
.{ .name = "hy4 embed_norm bad-round tf_embed_b4_g64", .threads = 128, .tg_memory = 0, .m1 = 1024, .m2 = 1024 },
};
Loading
Loading