Commit aa33d56
authored
Fix CL_INVALID_WORK_ITEM_SIZE for "reduce" test (#143)
* Fix CL_INVALID_WORK_ITEM_SIZE for "reduce" test
The work-group size (WGS) may exceed the maximum allowed per-dimension
limit reported by CL_DEVICE_MAX_WORK_ITEM_SIZES[0], leading to
clEnqueueNDRangeKernel failing with CL_INVALID_WORK_GROUP_SIZE.
This patch queries the device's max work-item sizes and clamps WGS to
the valid maximum for the x-dimension. This ensures correct behavior on
devices with smaller limits and improves portability.
Signed-off-by: Xin Jin <xin.jin@arm.com>
* Clamp WGS to CL_DEVICE_MAX_WORK_ITEM_SIZES[0] in reduce.cpp
The work-group size (WGS) may exceed the maximum allowed per-dimension
limit reported by CL_DEVICE_MAX_WORK_ITEM_SIZES[0], leading to
clEnqueueNDRangeKernel failing with CL_INVALID_WORK_GROUP_SIZE.
The reduce sample launches kernels with a 1-D NDRange over a flat array
of integers, so only the x-dimension limit is relevant. This patch
queries the device's max work-item sizes and clamps WGS to the valid
maximum for the x-dimension. This ensures correct behavior on devices
with smaller limits and improves portability.
Signed-off-by: Xin Jin <xin.jin@arm.com>
---------
Signed-off-by: Xin Jin <xin.jin@arm.com>1 parent 1010c00 commit aa33d56
2 files changed
Lines changed: 16 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
389 | 398 | | |
390 | 399 | | |
391 | 400 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | | - | |
179 | | - | |
180 | | - | |
| 178 | + | |
| 179 | + | |
181 | 180 | | |
182 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
183 | 186 | | |
184 | 187 | | |
185 | 188 | | |
| |||
191 | 194 | | |
192 | 195 | | |
193 | 196 | | |
194 | | - | |
| 197 | + | |
195 | 198 | | |
196 | 199 | | |
197 | 200 | | |
| |||
0 commit comments