__kernel
__attribute__((reqd_work_group_size(NUM_WGS_RMQMIN,1,1)))
void rmq_levelMin(global int* gSparseTable, int blkSize, int level, int numBlocks)
{
u32 gIdx = GET_GLOBAL_IDX;
if(gIdx >= numBlocks) return;
int startIdx = numBlocks*(level);
int calWi=1<<level;
int flatSTIdxCmp2 = ((gIdx+calWi<numBlocks)?(gIdx+calWi):gIdx);
gSparseTable[gIdx+numBlocks*(level+1)] = (gSparseTable[gIdx+startIdx] < gSparseTable[flatSTIdxCmp2+startIdx])?gSparseTable[gIdx+startIdx] : gSparseTable[flatSTIdxCmp2+startIdx];
}