[all-commits] [llvm/llvm-project] 9148b8: [OpenMP][Offloading] Fix the issue that omp_get_nu...

Alexey Bataev via All-commits all-commits at lists.llvm.org
Tue Jan 21 10:29:59 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 9148b8b734e7279c86a7a75883efdfdf48e8d148
      https://github.com/llvm/llvm-project/commit/9148b8b734e7279c86a7a75883efdfdf48e8d148
  Author: Alexey Bataev <a.bataev at hotmail.com>
  Date:   2020-01-21 (Tue, 21 Jan 2020)

  Changed paths:
    M openmp/libomptarget/src/omptarget.cpp
    M openmp/libomptarget/src/rtl.cpp
    A openmp/libomptarget/test/api/omp_get_num_devices_with_empty_target.c

  Log Message:
  -----------
  [OpenMP][Offloading] Fix the issue that omp_get_num_devices returns wrong number of devices, by Shiley Tian.

Summary:
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.

Reviewers: jdoerfert, ABataev, protze.joachim

Reviewed By: ABataev

Subscribers: protze.joachim

Tags: #openmp

Differential Revision: https://reviews.llvm.org/D72576




More information about the All-commits mailing list