[PATCH] D125050: [OpenMP] Try to Infer target triples using the offloading architecture

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 6 04:40:59 PDT 2022


jhuber6 marked an inline comment as done.
jhuber6 added a comment.

In D125050#3496289 <https://reviews.llvm.org/D125050#3496289>, @saiislam wrote:

> Looks good to me.
>
> Will it work with `-fno-openmp`? Sometimes `-fno-openmp` is used by the end-user to override system provided `-fopenmp` flag for some translation units.
>
> Please have a look at following examples:
>
>   // RUN: %clang -### -target x86_64-linux-gnu \
>   // RUN:   --offload-arch=gfx906 \
>   // RUN:   %s 2>&1 | FileCheck -check-prefix=OFFLOAD %s
>   // OFFLOAD: warning: argument unused during compilation: '--offload-arch=gfx906'
>   
>   // RUN: %clang -### -target x86_64-linux-gnu -fopenmp\
>   // RUN:   --offload-arch=gfx906 \
>   // RUN:   -fno-openmp \
>   // RUN:   %s 2>&1 | FileCheck -check-prefix=OFFLOAD1 %s
>   // OFFLOAD1: warning: argument unused during compilation: '--offload-arch=gfx906'
>   
>   // RUN: %clang -### -target x86_64-linux-gnu -fopenmp\
>   // RUN:   -fopenmp-targets=amdgcn-amd-amdhsa,amdgcn-amd-amdhsa \
>   // RUN:   -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx906 \
>   // RUN:   -fno-openmp \
>   // RUN:   %s 2>&1 | FileCheck -check-prefix=LEGACY %s
>   // LEGACY: warning: '-fopenmp-targets' must be used in conjunction with a '-fopenmp' option compatible with offloading; e.g., '-fopenmp=libomp' or '-fopenmp=libiomp5'
>   // LEGACY-NEXT: warning: argument unused during compilation: '-Xopenmp-target=amdgcn-amd-amdhsa -march=gfx906'
>   
>   // RUN: %clang -### -target x86_64-linux-gnu -fopenmp\
>   // RUN:   --offload-arch=gfx906 \
>   // RUN:   --offload-arch=gfx908 \
>   // RUN:   -fno-openmp \
>   // RUN:   %s 2>&1 | FileCheck -check-prefix=MOFFLOAD %s
>   // MOFFLOAD: warning: argument unused during compilation: '--offload-arch=gfx906'
>   // MOFFLOAD-NEXT: warning: argument unused during compilation: '--offload-arch=gfx908'
>   
>   // RUN: %clang -### -target x86_64-linux-gnu -fopenmp\
>   // RUN:   -fopenmp-targets=amdgcn-amd-amdhsa,amdgcn-amd-amdhsa \
>   // RUN:   -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx906 \
>   // RUN:   -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx908 \
>   // RUN:   -fno-openmp \
>   // RUN:   %s 2>&1 | FileCheck -check-prefix=MLEGACY %s
>   // MLEGACY: warning: '-fopenmp-targets' must be used in conjunction with a '-fopenmp' option compatible with offloading; e.g., '-fopenmp=libomp' or '-fopenmp=libiomp5'
>   // MLEGACY: warning: argument unused during compilation: '-Xopenmp-target=amdgcn-amd-amdhsa -march=gfx906'
>   // MLEGACY: warning: argument unused during compilation: '-Xopenmp-target=amdgcn-amd-amdhsa -march=gfx908'

It should, I could add a simple test for that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125050/new/

https://reviews.llvm.org/D125050



More information about the cfe-commits mailing list