Skip to content
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
4 changes: 3 additions & 1 deletion src/runtime/contrib/hipblas/hipblas_json_runtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* \brief A simple JSON runtime for HIPBLAS.
*/

#include <tvm/ffi/extra/c_env_api.h>
#include <tvm/ffi/function.h>
#include <tvm/ffi/reflection/registry.h>
#include <tvm/runtime/ndarray.h>
Expand All @@ -30,6 +31,7 @@
#include <string>
#include <vector>

#include "../../rocm/rocm_common.h"
#include "../json/json_node.h"
#include "../json/json_runtime.h"
#include "hipblas_utils.h"
Expand Down Expand Up @@ -86,7 +88,7 @@ class HipblasJSONRuntime : public JSONRuntimeBase {
if (device_id == -1) {
ROCM_CALL(hipGetDevice(&device_id));
}
auto* entry_ptr = tvm::contrib::HipBlasLtThreadEntry::ThreadLocal(Device(kDLROCM, device_id));
auto* entry_ptr = tvm::contrib::HipBlasLtThreadEntry::ThreadLocal(DLDevice{kDLROCM, device_id});
hipStream_t stream = static_cast<hipStream_t>(TVMFFIEnvGetCurrentStream(kDLROCM, device_id));

auto get_input = [this, &dl_tensors](const JSONGraphNode& node, int idx) {
Expand Down
5 changes: 3 additions & 2 deletions src/runtime/contrib/hipblas/hipblas_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "hipblas_utils.h"

#include <dmlc/thread_local.h>
#include <tvm/ffi/extra/c_env_api.h>
#include <tvm/ffi/function.h>

#include "../../rocm/rocm_common.h"
Expand All @@ -41,7 +42,7 @@ HipBlasThreadEntry::~HipBlasThreadEntry() {

typedef dmlc::ThreadLocalStore<HipBlasThreadEntry> HipBlasThreadStore;

HipBlasThreadEntry* HipBlasThreadEntry::ThreadLocal(Device curr_device) {
HipBlasThreadEntry* HipBlasThreadEntry::ThreadLocal(DLDevice curr_device) {
HipBlasThreadEntry* retval = HipBlasThreadStore::Get();
TVMFFIStreamHandle stream =
TVMFFIEnvGetCurrentStream(curr_device.device_type, curr_device.device_id);
Expand Down Expand Up @@ -72,7 +73,7 @@ HipBlasLtThreadEntry::~HipBlasLtThreadEntry() {

typedef dmlc::ThreadLocalStore<HipBlasLtThreadEntry> HipBlasLtThreadStore;

HipBlasLtThreadEntry* HipBlasLtThreadEntry::ThreadLocal(Device curr_device) {
HipBlasLtThreadEntry* HipBlasLtThreadEntry::ThreadLocal(DLDevice curr_device) {
return HipBlasLtThreadStore::Get();
}

Expand Down
4 changes: 2 additions & 2 deletions src/runtime/contrib/hipblas/hipblas_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct HipBlasThreadEntry {
HipBlasThreadEntry();
~HipBlasThreadEntry();
hipblasHandle_t handle{nullptr};
static HipBlasThreadEntry* ThreadLocal();
static HipBlasThreadEntry* ThreadLocal(DLDevice curr_device);
}; // HipBlasThreadEntry

struct HipBlasLtThreadEntry {
Expand All @@ -82,7 +82,7 @@ struct HipBlasLtThreadEntry {
// https://docs.nvidia.com/cuda/cublas/index.html#cublassetworkspace.
static constexpr const size_t workspace_size = 33554432;

static HipBlasLtThreadEntry* ThreadLocal();
static HipBlasLtThreadEntry* ThreadLocal(DLDevice curr_device);
}; // HipBlasLtThreadEntry

inline hipDataType GetHipDataType(DLDataType type) {
Expand Down
Loading