Skip to content

Commit

Permalink
[HIP] Bump supported HIP versions to v4.2 or later (#715)
Browse files Browse the repository at this point in the history
* [HIP] Remove some compile-time backward compatibility switches

* [HIP] Bump supported HIP version to v4.2 or later
  • Loading branch information
noelchalmers committed Nov 9, 2023
1 parent e2140e2 commit ec6e59d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Mission critical computational science and engineering applications from the pub

- Fortan 90 compiler
- CUDA 9 or later
- HIP 3.5 or later
- HIP 4.2 or later
- SYCL 2020 or later
- OpenCL 2.0 or later
- OpenMP 4.0 or later
Expand Down Expand Up @@ -151,4 +151,4 @@ OCCA is available under a [MIT license](LICENSE.MD)

[CMake]: https://cmake.org/

[Env_Modules]: https://modules.readthedocs.io/en/latest/index.html
[Env_Modules]: https://modules.readthedocs.io/en/latest/index.html
22 changes: 2 additions & 20 deletions src/occa/internal/modes/hip/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,28 +216,15 @@ namespace occa {
);

if (hipccCompilerFlags.find("-arch=sm") == std::string::npos &&
#if HIP_VERSION >= 502
hipccCompilerFlags.find("--offload-arch=gfx") == std::string::npos
#elif HIP_VERSION >= 305
hipccCompilerFlags.find("--amdgpu-target=gfx") == std::string::npos
#else
hipccCompilerFlags.find("-t gfx") == std::string::npos
#endif
) {
hipccCompilerFlags.find("--offload-arch=gfx") == std::string::npos) {

std::string archString = kernelProps.get<std::string>("arch", arch);

std::string archFlag;
if (startsWith(archString, "sm_")) {
archFlag = " -arch=" + archString;
} else if (startsWith(archString, "gfx")) {
#if HIP_VERSION >= 502
archFlag = " --offload-arch=" + archString;
#elif HIP_VERSION >= 305
archFlag = " --amdgpu-target=" + archString;
#else
archFlag = " -t " + archString;
#endif
} else {
OCCA_FORCE_ERROR("Unknown HIP arch");
}
Expand Down Expand Up @@ -274,13 +261,9 @@ namespace occa {
//---[ Compiling Command ]--------
command << compiler
<< " --genco"
#if defined(__HIP_PLATFORM_NVIDIA__) || (HIP_VERSION >= 305)
<< ' ' << compilerFlags
#else
<< " -f=\\\"" << compilerFlags << "\\\""
#endif
<< ' ' << hipccCompilerFlags;
#if defined(__HIP_PLATFORM_NVIDIA__) || (HIP_VERSION >= 305)

const bool includeOcca = kernelProps.get("kernel/include_occa", false);
const bool linkOcca = kernelProps.get("kernel/link_occa", false);
if (includeOcca) {
Expand All @@ -291,7 +274,6 @@ namespace occa {
/* NC: hipcc doesn't seem to like linking a library in */
//<< " -L" << env::OCCA_INSTALL_DIR << "lib -locca";
}
#endif
command << ' ' << sourceFilename
<< " -o " << binaryFilename
<< " 2>&1";
Expand Down

0 comments on commit ec6e59d

Please sign in to comment.