Skip to content

Commit a58516e

Browse files
make checkerboard sample work with CUDA
1 parent 1832a64 commit a58516e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

samples/checkerboard/checkerboard.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ int main(int argc, char **argv)
7272
driver_load_source_file(&compiler_config, SrcSlim, sizeof(checkerboard_kernel_src), checkerboard_kernel_src, m);
7373
Program* program = new_program_from_module(runtime, &compiler_config, m);
7474

75-
wait_completion(launch_kernel(program, device, "main", 16, 16, 1, 1, (void*[]) { &buf_addr }));
75+
wait_completion(launch_kernel(program, device, "checkerboard", 16, 16, 1, 1, (void*[]) { &buf_addr }));
7676

7777
copy_from_buffer(buf, 0, img, buf_size);
7878
info_print("data %d\n", (int) img[0]);
7979

8080
destroy_buffer(buf);
8181

8282
shutdown_runtime(runtime);
83-
saveppm("ao.ppm", WIDTH, HEIGHT, img);
83+
saveppm("checkerboard.ppm", WIDTH, HEIGHT, img);
8484
destroy_ir_arena(a);
8585
free(img);
8686
}

samples/checkerboard/checkerboard_kernel.slim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const i32 HEIGHT = 256;
44
@Builtin("GlobalInvocationId")
55
uniform input pack[u32; 3] global_id;
66

7-
@EntryPoint("Compute") @WorkgroupSize(16, 16, 1) fn main(uniform ptr global [u8] p) {
7+
@EntryPoint("Compute") @WorkgroupSize(16, 16, 1) fn checkerboard(uniform ptr global [u8] p) {
88
val thread_id = global_id;
99
val x = reinterpret[i32](thread_id#0);
1010
val y = reinterpret[i32](thread_id#1);

0 commit comments

Comments
 (0)