Skip to content

Commit 539ac90

Browse files
authored
Hot fix for windows build; don't include <dlfcn.h> in hipblas_instance.h (#5201)
Signed-off-by: Anatoly Myachev <[email protected]>
1 parent ac5a15e commit 539ac90

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

third_party/amd/include/hipblas_instance.h

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,21 @@
22
#define TRITON_HIPBLAS_INSTANCE_H
33

44
#include "hipblas_types.h"
5+
#ifdef WIN32
6+
#define WIN32_LEAN_AND_MEAN
7+
#define NOMINMAX
8+
#include <windows.h>
9+
// tricky one
10+
// otherwise there may be a compilation error of
11+
// llvm/TargetParser/TargetParser.h due to a coincidence between the macro name
12+
// and one of the values in the enum:
13+
// https://github.com/llvm/llvm-project/blame/bb38b48910967041045997a0c1293ee2ba834196/llvm/include/llvm/TargetParser/TargetParser.h#L166-L170C3
14+
#ifdef NO_ERROR
15+
#undef NO_ERROR
16+
#endif
17+
#else
518
#include <dlfcn.h>
19+
#endif
620
#include <sstream>
721
#include <stdexcept>
822
#include <string>
@@ -70,6 +84,9 @@ class HipblasLtInstance {
7084
hipblasLtMatmulPreference_t preference = NULL;
7185

7286
void loadHipBlasDylib() {
87+
#ifdef WIN32
88+
assert(0 && "Not implemented on Windows");
89+
#else
7390
if (dylibHandle == nullptr) {
7491
// First reuse the existing handle
7592
dylibHandle = dlopen(name, RTLD_NOLOAD);
@@ -116,9 +133,16 @@ class HipblasLtInstance {
116133
std::string(name) +
117134
"`: " + std::string(dlsym_error));
118135
}
136+
#endif
119137
}
120138

121-
void unloadHipBlasDylib() { dlclose(dylibHandle); }
139+
void unloadHipBlasDylib() {
140+
#ifdef WIN32
141+
assert(0 && "Not implemented on Windows");
142+
#else
143+
dlclose(dylibHandle);
144+
#endif
145+
}
122146

123147
void successOrExit(hipblasStatus_t status, const std::string &context = "") {
124148
if (status != HIPBLAS_STATUS_SUCCESS) {

0 commit comments

Comments
 (0)