get_local_size inside kernel with fixed work group size forces spec. constants way for wgSize
- Dominant language
- LLVM
- Stars
- 729
- Forks
- 110
- Avg merge
- 17h 51m
- Merged PRs (30d)
- 23
Description
Input:
```
__attribute__((reqd_work_group_size(1, 1, 1)))
__kernel void kernel1D_Test1(__global uint* restrict a_data)
{
a_data[get_local_id(0)] = 3;
}
__attribute__((reqd_work_group_size(32, 8, 1)))
__kernel void kernel2D_Test2(__global uint* restrict a_data)
{
const uint localId = get_local_id(0) + get_local_size(0)*get_local_id(1);
if(localId == 0)
a_data[localId]= 2;
}
```
Output
```
%uint_1 = OpConstant %uint 1
%10 = OpSpecConstant %uint 1
%11 = OpSpecConstant %uint 1
%12 = OpSpecConstant %uint 1
%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12`
```
if inline get_local_size(0) and replace it with 32, got correct result
```
OpExecutionMode %11 LocalSize 1 1 1
OpExecutionMode %20 LocalSize 32 8 1
```
Contributor guide
Assessment
This issue has not been assessed yet.