Index: clang/lib/Driver/ToolChains/AMDGPU.cpp =================================================================== --- clang/lib/Driver/ToolChains/AMDGPU.cpp +++ clang/lib/Driver/ToolChains/AMDGPU.cpp @@ -404,14 +404,16 @@ }; // The possible structures are: + // - ${ROCM_ROOT}/share/amdgcn/bitcode/* // - ${ROCM_ROOT}/amdgcn/bitcode/* // - ${ROCM_ROOT}/lib/* // - ${ROCM_ROOT}/lib/bitcode/* // so try to detect these layouts. - static constexpr std::array SubDirsList[] = { - {"amdgcn", "bitcode"}, - {"lib", ""}, - {"lib", "bitcode"}, + static constexpr std::array SubDirsList[] = { + {"share", "amdgcn", "bitcode"}, + {"amdgcn", "bitcode", ""}, + {"lib", "", ""}, + {"lib", "bitcode", ""}, }; // Make a path by appending sub-directories to InstallPath. Index: clang/test/Driver/amdgpu-openmp-toolchain.c =================================================================== --- clang/test/Driver/amdgpu-openmp-toolchain.c +++ clang/test/Driver/amdgpu-openmp-toolchain.c @@ -75,5 +75,5 @@ // RUN: %clang -### --target=x86_64-unknown-linux-gnu -emit-llvm -S -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx803 -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-EMIT-LLVM-IR // CHECK-EMIT-LLVM-IR: clang{{.*}}"-cc1"{{.*}}"-triple" "amdgcn-amd-amdhsa"{{.*}}"-emit-llvm" -// RUN: %clang -### -target x86_64-pc-linux-gnu -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx803 -lm --rocm-device-lib-path=%S/Inputs/rocm/amdgcn/bitcode %s 2>&1 | FileCheck %s --check-prefix=CHECK-LIB-DEVICE +// RUN: %clang -### -target x86_64-pc-linux-gnu -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx803 -lm --rocm-device-lib-path=%S/Inputs/rocm/share/amdgcn/bitcode %s 2>&1 | FileCheck %s --check-prefix=CHECK-LIB-DEVICE // CHECK-LIB-DEVICE: {{.*}}llvm-link{{.*}}ocml.bc"{{.*}}ockl.bc"{{.*}}oclc_daz_opt_on.bc"{{.*}}oclc_unsafe_math_off.bc"{{.*}}oclc_finite_only_off.bc"{{.*}}oclc_correctly_rounded_sqrt_on.bc"{{.*}}oclc_wavefrontsize64_on.bc"{{.*}}oclc_isa_version_803.bc" Index: clang/test/Driver/hip-device-libs.hip =================================================================== --- clang/test/Driver/hip-device-libs.hip +++ clang/test/Driver/hip-device-libs.hip @@ -93,13 +93,13 @@ // Test --hip-device-lib-path flag // RUN: %clang -### -target x86_64-linux-gnu \ // RUN: --cuda-gpu-arch=gfx803 -nogpuinc \ -// RUN: --hip-device-lib-path=%S/Inputs/rocm/amdgcn/bitcode \ +// RUN: --hip-device-lib-path=%S/Inputs/rocm/share/amdgcn/bitcode \ // RUN: %S/Inputs/hip_multiple_inputs/b.hip \ // RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,FLUSHD // Test environment variable HIP_DEVICE_LIB_PATH -// RUN: env HIP_DEVICE_LIB_PATH=%S/Inputs/rocm/amdgcn/bitcode \ +// RUN: env HIP_DEVICE_LIB_PATH=%S/Inputs/rocm/share/amdgcn/bitcode \ // RUN: %clang -### -target x86_64-linux-gnu \ // RUN: --cuda-gpu-arch=gfx900 -nogpuinc \ // RUN: %S/Inputs/hip_multiple_inputs/b.hip \ Index: clang/test/Driver/rocm-detect.hip =================================================================== --- clang/test/Driver/rocm-detect.hip +++ clang/test/Driver/rocm-detect.hip @@ -63,7 +63,7 @@ // The message about SPACK is emitted only if -v is specified. // RUN: rm -rf %T/rocm-spack/hip-* -// RUN: rm -rf %T/rocm-spack/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/amdgcn +// RUN: rm -rf %T/rocm-spack/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/share/amdgcn // RUN: %T/rocm-spack/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/bin/clang -### -v \ // RUN: -target x86_64-linux-gnu --cuda-gpu-arch=gfx900 %s 2>&1 \ // RUN: | FileCheck -check-prefixes=SPACK-MISS %s @@ -89,7 +89,7 @@ // SPACK: InstalledDir: [[DIR]]/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/bin // SPACK: Found HIP installation: [[DIR]]/hip-4.0.0-5f63slrursbrvfe2txrrjkynbsywsob5, version 4.0.20214-a2917cd // SPACK: "-triple" "amdgcn-amd-amdhsa" -// SPACK-SAME: "-mlink-builtin-bitcode" "[[DIR]]/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/amdgcn/bitcode/hip.bc" +// SPACK-SAME: "-mlink-builtin-bitcode" "[[DIR]]/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/share/amdgcn/bitcode/hip.bc" // SPACK-SAME: "-internal-isystem" "[[DIR]]/hip-4.0.0-5f63slrursbrvfe2txrrjkynbsywsob5/include" // SPACK-MULT: InstalledDir: [[DIR:.*]]/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/bin @@ -100,7 +100,7 @@ // SPACK-SET: InstalledDir: [[DIR:.*]]/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/bin // SPACK-SET: Found HIP installation: [[DIR]]/hip-4.0.0-abcd, version 4.0.20214-a2917cd // SPACK-SET: "-triple" "amdgcn-amd-amdhsa" -// SPACK-SET-SAME: "-mlink-builtin-bitcode" "[[DIR]]/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/amdgcn/bitcode/hip.bc" +// SPACK-SET-SAME: "-mlink-builtin-bitcode" "[[DIR]]/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/share/amdgcn/bitcode/hip.bc" // SPACK-SET-SAME: "-internal-isystem" "[[DIR]]/hip-4.0.0-abcd/include" // SPACK-MISS: InstalledDir: [[DIR:.*]]/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/bin Index: clang/test/Driver/rocm-device-libs.cl =================================================================== --- clang/test/Driver/rocm-device-libs.cl +++ clang/test/Driver/rocm-device-libs.cl @@ -124,12 +124,12 @@ // Test --hip-device-lib-path format // RUN: %clang -### -target amdgcn-amd-amdhsa \ // RUN: -x cl -mcpu=gfx900 \ -// RUN: --hip-device-lib-path=%S/Inputs/rocm/amdgcn/bitcode \ +// RUN: --hip-device-lib-path=%S/Inputs/rocm/share/amdgcn/bitcode \ // RUN: %S/opencl.cl \ // RUN: 2>&1 | FileCheck --check-prefixes=COMMON,COMMON-DEFAULT,GFX900-DEFAULT,GFX900,WAVE64 %s // Test environment variable HIP_DEVICE_LIB_PATH -// RUN: env HIP_DEVICE_LIB_PATH=%S/Inputs/rocm/amdgcn/bitcode %clang -### -target amdgcn-amd-amdhsa \ +// RUN: env HIP_DEVICE_LIB_PATH=%S/Inputs/rocm/share/amdgcn/bitcode %clang -### -target amdgcn-amd-amdhsa \ // RUN: -x cl -mcpu=gfx900 \ // RUN: %S/opencl.cl \ // RUN: 2>&1 | FileCheck --check-prefixes=COMMON,COMMON-DEFAULT,GFX900-DEFAULT,GFX900,WAVE64 %s @@ -137,44 +137,44 @@ // COMMON: "-triple" "amdgcn-amd-amdhsa" -// COMMON-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/opencl.bc" -// COMMON-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/ocml.bc" -// COMMON-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/ockl.bc" +// COMMON-SAME: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/opencl.bc" +// COMMON-SAME: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/ocml.bc" +// COMMON-SAME: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/ockl.bc" -// GFX900-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_daz_opt_off.bc" -// GFX803-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_daz_opt_on.bc" -// GFX700-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_daz_opt_on.bc" -// COMMON-DAZ-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_daz_opt_on.bc" +// GFX900-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/oclc_daz_opt_off.bc" +// GFX803-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/oclc_daz_opt_on.bc" +// GFX700-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/oclc_daz_opt_on.bc" +// COMMON-DAZ-SAME: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/oclc_daz_opt_on.bc" -// COMMON-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_unsafe_math_off.bc" -// COMMON-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_finite_only_off.bc" -// COMMON-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_correctly_rounded_sqrt_off.bc" +// COMMON-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/oclc_unsafe_math_off.bc" +// COMMON-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/oclc_finite_only_off.bc" +// COMMON-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/oclc_correctly_rounded_sqrt_off.bc" -// COMMON-FINITE-ONLY-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_unsafe_math_off.bc" -// COMMON-FINITE-ONLY-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_finite_only_on.bc" -// COMMON-FINITE-ONLY-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_correctly_rounded_sqrt_off.bc" +// COMMON-FINITE-ONLY-SAME: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/oclc_unsafe_math_off.bc" +// COMMON-FINITE-ONLY-SAME: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/oclc_finite_only_on.bc" +// COMMON-FINITE-ONLY-SAME: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/oclc_correctly_rounded_sqrt_off.bc" -// COMMON-CORRECT-SQRT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_unsafe_math_off.bc" -// COMMON-CORRECT-SQRT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_finite_only_off.bc" -// COMMON-CORRECT-SQRT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_correctly_rounded_sqrt_on.bc" +// COMMON-CORRECT-SQRT-SAME: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/oclc_unsafe_math_off.bc" +// COMMON-CORRECT-SQRT-SAME: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/oclc_finite_only_off.bc" +// COMMON-CORRECT-SQRT-SAME: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/oclc_correctly_rounded_sqrt_on.bc" -// COMMON-FAST-RELAXED-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_unsafe_math_on.bc" -// COMMON-FAST-RELAXED-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_finite_only_on.bc" -// COMMON-FAST-RELAXED-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_correctly_rounded_sqrt_off.bc" +// COMMON-FAST-RELAXED-SAME: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/oclc_unsafe_math_on.bc" +// COMMON-FAST-RELAXED-SAME: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/oclc_finite_only_on.bc" +// COMMON-FAST-RELAXED-SAME: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/oclc_correctly_rounded_sqrt_off.bc" -// COMMON-UNSAFE-MATH-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_unsafe_math_on.bc" -// COMMON-UNSAFE-MATH-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_finite_only_off.bc" -// COMMON-UNSAFE-MATH-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_correctly_rounded_sqrt_off.bc" +// COMMON-UNSAFE-MATH-SAME: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/oclc_unsafe_math_on.bc" +// COMMON-UNSAFE-MATH-SAME: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/oclc_finite_only_off.bc" +// COMMON-UNSAFE-MATH-SAME: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/oclc_correctly_rounded_sqrt_off.bc" -// WAVE64: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_wavefrontsize64_on.bc" -// WAVE32: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_wavefrontsize64_off.bc" +// WAVE64: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/oclc_wavefrontsize64_on.bc" +// WAVE32: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/oclc_wavefrontsize64_off.bc" -// GFX900: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_isa_version_900.bc" -// GFX803: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_isa_version_803.bc" +// GFX900: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/oclc_isa_version_900.bc" +// GFX803: "-mlink-builtin-bitcode" "{{.*}}/share/amdgcn/bitcode/oclc_isa_version_803.bc" kernel void func(void); Index: mlir/lib/ExecutionEngine/CMakeLists.txt =================================================================== --- mlir/lib/ExecutionEngine/CMakeLists.txt +++ mlir/lib/ExecutionEngine/CMakeLists.txt @@ -147,9 +147,9 @@ else() set(ROCM_PATH $ENV{ROCM_PATH} CACHE PATH "Path to which ROCm has been installed") endif() - set(HIP_PATH "${ROCM_PATH}/hip" CACHE PATH "Path to which HIP has been installed") + set(HIP_PATH "${ROCM_PATH}" CACHE PATH "Path to which HIP has been installed") endif() - set(CMAKE_MODULE_PATH "${HIP_PATH}/cmake" ${CMAKE_MODULE_PATH}) + set(CMAKE_MODULE_PATH "${HIP_PATH}/lib/cmake/hip" ${CMAKE_MODULE_PATH}) find_package(HIP) if (NOT HIP_FOUND) message(SEND_ERROR "Building mlir with ROCm support requires a working ROCm and HIP install") Index: openmp/libomptarget/plugins/amdgpu/dynamic_hsa/hsa.cpp =================================================================== --- openmp/libomptarget/plugins/amdgpu/dynamic_hsa/hsa.cpp +++ openmp/libomptarget/plugins/amdgpu/dynamic_hsa/hsa.cpp @@ -10,10 +10,10 @@ // Does the dlopen/dlsym calls as part of the call to hsa_init // //===----------------------------------------------------------------------===// -#include "hsa.h" +#include "hsa/hsa.h" #include "Debug.h" #include "dlwrap.h" -#include "hsa_ext_amd.h" +#include "hsa/hsa_ext_amd.h" #include Index: openmp/libomptarget/plugins/amdgpu/impl/hsa_api.h =================================================================== --- openmp/libomptarget/plugins/amdgpu/impl/hsa_api.h +++ openmp/libomptarget/plugins/amdgpu/impl/hsa_api.h @@ -8,7 +8,7 @@ #ifndef AMDGPU_HSA_API_H_INCLUDED #define AMDGPU_HSA_API_H_INCLUDED -#include "hsa.h" -#include "hsa_ext_amd.h" +#include "hsa/hsa.h" +#include "hsa/hsa_ext_amd.h" #endif