AMD OpenCL compiler ignores kernel attribute “work_group_size_hint”
-
18-06-2021 - |
Question
I'm currently optimizing an OpenCL kernel, and have been trying to find optimal values for workgroup sizes and vector widths.
Currently I'm using an ubuntu system with an Intel i7-3930k (6 cores @ 3.5 GHz, HT disabled) and an AMD HD6870. Both Intel and AMD OpenCL implementations are installed to allow for comparisons. (AMD APP SDK v2.7 Linux 64b & Catalyst 12.4, Intel OpenCL SDK 1.5 ).
Running on the CPU (on Intel Platform) I've found that:
- By choosing a wg size of 256 I can gain about 13.5% performance in comparison to wgsize=1.
- By specifying
__attribute__((vec_type_hint(float4)))
I can gain a 30% boost. - By specifying
__attribute__((work_group_size_hint(WG_SIZE, 1, 1)))
I get another ~90% (!)
So, in total, theses options can result in close to a 3x performance increase. Unfortunately, when running this case on the the CPU using the AMD OpenCL platform, I've found that the optional attributes are ignored.
Kernel declaration is:
kernel __attribute__(( work_group_size_hint(WG_SIZE, 1, 1) ))
__attribute__(( vec_type_hint(VEC_SIZE) ))
void solveEikonalEq( global env_packed_t* env_packed_in,
global float* packedEnvData_in,
private float ds,
private float freq,
global ray_t* ray,
global rayMembers_t* rayMembers){
And compiler output is:
"/tmp/OCLVAvDqR.cl", line 2637: warning: unknown attribute "work_group_size_hint"
kernel __attribute__((work_group_size_hint(WG_SIZE, 1, 1)))
^
"/tmp/OCLVAvDqR.cl", line 2638: warning: unknown attribute "vec_type_hint"
__attribute__(( vec_type_hint(VEC_SIZE)))
^
Does anybody know if AMD always ignores these hints? Or is there something i have to do to enable these attributes on the AMD platform?
Solution
Quoting answer from AMD forums (http://devgurus.amd.com/message/1282250):
Support for work group size hint has been added internally and should be in the next release. vec_type_hint is optional and not supported, but I'll file a request to add support to the parser.
Micah Villmow
Advanced Micro Devices Inc.
So, in short, according to an AMD rep:
- AMD's APP SDK v2.7 knows neither
work_group_size_hint
norvec_type_hint
work_group_size_hint
is coming for version APP SDK v2.8vec_type_hint
might be supported in a future version.