Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HIP kernels may launch with non-uniform block size for backward compatibility #2307

Merged
merged 6 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ math(EXPR MIOPEN_hip_VERSION_FLAT "(${MIOPEN_hip_VERSION_MAJOR} * 1000 + ${MIOPE
set_var_to_condition(MIOPEN_USE_HIPRTC_DEFAULT ${MIOPEN_USE_COMGR} AND (${MIOPEN_hip_VERSION_FLAT} GREATER 500000000))
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)
string(APPEND HIP_COMPILER_FLAGS " -fno-offload-uniform-block ")
endif()

message(STATUS "Hip compiler flags: ${HIP_COMPILER_FLAGS}")

add_definitions("-DHIP_COMPILER_FLAGS=${HIP_COMPILER_FLAGS}")
Expand Down
6 changes: 6 additions & 0 deletions src/comgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,9 @@ void BuildAsm(const std::string& name,

#define WORKAROUND_ISSUE_HIPRTC_HIPRTC_HEADER_H 1 // See SWDEV-307838, issue #1648.
#define WORKAROUND_ISSUE_1674 (HIP_PACKAGE_VERSION_FLAT >= 5003022305ULL)
/// No assumption that HIP kernels are launched with uniform block size for backward compatibility
/// SWDEV-413293 and https://reviews.llvm.org/D155213 effective HIP_FLAT_VERSION 500723302
#define WORKAROUND_SWDEV_413293 (HIP_PACKAGE_VERSION_FLAT >= 5007023302ULL)

namespace hiprtc {

Expand Down Expand Up @@ -1314,6 +1317,9 @@ 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
opts.push_back("-fno-offload-uniform-block");
#endif
if(std::none_of(opts.begin(), opts.end(), [](const std::string& s) {
return StartsWith(s, "--std=") || StartsWith(s, "-std=");
}))
Expand Down