Skip to content

Commit

Permalink
fix-issue-2734-rel-6.0 (02) Use "-fno-offload-uniform-block" only if …
Browse files Browse the repository at this point in the history
…HIP compiler supports it. Resolves #2734.
  • Loading branch information
atamazov committed Feb 9, 2024
1 parent 5a3c76c commit 458c833
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
12 changes: 11 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,17 @@ set_var_to_condition(MIOPEN_USE_HIPRTC_DEFAULT ${MIOPEN_USE_COMGR} AND (${MIOPEN
option(MIOPEN_USE_HIPRTC "Use HIPRTC to build HIP kernels instead of COMGR" ${MIOPEN_USE_HIPRTC_DEFAULT})

# WORKAROUND_SWDEV_413293
if(${MIOPEN_hip_VERSION_FLAT} GREATER_EQUAL 500723302)
if(HAS_HIP)
check_cxx_compiler_flag("-x hip -fno-offload-uniform-block" MIOPEN_HIP_COMPILER_HAS_OPTION_OFFLOAD_UNIFORM_BLOCK)
else()
# CXX compiler is not HIP compiler, let's analyze HIP version.
set(MIOPEN_HIP_COMPILER_HAS_OPTION_OFFLOAD_UNIFORM_BLOCK Off)
if(${MIOPEN_hip_VERSION_FLAT} GREATER_EQUAL 500723302)
set(MIOPEN_HIP_COMPILER_HAS_OPTION_OFFLOAD_UNIFORM_BLOCK On)
endif()
message(STATUS "MIOPEN_HIP_COMPILER_HAS_OPTION_OFFLOAD_UNIFORM_BLOCK: ${MIOPEN_HIP_COMPILER_HAS_OPTION_OFFLOAD_UNIFORM_BLOCK}")
endif()
if(MIOPEN_HIP_COMPILER_HAS_OPTION_OFFLOAD_UNIFORM_BLOCK)
string(APPEND HIP_COMPILER_FLAGS " -fno-offload-uniform-block ")
endif()

Expand Down
1 change: 1 addition & 0 deletions include/miopen/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#cmakedefine01 MIOPEN_USE_COMPOSABLEKERNEL
#cmakedefine01 MIOPEN_ENABLE_AI_IMMED_MODE_FALLBACK
#cmakedefine01 MIOPEN_ENABLE_AI_KERNEL_TUNING
#cmakedefine01 MIOPEN_HIP_COMPILER_HAS_OPTION_OFFLOAD_UNIFORM_BLOCK

// "_PACKAGE_" to avoid name contentions: the macros like
// HIP_VERSION_MAJOR are defined in hip_version.h.
Expand Down
2 changes: 1 addition & 1 deletion src/comgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ void BuildHip(const std::string& name,
opts.push_back("-Wno-cuda-compat");
opts.push_back("-fno-gpu-rdc");
opts.push_back("-O3");
#if WORKAROUND_SWDEV_413293
#if WORKAROUND_SWDEV_413293 && MIOPEN_HIP_COMPILER_HAS_OPTION_OFFLOAD_UNIFORM_BLOCK
opts.push_back("-fno-offload-uniform-block");
#endif
if(std::none_of(opts.begin(), opts.end(), [](const std::string& s) {
Expand Down

0 comments on commit 458c833

Please sign in to comment.