From 1b8d0ac627899c84b0e0bd3f2583f2fbb949b59c Mon Sep 17 00:00:00 2001 From: Foke Singh Date: Fri, 12 Dec 2025 14:00:50 +0000 Subject: [PATCH] =?UTF-8?q?Update=20callback=20example=20to=20use=20`takeD?= =?UTF-8?q?elimiterInclusive`=20for=20Zig=E2=80=AF0.15.2=20delimiter=20beh?= =?UTF-8?q?avior=20change.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/callback/main.zig | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/examples/callback/main.zig b/examples/callback/main.zig index 955ce9a..5f20700 100644 --- a/examples/callback/main.zig +++ b/examples/callback/main.zig @@ -82,11 +82,7 @@ pub const GrayScale = struct { } pub fn grayScaleCuda(self: GrayScale, rgb_d: zml.Buffer, gray_d: zml.Buffer) !void { - var args: [2][]u8 = .{ - @as([*]u8, @ptrFromInt(rgb_d.devicePtr()))[0..rgb_d.shape().byteSize()], - @as([*]u8, @ptrFromInt(gray_d.devicePtr()))[0..gray_d.shape().byteSize()], - }; - var args_ptr: [2:null]?*anyopaque = .{ @ptrCast(&args[0]), @ptrCast(&args[1]) }; + var args: [2:null]?*anyopaque = .{ rgb_d.devicePtr(), gray_d.devicePtr() }; // This is a naive kernel with one block per pixel. try cuda.check(cuda.launchKernel.?( @ptrCast(self.cu_data[1]), // function @@ -98,7 +94,7 @@ pub const GrayScale = struct { 1, // num grids z 0, // shared mem @ptrCast(self.stream), - &args_ptr, + &args, null, )); // Note: no explicit synchronization, we just enqueue work in the stream.