cluda/api, cluda/vsizes: fixed a possible infinite loop in the local size finding algorithm