HCC
HCC is a single-source, C/C++ compiler for heterogeneous computing. It's optimized with HSA (http://www.hsafoundation.com/).
hc_defines.h
1 #pragma once
2 
3 // C++ headers
4 #include <algorithm>
5 #include <cassert>
6 #include <chrono>
7 #include <cstdlib>
8 #include <cstring>
9 #include <exception>
10 #include <future>
11 #include <initializer_list>
12 #include <map>
13 #include <memory>
14 #include <set>
15 #include <string>
16 #include <thread>
17 #include <type_traits>
18 #include <utility>
19 #include <vector>
20 
21 // CPU execution path
22 #if __KALMAR_ACCELERATOR__ == 2 || __KALMAR_CPU__ == 2
23 #include <ucontext.h>
24 #endif
25 
26 namespace hc {
27  typedef __fp16 half;
28 }
29 
30 //
31 // work-item related builtin functions
32 //
33 extern "C" __attribute__((const,hc)) uint32_t hc_get_grid_size(unsigned int n);
34 extern "C" __attribute__((const,hc)) uint32_t hc_get_workitem_absolute_id(unsigned int n);
35 extern "C" __attribute__((const,hc)) uint32_t hc_get_group_size(unsigned int n);
36 extern "C" __attribute__((const,hc)) uint32_t hc_get_workitem_id(unsigned int n);
37 extern "C" __attribute__((const,hc)) uint32_t hc_get_num_groups(unsigned int n);
38 extern "C" __attribute__((const,hc)) uint32_t hc_get_group_id(unsigned int n);
39 
40 extern "C" __attribute__((const,amp)) uint32_t amp_get_global_size(unsigned int n);
41 extern "C" __attribute__((const,amp)) uint32_t amp_get_global_id(unsigned int n);
42 extern "C" __attribute__((const,amp)) uint32_t amp_get_local_size(unsigned int n);
43 extern "C" __attribute__((const,amp)) uint32_t amp_get_local_id(unsigned int n);
44 extern "C" __attribute__((const,amp)) uint32_t amp_get_num_groups(unsigned int n);
45 extern "C" __attribute__((const,amp)) uint32_t amp_get_group_id(unsigned int n);
46 
47 #if __KALMAR_ACCELERATOR__ == 2
48 #define tile_static thread_local
49 #else
50 #define tile_static __attribute__((tile_static))
51 #endif
52 
53 extern "C" __attribute__((noduplicate,hc)) void hc_barrier(unsigned int n);
54 extern "C" __attribute__((noduplicate,amp)) void amp_barrier(unsigned int n) ;
55 
57 #define TLS_QUEUE (1)
58 
59 
60 #ifndef CLK_LOCAL_MEM_FENCE
61 #define CLK_LOCAL_MEM_FENCE (1)
62 #endif
63 
64 #ifndef CLK_GLOBAL_MEM_FENCE
65 #define CLK_GLOBAL_MEM_FENCE (2)
66 #endif
67 
72 namespace Kalmar {
73 } // namespace Kalmar
74 
75 // Provide automatic type conversion for void*.
76 class auto_voidp {
77  void *_ptr;
78  public:
79  auto_voidp (void *ptr) : _ptr (ptr) {}
80  template<class T> operator T *() { return (T *) _ptr; }
81 };
82 
83 // Valid values for__hcc_backend__ to indicate the
84 // compiler backend
85 #define HCC_BACKEND_AMDGPU (1)
namespace for internal classes of Kalmar compiler / runtime
Definition: hc.hpp:42
Definition: hc_defines.h:76
Parallel algorithms.
Heterogeneous C++ (HC) namespace.
Definition: grid_launch.h:10