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
2 changes: 1 addition & 1 deletion src/relax/backend/contrib/hipblas/codegen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Array<runtime::Module> HipblasCompiler(Array<Function> functions, Map<String, ff
auto constant_names = serializer.GetConstantNames();
const auto pf = tvm::ffi::Function::GetGlobalRequired("runtime.HipblasJSONRuntimeCreate");
auto func_name = GetExtSymbol(func);
compiled_functions.push_back((*pf)(func_name, graph_json, constant_names));
compiled_functions.push_back(pf(func_name, graph_json, constant_names).cast<runtime::Module>());
}

return compiled_functions;
Expand Down
8 changes: 4 additions & 4 deletions src/runtime/contrib/hipblas/hipblas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ inline void CallGemmEx(ffi::PackedArgs args, ffi::Any* ret, hipblasHandle_t hdl)
<< "leading dimension must divide 4 for int8 gemm";
ICHECK(!TypeMatch(B->dtype, kDLInt, 8) || ColumnStride(B) % 4 == 0)
<< "leading dimension must divide 4 for int8 gemm";
double alpha = args.size() > 5 ? args[5] : 1.0;
double beta = args.size() > 6 ? args[6] : 0.0;
double alpha = args.size() > 5 ? args[5].cast<double>() : 1.0;
double beta = args.size() > 6 ? args[6].cast<double>() : 0.0;

hipblasDatatype_t hip_in_type = GetHipBlasDataType(A->dtype);
hipblasDatatype_t hip_out_type = GetHipBlasDataType(C->dtype);
Expand Down Expand Up @@ -359,8 +359,8 @@ inline void CallBatchGemmEx(ffi::PackedArgs args, ffi::Any* ret, hipblasHandle_t
<< "leading dimension must divide 4 for int8 gemm";
ICHECK(!TypeMatch(B->dtype, kDLInt, 8) || ColumnStride3D(B) % 4 == 0)
<< "leading dimension must divide 4 for int8 gemm";
double alpha = args.size() > 5 ? args[5] : 1.0;
double beta = args.size() > 6 ? args[6] : 0.0;
double alpha = args.size() > 5 ? args[5].cast<double>() : 1.0;
double beta = args.size() > 6 ? args[6].cast<double>() : 0.0;

int A_stride = A->shape[1] * A->shape[2];
int B_stride = B->shape[1] * B->shape[2];
Expand Down
6 changes: 2 additions & 4 deletions src/runtime/contrib/hipblas/hipblas_json_runtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,10 @@ class HipblasJSONRuntime : public JSONRuntimeBase {
for (size_t i = 0; i < static_cast<size_t>(args.size()); i++) {
auto eid = i < input_var_eid_.size() ? input_var_eid_[i]
: EntryID(outputs_[i - input_var_eid_.size()]);
ICHECK(args[i].type_code() == kTVMNDArrayHandle || args[i].type_code() == kTVMDLTensorHandle)
<< "Expect NDArray or DLTensor as inputs";

const DLTensor* arg;
if (args[i].IsObjectRef<NDArray>()) {
NDArray arr = args[i];
if (auto opt_nd = args[i].as<NDArray>()) {
NDArray arr = opt_nd.value();
arg = arr.operator->();
} else {
arg = args[i].cast<DLTensor*>();
Expand Down
Loading