This revision was automatically updated to reflect the committed changes. skatrak marked 2 inline comments as done. Closed by commit rG2266f4a3b38f: [Flang][Driver][OpenMP] Enable options for selecting offloading phases in flang (authored by skatrak).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D147941/new/ https://reviews.llvm.org/D147941 Files: clang/include/clang/Driver/Options.td flang/test/Driver/driver-help-hidden.f90 flang/test/Driver/driver-help.f90 flang/test/Driver/omp-driver-offload.f90 flang/test/Driver/omp-frontend-forwarding.f90 Index: flang/test/Driver/omp-driver-offload.f90 =================================================================== --- flang/test/Driver/omp-driver-offload.f90 +++ flang/test/Driver/omp-driver-offload.f90 @@ -7,6 +7,42 @@ ! CHECK-OPENMP: "{{[^"]*}}flang-new" "-fc1" {{.*}} "-fopenmp" {{.*}}.f90" ! CHECK-OPENMP-NOT: "{{[^"]*}}flang-new" "-fc1" {{.*}} "-fopenmp" {{.*}} "-fopenmp-is-device" {{.*}}.f90" +! Test regular -fopenmp with offload, and invocation filtering options +! RUN: %flang -S -### %s -o %t 2>&1 \ +! RUN: -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 \ +! RUN: --target=aarch64-unknown-linux-gnu \ +! RUN: | FileCheck %s --check-prefix=OFFLOAD-HOST-AND-DEVICE + +! RUN: %flang -S -### %s -o %t 2>&1 \ +! RUN: -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-device \ +! RUN: --target=aarch64-unknown-linux-gnu \ +! RUN: | FileCheck %s --check-prefix=OFFLOAD-HOST-AND-DEVICE + +! OFFLOAD-HOST-AND-DEVICE: "{{[^"]*}}flang-new" "-fc1" "-triple" "aarch64-unknown-linux-gnu" +! OFFLOAD-HOST-AND-DEVICE-NEXT: "{{[^"]*}}flang-new" "-fc1" "-triple" "amdgcn-amd-amdhsa" +! OFFLOAD-HOST-AND-DEVICE-NEXT: "{{[^"]*}}flang-new" "-fc1" "-triple" "nvptx64-nvidia-cuda" +! OFFLOAD-HOST-AND-DEVICE: "{{[^"]*}}flang-new" "-fc1" "-triple" "aarch64-unknown-linux-gnu" + +! RUN: %flang -S -### %s -o %t 2>&1 \ +! RUN: -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-only \ +! RUN: --target=aarch64-unknown-linux-gnu \ +! RUN: | FileCheck %s --check-prefix=OFFLOAD-HOST + +! OFFLOAD-HOST: "{{[^"]*}}flang-new" "-fc1" "-triple" "aarch64-unknown-linux-gnu" +! OFFLOAD-HOST-NOT: "-triple" "amdgcn-amd-amdhsa" +! OFFLOAD-HOST-NOT: "-triple" "nvptx64-nvidia-cuda" +! OFFLOAD-HOST-NOT: "{{[^"]*}}flang-new" "-fc1" "-triple" "aarch64-unknown-linux-gnu" + +! RUN: %flang -S -### %s -o %t 2>&1 \ +! RUN: -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-device-only \ +! RUN: --target=aarch64-unknown-linux-gnu \ +! RUN: | FileCheck %s --check-prefix=OFFLOAD-DEVICE + +! OFFLOAD-DEVICE: "{{[^"]*}}flang-new" "-fc1" "-triple" "aarch64-unknown-linux-gnu" +! OFFLOAD-DEVICE-NEXT: "{{[^"]*}}flang-new" "-fc1" "-triple" "amdgcn-amd-amdhsa" +! OFFLOAD-DEVICE-NEXT: "{{[^"]*}}flang-new" "-fc1" "-triple" "nvptx64-nvidia-cuda" +! OFFLOAD-DEVICE-NOT: "{{[^"]*}}flang-new" "-fc1" "-triple" "aarch64-unknown-linux-gnu" + ! Test regular -fopenmp with offload for basic fopenmp-is-device flag addition and correct fopenmp ! RUN: %flang -### -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa %s 2>&1 | FileCheck --check-prefixes=CHECK-OPENMP-IS-DEVICE %s ! CHECK-OPENMP-IS-DEVICE: "{{[^"]*}}flang-new" "-fc1" {{.*}} "-fopenmp" {{.*}} "-fopenmp-is-device" {{.*}}.f90" Index: flang/test/Driver/driver-help.f90 =================================================================== --- flang/test/Driver/driver-help.f90 +++ flang/test/Driver/driver-help.f90 @@ -65,6 +65,9 @@ ! HELP-NEXT: -mmlir <value> Additional arguments to forward to MLIR's option processing ! HELP-NEXT: -module-dir <dir> Put MODULE files in <dir> ! HELP-NEXT: -nocpp Disable predefined and command line preprocessor macros +! HELP-NEXT: --offload-device-only Only compile for the offloading device. +! HELP-NEXT: --offload-host-device Only compile for the offloading host. +! HELP-NEXT: --offload-host-only Only compile for the offloading host. ! HELP-NEXT: -o <file> Write output to <file> ! HELP-NEXT: -pedantic Warn on language extensions ! HELP-NEXT: -print-effective-triple Print the effective target triple Index: flang/test/Driver/driver-help-hidden.f90 =================================================================== --- flang/test/Driver/driver-help-hidden.f90 +++ flang/test/Driver/driver-help-hidden.f90 @@ -69,6 +69,9 @@ ! CHECK-NEXT: -mmlir <value> Additional arguments to forward to MLIR's option processing ! CHECK-NEXT: -module-dir <dir> Put MODULE files in <dir> ! CHECK-NEXT: -nocpp Disable predefined and command line preprocessor macros +! CHECK-NEXT: --offload-device-only Only compile for the offloading device. +! CHECK-NEXT: --offload-host-device Only compile for the offloading host. +! CHECK-NEXT: --offload-host-only Only compile for the offloading host. ! CHECK-NEXT: -o <file> Write output to <file> ! CHECK-NEXT: -pedantic Warn on language extensions ! CHECK-NEXT: -print-effective-triple Print the effective target triple Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -2735,11 +2735,11 @@ MarshallingInfoFlag<LangOpts<"OffloadingNewDriver">>, HelpText<"Use the new driver for offloading compilation.">; def no_offload_new_driver : Flag<["--"], "no-offload-new-driver">, Flags<[CC1Option]>, Group<f_Group>, HelpText<"Don't Use the new driver for offloading compilation.">; -def offload_device_only : Flag<["--"], "offload-device-only">, +def offload_device_only : Flag<["--"], "offload-device-only">, Flags<[FlangOption]>, HelpText<"Only compile for the offloading device.">; -def offload_host_only : Flag<["--"], "offload-host-only">, +def offload_host_only : Flag<["--"], "offload-host-only">, Flags<[FlangOption]>, HelpText<"Only compile for the offloading host.">; -def offload_host_device : Flag<["--"], "offload-host-device">, +def offload_host_device : Flag<["--"], "offload-host-device">, Flags<[FlangOption]>, HelpText<"Only compile for the offloading host.">; def cuda_device_only : Flag<["--"], "cuda-device-only">, Alias<offload_device_only>, HelpText<"Compile CUDA code for device only">;
Index: flang/test/Driver/omp-driver-offload.f90 =================================================================== --- flang/test/Driver/omp-driver-offload.f90 +++ flang/test/Driver/omp-driver-offload.f90 @@ -7,6 +7,42 @@ ! CHECK-OPENMP: "{{[^"]*}}flang-new" "-fc1" {{.*}} "-fopenmp" {{.*}}.f90" ! CHECK-OPENMP-NOT: "{{[^"]*}}flang-new" "-fc1" {{.*}} "-fopenmp" {{.*}} "-fopenmp-is-device" {{.*}}.f90" +! Test regular -fopenmp with offload, and invocation filtering options +! RUN: %flang -S -### %s -o %t 2>&1 \ +! RUN: -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 \ +! RUN: --target=aarch64-unknown-linux-gnu \ +! RUN: | FileCheck %s --check-prefix=OFFLOAD-HOST-AND-DEVICE + +! RUN: %flang -S -### %s -o %t 2>&1 \ +! RUN: -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-device \ +! RUN: --target=aarch64-unknown-linux-gnu \ +! RUN: | FileCheck %s --check-prefix=OFFLOAD-HOST-AND-DEVICE + +! OFFLOAD-HOST-AND-DEVICE: "{{[^"]*}}flang-new" "-fc1" "-triple" "aarch64-unknown-linux-gnu" +! OFFLOAD-HOST-AND-DEVICE-NEXT: "{{[^"]*}}flang-new" "-fc1" "-triple" "amdgcn-amd-amdhsa" +! OFFLOAD-HOST-AND-DEVICE-NEXT: "{{[^"]*}}flang-new" "-fc1" "-triple" "nvptx64-nvidia-cuda" +! OFFLOAD-HOST-AND-DEVICE: "{{[^"]*}}flang-new" "-fc1" "-triple" "aarch64-unknown-linux-gnu" + +! RUN: %flang -S -### %s -o %t 2>&1 \ +! RUN: -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-host-only \ +! RUN: --target=aarch64-unknown-linux-gnu \ +! RUN: | FileCheck %s --check-prefix=OFFLOAD-HOST + +! OFFLOAD-HOST: "{{[^"]*}}flang-new" "-fc1" "-triple" "aarch64-unknown-linux-gnu" +! OFFLOAD-HOST-NOT: "-triple" "amdgcn-amd-amdhsa" +! OFFLOAD-HOST-NOT: "-triple" "nvptx64-nvidia-cuda" +! OFFLOAD-HOST-NOT: "{{[^"]*}}flang-new" "-fc1" "-triple" "aarch64-unknown-linux-gnu" + +! RUN: %flang -S -### %s -o %t 2>&1 \ +! RUN: -fopenmp --offload-arch=gfx90a --offload-arch=sm_70 --offload-device-only \ +! RUN: --target=aarch64-unknown-linux-gnu \ +! RUN: | FileCheck %s --check-prefix=OFFLOAD-DEVICE + +! OFFLOAD-DEVICE: "{{[^"]*}}flang-new" "-fc1" "-triple" "aarch64-unknown-linux-gnu" +! OFFLOAD-DEVICE-NEXT: "{{[^"]*}}flang-new" "-fc1" "-triple" "amdgcn-amd-amdhsa" +! OFFLOAD-DEVICE-NEXT: "{{[^"]*}}flang-new" "-fc1" "-triple" "nvptx64-nvidia-cuda" +! OFFLOAD-DEVICE-NOT: "{{[^"]*}}flang-new" "-fc1" "-triple" "aarch64-unknown-linux-gnu" + ! Test regular -fopenmp with offload for basic fopenmp-is-device flag addition and correct fopenmp ! RUN: %flang -### -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa %s 2>&1 | FileCheck --check-prefixes=CHECK-OPENMP-IS-DEVICE %s ! CHECK-OPENMP-IS-DEVICE: "{{[^"]*}}flang-new" "-fc1" {{.*}} "-fopenmp" {{.*}} "-fopenmp-is-device" {{.*}}.f90" Index: flang/test/Driver/driver-help.f90 =================================================================== --- flang/test/Driver/driver-help.f90 +++ flang/test/Driver/driver-help.f90 @@ -65,6 +65,9 @@ ! HELP-NEXT: -mmlir <value> Additional arguments to forward to MLIR's option processing ! HELP-NEXT: -module-dir <dir> Put MODULE files in <dir> ! HELP-NEXT: -nocpp Disable predefined and command line preprocessor macros +! HELP-NEXT: --offload-device-only Only compile for the offloading device. +! HELP-NEXT: --offload-host-device Only compile for the offloading host. +! HELP-NEXT: --offload-host-only Only compile for the offloading host. ! HELP-NEXT: -o <file> Write output to <file> ! HELP-NEXT: -pedantic Warn on language extensions ! HELP-NEXT: -print-effective-triple Print the effective target triple Index: flang/test/Driver/driver-help-hidden.f90 =================================================================== --- flang/test/Driver/driver-help-hidden.f90 +++ flang/test/Driver/driver-help-hidden.f90 @@ -69,6 +69,9 @@ ! CHECK-NEXT: -mmlir <value> Additional arguments to forward to MLIR's option processing ! CHECK-NEXT: -module-dir <dir> Put MODULE files in <dir> ! CHECK-NEXT: -nocpp Disable predefined and command line preprocessor macros +! CHECK-NEXT: --offload-device-only Only compile for the offloading device. +! CHECK-NEXT: --offload-host-device Only compile for the offloading host. +! CHECK-NEXT: --offload-host-only Only compile for the offloading host. ! CHECK-NEXT: -o <file> Write output to <file> ! CHECK-NEXT: -pedantic Warn on language extensions ! CHECK-NEXT: -print-effective-triple Print the effective target triple Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -2735,11 +2735,11 @@ MarshallingInfoFlag<LangOpts<"OffloadingNewDriver">>, HelpText<"Use the new driver for offloading compilation.">; def no_offload_new_driver : Flag<["--"], "no-offload-new-driver">, Flags<[CC1Option]>, Group<f_Group>, HelpText<"Don't Use the new driver for offloading compilation.">; -def offload_device_only : Flag<["--"], "offload-device-only">, +def offload_device_only : Flag<["--"], "offload-device-only">, Flags<[FlangOption]>, HelpText<"Only compile for the offloading device.">; -def offload_host_only : Flag<["--"], "offload-host-only">, +def offload_host_only : Flag<["--"], "offload-host-only">, Flags<[FlangOption]>, HelpText<"Only compile for the offloading host.">; -def offload_host_device : Flag<["--"], "offload-host-device">, +def offload_host_device : Flag<["--"], "offload-host-device">, Flags<[FlangOption]>, HelpText<"Only compile for the offloading host.">; def cuda_device_only : Flag<["--"], "cuda-device-only">, Alias<offload_device_only>, HelpText<"Compile CUDA code for device only">;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits