This commit is contained in:
adrien 2026-05-18 23:21:26 +02:00
parent 571a9db71f
commit 523a9b69ac
2 changed files with 13 additions and 2 deletions

View File

@ -1,6 +1,7 @@
# Minimal Zig WebGPU Compute Library # Minimal Zig WebGPU Compute Library
This is a minimal, self-contained Zig library designed to simplify running compute shaders using WebGPU. It abstracts away much of the boilerplate required for GPU device initialization, memory management, and pipeline execution. This is a minimal, self-contained Zig library designed to simplify running compute shaders using WebGPU.
It abstracts away much of the boilerplate required for GPU device initialization, memory management, and pipeline execution.
## Core Modules ## Core Modules

View File

@ -27,7 +27,17 @@ pub fn main(init: std.process.Init) !void {
const add_process = try GpuProcess.init(device, @embedFile("shaders/add.wgsl")); const add_process = try GpuProcess.init(device, @embedFile("shaders/add.wgsl"));
defer add_process.deinit(); defer add_process.deinit();
for (EPOCH) |epoch| {} var train_dir = try std.Io.Dir.cwd().openDir(io, "mnist/train", .{});
var images: [BATCHSIZE * 28 * 28]f16 = undefined;
for (EPOCH) |epoch| {
// Load random images from train dir
train_dir.openDir(io, "0", .{});
for (BATCHSIZE) |i| {
const file = try train_dir.openFile(io, "0.jpg", .{});
images[28 * 28 * i .. 28 * 28 * (i + 1)] = file.read
}
}
// 4. Setup CPU data // 4. Setup CPU data
const len: usize = 16; const len: usize = 16;