1#include <gpuintrin.h>
2#include <stdint.h>
3
4extern __gpu_local uint32_t shared_mem[];
5
6__gpu_kernel void localmem(uint32_t *out) {
7 shared_mem[__gpu_thread_id(0)] = __gpu_thread_id(0);
8 shared_mem[__gpu_thread_id(0)] *= 2;
9 out[__gpu_thread_id(0) + (__gpu_num_threads(0) * __gpu_block_id(0))] =
10 shared_mem[__gpu_thread_id(0)];
11}
12

source code of offload/unittests/OffloadAPI/device_code/localmem.c