Skip to content

Commit dfea371

Browse files
authored
Merge pull request shady-gang#36 from shady-gang/fix-checkerboard
make checkerboard sample work with CUDA
2 parents e7d5bc4 + a58516e commit dfea371

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
@@ -73,15 +73,15 @@ int main(int argc, char **argv)
7373
error("Failed to load checkerboard module");
7474
Program* program = new_program_from_module(runtime, &compiler_config, m);
7575

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

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

8181
destroy_buffer(buf);
8282

8383
shutdown_runtime(runtime);
84-
saveppm("ao.ppm", WIDTH, HEIGHT, img);
84+
saveppm("checkerboard.ppm", WIDTH, HEIGHT, img);
8585
destroy_ir_arena(a);
8686
free(img);
8787
}

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)