Altera_Forum
Honored Contributor
10 years agoKernel Vectorization
hi
========================================================== void tempA( ...) {...}; void tempB( ...) {...}; void processing(global int *a){ if(a == 0) tempA( a ); else tempB( a ); } __attribute__((num_simd_work_items(2))) __attribute__((reqd_work_group_size(256,1,1))) kernel void test (__global int * a ) // NDR , globalsize = a /2 , initial a[ 0~N ] = 1 { int gid = get_gloabla_gid(0); for(int i = 0 ; i < 2 ; i++){ while(a[gid + i] == 0) processing(&a[gid + i]); } } =========================================================== The code I wrote above is the thing I was trying . It showed that "Compiler Warning: Kernel Vectorization: branching is thread ID dependent ... cannot vectorize." How to solve or explain this situation ? And while loop with unpredicted end condition is not friendly for vectorization and very inefficent , right ? Thanks.