Author: Yaxun (Sam) Liu Date: 2020-12-04T08:36:52-05:00 New Revision: 0519e1ddb3885d070f054ca30a7487f915f6f795
URL: https://github.com/llvm/llvm-project/commit/0519e1ddb3885d070f054ca30a7487f915f6f795 DIFF: https://github.com/llvm/llvm-project/commit/0519e1ddb3885d070f054ca30a7487f915f6f795.diff LOG: [HIP] Fix bug in driver about wavefront size The static variable causes it only initialized once and take the same value for different GPU archs, whereas they may be different for different GPU archs, e.g. when there are both gfx900 and gfx1010. Removing static fixes that. Differential Revision: https://reviews.llvm.org/D92628 Added: clang/test/Driver/hip-wavefront-size.hip Modified: clang/lib/Driver/ToolChains/AMDGPU.cpp Removed: ################################################################################ diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp index 5df7236f0223..1220594281ec 100644 --- a/clang/lib/Driver/ToolChains/AMDGPU.cpp +++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp @@ -499,7 +499,7 @@ llvm::DenormalMode AMDGPUToolChain::getDefaultDenormalModeForType( bool AMDGPUToolChain::isWave64(const llvm::opt::ArgList &DriverArgs, llvm::AMDGPU::GPUKind Kind) { const unsigned ArchAttr = llvm::AMDGPU::getArchAttrAMDGCN(Kind); - static bool HasWave32 = (ArchAttr & llvm::AMDGPU::FEATURE_WAVE32); + bool HasWave32 = (ArchAttr & llvm::AMDGPU::FEATURE_WAVE32); return !HasWave32 || DriverArgs.hasFlag( options::OPT_mwavefrontsize64, options::OPT_mno_wavefrontsize64, false); diff --git a/clang/test/Driver/hip-wavefront-size.hip b/clang/test/Driver/hip-wavefront-size.hip new file mode 100644 index 000000000000..dd7ca16ae2d3 --- /dev/null +++ b/clang/test/Driver/hip-wavefront-size.hip @@ -0,0 +1,21 @@ +// REQUIRES: clang-driver,amdgpu-registered-target + +// RUN: %clang -### -target x86_64-linux-gnu \ +// RUN: --cuda-gpu-arch=gfx900 \ +// RUN: --rocm-path=%S/Inputs/rocm --cuda-device-only %s \ +// RUN: 2>&1 | FileCheck %s --check-prefixes=WAVE64 +// WAVE64: "-mlink-builtin-bitcode" "{{.*}}oclc_wavefrontsize64_on.bc"{{.*}} "-target-cpu" "gfx900" + +// RUN: %clang -### -target x86_64-linux-gnu \ +// RUN: --cuda-gpu-arch=gfx1010 \ +// RUN: --rocm-path=%S/Inputs/rocm --cuda-device-only %s \ +// RUN: 2>&1 | FileCheck %s --check-prefixes=WAVE32 +// WAVE32: "-mlink-builtin-bitcode" "{{.*}}oclc_wavefrontsize64_off.bc"{{.*}} "-target-cpu" "gfx1010" + +// RUN: %clang -### -target x86_64-linux-gnu \ +// RUN: --cuda-gpu-arch=gfx1010 \ +// RUN: --cuda-gpu-arch=gfx900 \ +// RUN: --rocm-path=%S/Inputs/rocm --cuda-device-only %s \ +// RUN: 2>&1 | FileCheck %s --check-prefixes=BOTH +// BOTH-DAG: "-mlink-builtin-bitcode" "{{.*}}oclc_wavefrontsize64_on.bc"{{.*}} "-target-cpu" "gfx900" +// BOTH-DAG: "-mlink-builtin-bitcode" "{{.*}}oclc_wavefrontsize64_off.bc"{{.*}} "-target-cpu" "gfx1010" _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits