REleted gpu.zig and created a lib.zig to output a module

This commit is contained in:
adrien
2026-05-15 10:27:45 +02:00
parent 6018b5f0ff
commit 4725723d42
4 changed files with 11 additions and 9 deletions
-5
View File
@@ -1,5 +0,0 @@
const std = @import("std");
const c = @import("c.zig").c;
pub const GpuAllocator = @import("GpuAllocator.zig");
pub const Mat = @import("Mat.zig");
+1
View File
@@ -0,0 +1 @@
pub const GpuAllocator = @import("GpuAllocator.zig");
+5 -4
View File
@@ -1,8 +1,9 @@
const std = @import("std");
const gpu = @import("gpu.zig");
const GpuAllocator = @import("GpuAllocator.zig");
const Mat = @import("Mat.zig");
pub fn main() !void {
var gloc = try gpu.GpuAllocator.init();
var gloc = try GpuAllocator.init();
defer gloc.deinit();
// Input data: a[i] = i, b[i] = 15 - i → add should give all 15s
@@ -13,9 +14,9 @@ pub fn main() !void {
data_b[i] = @floatFromInt(15 - i);
}
const a = try gpu.Mat.load(&gloc, &data_a, 4, 4);
const a = try Mat.load(&gloc, &data_a, 4, 4);
defer a.deinit();
const b = try gpu.Mat.load(&gloc, &data_b, 4, 4);
const b = try Mat.load(&gloc, &data_b, 4, 4);
defer b.deinit();
// a + b