| 1 | #include <gpuintrin.h> |
|---|---|
| 2 | #include <stdint.h> |
| 3 | |
| 4 | [[gnu::visibility("default")]] |
| 5 | uint32_t global[64]; |
| 6 | |
| 7 | __gpu_kernel void write() { |
| 8 | global[__gpu_thread_id(dim: 0)] = __gpu_thread_id(dim: 0); |
| 9 | global[__gpu_thread_id(dim: 0)] *= 2; |
| 10 | } |
| 11 | |
| 12 | __gpu_kernel void read(uint32_t *out) { |
| 13 | out[__gpu_thread_id(dim: 0) + (__gpu_num_threads(dim: 0) * __gpu_block_id(dim: 0))] = |
| 14 | global[__gpu_thread_id(dim: 0)]; |
| 15 | } |
| 16 |
