OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU.
Announcements
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.
1719 Discussions

vec_type_hint() does not work for me

Fu_J_Intel
Employee
459 Views

trying to disable auto-vectorization, I used vec_type_hint(char) as below.  But checking the built assembly code, I see the kernel is still compiled as SIMD32.  Any advice?

 

__kernel __attribute__((vec_type_hint(uchar)))  void modulate_v1_uchar(global const uchar *pSrc, global  uchar *pDst) 
//__kernel void modulate_v1_uchar(global const uchar *pSrc, global  uchar *pDst) 

    uint idx = get_global_id(0);

    uchar src = pSrc[idx];
    src >>= MODULATE_SHIFT_FACTOR;
    pDst[idx] = src;
}

0 Kudos
5 Replies
Robert_I_Intel
Employee
459 Views

You won't be able to disable vectorization on the GPU. That hint is for the CPU. You could use _attribute__((reqd_work_gr oup_size(X, Y, Z))) could to change SIMD width to 8 (8, 1, 1), 16 (16, 1, 1) or 32 (32, 1, 1)

0 Kudos
Fu_J_Intel
Employee
459 Views

great! thanks Robert.

0 Kudos
Fu_J_Intel
Employee
459 Views

I actually have a further question:  how is workgroup size (eg,  _attribute__((reqd_work_gr oup_size(X, Y, Z))))  related to SIMD width?  does it mean work-item of different workgroups can not be handled on the same thread?  Thanks

 

 

0 Kudos
Robert_I_Intel
Employee
459 Views

Yes, typically a work-group maps to a hardware thread or can span multiple threads or even multiple EUs.505229

0 Kudos
Robert_I_Intel
Employee
459 Views

See slides 18 thru 34 in the presentation above.

0 Kudos
Reply