fix(linear): add bias once, not once per SIMD lane
acc was seeded with @splat(bias) and reduced with .Add, so every linear output carried 7 extra copies of its bias. conv2d was unaffected (bias via memset), which is why the trunk matched zig-solver to 5e-6 while fc/head activations diverged — the 81% labels regression. Also adds a scalar tail for in_n < 8 (pose_fc has in_n=4) and a known-answer selftest (test_linear). 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
This commit is contained in:
1 parent
d401f6b07e
commit
a2ff07234c
3 files changed
+54
-9
No files matched your search
@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
// The library module — what downstream consumers import.
|
||||
const crucible_mod = b.addModule("crucible", .{
|
||||
const cruc_mod = b.addModule("crucible", .{
|
||||
.root_source_file = b.path("src/crucible.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
@@ -14,19 +14,18 @@ pub fn build(b: *std.Build) void {
|
||||
// Static lib artifact (optional install).
|
||||
const lib = b.addLibrary(.{
|
||||
.name = "crucible",
|
||||
.root_module = crucible_mod,
|
||||
.root_module = cruc_mod,
|
||||
});
|
||||
b.installArtifact(lib);
|
||||
|
||||
// Example executable: stripsolver (needs a tests/ png decoder? no —
|
||||
// example is self-contained: it uses crucible only for state dict +
|
||||
// layers; arm input comes from CSV).
|
||||
// Example executable: stripsolver (self-contained: uses crucible only
|
||||
// for state dict + layers; arm input comes from CSV).
|
||||
const example_mod = b.createModule(.{
|
||||
.root_source_file = b.path("examples/stripsolver.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.imports = &.{
|
||||
.{ .name = "crucible", .module = crucible_mod },
|
||||
.{ .name = "crucible", .module = cruc_mod },
|
||||
},
|
||||
});
|
||||
const example = b.addExecutable(.{
|
||||
@@ -41,8 +40,20 @@ pub fn build(b: *std.Build) void {
|
||||
const run_step = b.step("run", "Run the stripsolver example");
|
||||
run_step.dependOn(&run_example.step);
|
||||
|
||||
// linear selftest
|
||||
const tl_mod = b.createModule(.{
|
||||
.root_source_file = b.path("examples/test_linear.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.imports = &.{
|
||||
.{ .name = "crucible", .module = cruc_mod },
|
||||
},
|
||||
});
|
||||
const tl = b.addExecutable(.{ .name = "test_linear", .root_module = tl_mod });
|
||||
b.installArtifact(tl);
|
||||
|
||||
// Unit tests.
|
||||
const tests = b.addTest(.{ .root_module = crucible_mod });
|
||||
const tests = b.addTest(.{ .root_module = cruc_mod });
|
||||
const run_tests = b.addRunArtifact(tests);
|
||||
const test_step = b.step("test", "Run unit tests");
|
||||
test_step.dependOn(&run_tests.step);
|
||||
|
||||
Reference in new issue
Block a user