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

[BugFix] Fix the error of reloading the model library on the ROCm platform: "MIOpen Error: No invoker was registered for convolution forward.” #16190

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/runtime/contrib/miopen/conv_forward.cc
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,29 @@ TVM_REGISTER_GLOBAL("tvm.contrib.miopen.conv2d.forward")
entry_ptr->conv_entry.data_type, y->shape[0],
y->shape[1], y->shape[2], y->shape[3]));

// Set workspace
size_t workspace_size = 0;
MIOPEN_CALL(miopenConvolutionForwardGetWorkSpaceSize(
entry_ptr->handle, entry_ptr->conv_entry.filter_desc, entry_ptr->conv_entry.input_desc,
entry_ptr->conv_entry.conv_desc, entry_ptr->conv_entry.output_desc, &workspace_size));
entry_ptr->conv_entry.UpdateWorkspace(workspace_size);

const float alpha = 1.f;
const float beta = 0.f;

const int request_algo_count = 4;
const bool exhaustive_search = true;
void* workspace = entry_ptr->conv_entry.workspace;
if (workspace_size == 0) workspace = nullptr;
int returned_algo_count = 0;
miopenConvAlgoPerf_t perfs[4];

MIOPEN_CALL(miopenFindConvolutionForwardAlgorithm(
entry_ptr->handle, entry_ptr->conv_entry.input_desc, x->data,
entry_ptr->conv_entry.filter_desc, w->data, entry_ptr->conv_entry.conv_desc,
entry_ptr->conv_entry.output_desc, y->data, request_algo_count, &returned_algo_count,
perfs, workspace, workspace_size, exhaustive_search));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider reset entry_ptr->fwd_algo to simply the best returned algo


MIOPEN_CALL(miopenConvolutionForward(
entry_ptr->handle, &alpha, entry_ptr->conv_entry.input_desc, x->data,
entry_ptr->conv_entry.filter_desc, w->data, entry_ptr->conv_entry.conv_desc,
Expand Down