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

[ORO-0] Support newer HIP builds on windows #22

Merged
merged 1 commit into from
Apr 19, 2022
Merged
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
46 changes: 34 additions & 12 deletions contrib/hipew/src/hipew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ typedef void* DynamicLibrary;
_LIBRARY_FIND_CHECKED(hip_lib, name)
#define HIP_LIBRARY_FIND(name) _LIBRARY_FIND(hip_lib, name)

#define HIPRTC_LIBRARY_FIND_CHECKED( name ) _LIBRARY_FIND_CHECKED( hiprtc_lib, name )
#define HIPRTC_LIBRARY_FIND( name ) _LIBRARY_FIND( hiprtc_lib, name )

static DynamicLibrary hip_lib;
static DynamicLibrary hiprtc_lib;

/* Function definitions. */
thipGetErrorName *hipGetErrorName;
Expand Down Expand Up @@ -259,13 +262,15 @@ static int hipewHasOldDriver(const char *hip_path) {
static int hipewHipInit(void) {
/* Library paths. */
#ifdef _WIN32
/* Expected in c:/windows/system or similar, no path needed. */
const char *hip_paths[] = {"amdhip64.dll", NULL};
/* Expected in C:/Windows/System32 or similar, no path needed. */
const char* hip_paths[] = {"amdhip64.dll", NULL};
const char *hiprtc_paths[] = {"hiprtc.dll", NULL};
#elif defined(__APPLE__)
/* Default installation path. */
const char *hip_paths[] = {"", NULL};
#else
const char *hip_paths[] = {"/opt/rocm/hip/lib/libamdhip64.so", NULL};
const char* hiprtc_paths[] = { "", NULL };
#endif
static int initialized = 0;
static int result = 0;
Expand Down Expand Up @@ -293,6 +298,7 @@ static int hipewHipInit(void) {

/* Load library. */
hip_lib = dynamic_library_open_find(hip_paths);
hiprtc_lib = dynamic_library_open_find(hiprtc_paths);

if (hip_lib == NULL) {
result = HIPEW_ERROR_OPEN_FAILED;
Expand Down Expand Up @@ -423,16 +429,32 @@ static int hipewHipInit(void) {
HIP_LIBRARY_FIND_CHECKED(hipImportExternalMemory);
HIP_LIBRARY_FIND_CHECKED(hipExternalMemoryGetMappedBuffer);
HIP_LIBRARY_FIND_CHECKED(hipDestroyExternalMemory);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetErrorString);
HIP_LIBRARY_FIND_CHECKED(hiprtcAddNameExpression);
HIP_LIBRARY_FIND_CHECKED(hiprtcCompileProgram);
HIP_LIBRARY_FIND_CHECKED(hiprtcCreateProgram);
HIP_LIBRARY_FIND_CHECKED(hiprtcDestroyProgram);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetLoweredName);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetProgramLog);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetProgramLogSize);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetCode);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetCodeSize);
if(hiprtc_lib)
{
HIPRTC_LIBRARY_FIND_CHECKED(hiprtcGetErrorString);
HIPRTC_LIBRARY_FIND_CHECKED(hiprtcAddNameExpression);
HIPRTC_LIBRARY_FIND_CHECKED(hiprtcCompileProgram);
HIPRTC_LIBRARY_FIND_CHECKED(hiprtcCreateProgram);
HIPRTC_LIBRARY_FIND_CHECKED(hiprtcDestroyProgram);
HIPRTC_LIBRARY_FIND_CHECKED(hiprtcGetLoweredName);
HIPRTC_LIBRARY_FIND_CHECKED(hiprtcGetProgramLog);
HIPRTC_LIBRARY_FIND_CHECKED(hiprtcGetProgramLogSize);
HIPRTC_LIBRARY_FIND_CHECKED(hiprtcGetCode);
HIPRTC_LIBRARY_FIND_CHECKED(hiprtcGetCodeSize);
}
else
{
HIP_LIBRARY_FIND_CHECKED(hiprtcGetErrorString);
HIP_LIBRARY_FIND_CHECKED(hiprtcAddNameExpression);
HIP_LIBRARY_FIND_CHECKED(hiprtcCompileProgram);
HIP_LIBRARY_FIND_CHECKED(hiprtcCreateProgram);
HIP_LIBRARY_FIND_CHECKED(hiprtcDestroyProgram);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetLoweredName);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetProgramLog);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetProgramLogSize);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetCode);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetCodeSize);
}
result = HIPEW_SUCCESS;
return result;
}
Expand Down