-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
140 lines (125 loc) · 4.78 KB
/
Copy pathbuild.zig
File metadata and controls
140 lines (125 loc) · 4.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// Create the main library module
const mod = b.addModule("powerglide", .{
.root_source_file = b.path("src/root.zig"),
.target = target,
.link_libc = true,
});
// Add clap dependency - available from build.zig.zon
const clap = b.dependency("clap", .{});
mod.addImport("clap", clap.module("clap"));
// Add vaxis dependency - available from build.zig.zon
const vaxis = b.dependency("vaxis", .{});
mod.addImport("vaxis", vaxis.module("vaxis"));
// Main executable
const exe = b.addExecutable(.{
.name = "powerglide",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
.imports = &.{
.{ .name = "powerglide", .module = mod },
},
}),
});
b.installArtifact(exe);
// Run step
const run_step = b.step("run", "Run the app");
const run_cmd = b.addRunArtifact(exe);
run_step.dependOn(&run_cmd.step);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
// Library tests
const mod_tests = b.addTest(.{
.root_module = mod,
});
const run_mod_tests = b.addRunArtifact(mod_tests);
// Executable tests
const exe_tests = b.addTest(.{
.root_module = exe.root_module,
});
const run_exe_tests = b.addRunArtifact(exe_tests);
// Combined test step
const test_step = b.step("test", "Run tests");
test_step.dependOn(&run_mod_tests.step);
test_step.dependOn(&run_exe_tests.step);
// Trial harness executable (examples/trial.zig)
const trial_exe = b.addExecutable(.{
.name = "trial",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/trial.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
.imports = &.{
.{ .name = "powerglide", .module = mod },
},
}),
});
b.installArtifact(trial_exe);
const trial_step = b.step("trial", "Run the igllama agentic trial harness");
const trial_cmd = b.addRunArtifact(trial_exe);
trial_cmd.step.dependOn(b.getInstallStep());
trial_step.dependOn(&trial_cmd.step);
// Quantization variant trial harness (examples/trial_quant.zig)
const trial_quant_exe = b.addExecutable(.{
.name = "trial-quant",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/trial_quant.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
.imports = &.{
.{ .name = "powerglide", .module = mod },
},
}),
});
b.installArtifact(trial_quant_exe);
const trial_quant_step = b.step("trial-quant", "Run the igllama quantization sensitivity harness (T01-T17 x Q4/Q5/Q6/Q8/BF16 across all 4 weight classes)");
const trial_quant_cmd = b.addRunArtifact(trial_quant_exe);
trial_quant_cmd.step.dependOn(b.getInstallStep());
trial_quant_step.dependOn(&trial_quant_cmd.step);
// Throughput benchmark (examples/bench.zig)
const bench_exe = b.addExecutable(.{
.name = "bench",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/bench.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
.imports = &.{
.{ .name = "powerglide", .module = mod },
},
}),
});
b.installArtifact(bench_exe);
const bench_step = b.step("bench", "Run the igllama throughput benchmark (tokens/sec across Q4/Q8/BF16 x all weight classes)");
const bench_cmd = b.addRunArtifact(bench_exe);
bench_cmd.step.dependOn(b.getInstallStep());
bench_step.dependOn(&bench_cmd.step);
// Context length sensitivity harness (examples/ctx_sensitivity.zig)
const ctx_exe = b.addExecutable(.{
.name = "ctx-sensitivity",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/ctx_sensitivity.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
.imports = &.{
.{ .name = "powerglide", .module = mod },
},
}),
});
b.installArtifact(ctx_exe);
const ctx_step = b.step("ctx", "Run the context length sensitivity harness (2B-Q6 × ctx-size 512/1024/2048/4096 × T01-T17)");
const ctx_cmd = b.addRunArtifact(ctx_exe);
ctx_cmd.step.dependOn(b.getInstallStep());
ctx_step.dependOn(&ctx_cmd.step);
}