1#include <clc/clc.h>
2
3#if __clang_major__ >= 8
4#define CONST_AS __constant
5#elif __clang_major__ >= 7
6#define CONST_AS __attribute__((address_space(4)))
7#else
8#define CONST_AS __attribute__((address_space(2)))
9#endif
10
11_CLC_DEF _CLC_OVERLOAD size_t get_global_offset(uint dim) {
12  CONST_AS uint *ptr = (CONST_AS uint *)__builtin_amdgcn_implicitarg_ptr();
13  if (dim < 3)
14    return ptr[dim + 1];
15  return 0;
16}
17