This patch is to fix issue in the following simple case:
#include <omp.h> #include <stdio.h> int main(int argc, char *argv[]) { int num = omp_get_num_devices(); printf("%d\n", num); return 0; }
Currently it returns 0 even devices exist. Since this file doesn't contain any
target region, the host entry is empty so further actions like initialization
will not be proceeded, leading to wrong device number returned by runtime
function call.
Maybe just check if TransTable->HostTable.EntriesBegin == TransTable->HostTable.EntriesEnd? Along with the check if entries have processed already. Plus, I don't think it is correct to exit from the loop here.