ae2f_docs
Loading...
Searching...
No Matches
wrkitem.h
1/**
2 * @file wrkgroup.h
3 * @brief
4 * Work Item Functions
5 *
6 * @see https://registry.khronos.org/OpenCL/sdk/3.0/docs/man/html/get_work_dim.html
7 * */
8
9#ifndef ae2fVK_clspv_wrkitem_h
10#define ae2fVK_clspv_wrkitem_h
11
12#include "./sclr.h"
13
15/**
16 * @brief
17 * Returns the number of dimensions in use. \n
18 * This is the value given to the work_dim argument specified in clEnqueueNDRangeKernel.
19 * */
20uint get_work_dim();
21
22/**
23 * @brief
24 * Returns the number of global work-items specified for dimension identified by dimindx. \n
25 * This value is given by the global_work_size argument to clEnqueueNDRangeKernel.
26 *
27 * @param dimindx
28 * Valid values of dimindx are 0 to get_work_dim() - 1. \n
29 * For other values of dimindx, get_global_size() returns 1.
30 * */
31size_t get_global_size(uint dimindx);
32
33/**
34 * @brief
35 * Returns the unique global work-item ID value for dimension identified by dimindx. \n
36 * The global work-item ID specifies the work-item ID based on the number of global work-items specified to execute the kernel.
37 *
38 * @param dimindx
39 * Valid values of dimindx are 0 to get_work_dim() - 1. \n
40 * For other values of dimindx, get_global_id() returns 0.
41 * */
42size_t get_global_id(uint dimindx);
43
44/**
45 * @returns
46 * Returns the number of local work-items specified in dimension identified by dimindx. \n
47 *
48 * @details
49 * This value is at most the value given by the local_work_size argument to clEnqueueNDRangeKernel if local_work_size is not NULL; \n
50 * otherwise the OpenCL implementation chooses an appropriate local_work_size value which is returned by this function.
51 *
52 * If the kernel is executed with a non-uniform work-group size [1], \n
53 * calls to this built-in from some work-groups may return different values than calls to this built-in from other work-groups.
54 *
55 * @param dimindx
56 * Valid values of dimindx are 0 to get_work_dim() - 1. \n
57 * For other values of dimindx, get_local_size() returns 1.
58 * */
59size_t get_local_size(uint dimindx);
60
61/**
62 * @brief
63 * Returns the unique local work-item ID, \n
64 * i.e. a work-item within a specific work-group for dimension identified by dimindx.
65 *
66 * @param dimindx
67 * Valid values of dimindx are 0 to get_work_dim() - 1. \n
68 * For other values of dimindx, get_local_id() returns 0.
69 * */
70size_t get_local_id(uint dimindx);
71
72/**
73 * @returns
74 * Returns the number of work-groups that will execute a kernel for dimension identified by dimindx.
75 *
76 * @param dimindx
77 * Valid values of dimindx are 0 to get_work_dim() - 1. \n
78 * For other values of dimindx, get_num_groups() returns 1.
79 * */
80size_t get_num_groups(uint dimindx);
81
82
83/**
84 * @returns
85 * the offset values specified in global_work_offset argument to clEnqueueNDRangeKernel.
86 *
87 * @param dimindx
88 * Valid values of dimindx are 0 to get_work_dim() - 1. \n
89 * For other values, get_global_offset() returns 0.
90 * */
91size_t get_global_offset(uint dimindx);
92
93/**
94 * @returns the work-group ID which is a number from 0 .. get_num_groups(dimindx) - 1.
95 *
96 * @param dimindx
97 * Valid values of dimindx are 0 to get_work_dim() - 1. \n
98 * For other values, get_group_id() returns 0.
99 * */
100size_t get_group_id(uint dimindx);
101#endif
102
104
105/**
106 * @returns
107 * Returns the number of work-items in the sub-group. \n
108 *
109 * @details
110 * This value is no more than the maximum sub-group size, \n
111 * and is implementation-defined based on a combination of the compiled kernel and the dispatch dimensions.
112 *
113 * This will be a constant value for the lifetime of the sub-group.
114 * */
115uint get_sub_group_size();
116
117/**
118 * @returns
119 * Returns the maximum size of a sub-group within the dispatch. \n
120 * This value will be invariant for a given set of dispatch dimensions and a kernel object compiled for a given device.
121*/
122uint get_max_sub_group_size();
123
124/**
125 * @returns
126 * Returns the number of sub-groups that the current work-group is divided into. \n
127 * This number will be constant for the duration of a work-group’s execution.
128 *
129 * @details
130 * If the kernel is executed with a non-uniform work-group size \n
131 * (i.e. the global_work_size values specified to clEnqueueNDRangeKernel \n
132 * are not evenly divisible by the local_work_size values for any dimension) \n
133 * , calls to this built-in from some work-groups may return different values than calls to this built-in from other work-groups.
134 * */
135uint get_num_sub_groups();
136
137/**
138 * @returns
139 * Returns the same value as that returned by get_num_sub_groups if the kernel is executed with a uniform work-group size.
140 *
141 * @details
142 * If the kernel is executed with a non-uniform work-group size, \n
143 * returns the number of sub-groups in each of the work-groups that make up the uniform region of the global range.
144 * */
145uint get_enqueued_num_sub_groups();
146
147/**
148 * @returns
149 * the sub-group ID which is a number from 0 .. get_num_sub_groups() - 1.
150 *
151 * @details
152 * For clEnqueueTask, this returns 0.
153 * */
154uint get_sub_group_id();
155
156/**
157 * @returns
158 * Returns the unique work-item ID within the current sub-group.
159 *
160 * @details
161 * The mapping from get_local_id(dimindx) to get_sub_group_local_id will be invariant for the lifetime of the work-group.
162 * */
163uint get_sub_group_local_id();
164#endif
165
166#endif
#define ae2fVK_clspv_IS_OPENCL
Definition key.h:5
#define uint
Definition sclr.h:11