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

[FIX] Fix clang12 warnings #7593

Merged
merged 1 commit into from
Mar 9, 2021
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
3 changes: 3 additions & 0 deletions src/relay/backend/contrib/tensorrt/codegen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ class TensorRTJSONSerializer : public backend::contrib::JSONSerializer {
// with slice_mode = "size", attrs->end_value mean the size of the slice
int end_value = attrs->end.value()[i].as<IntImmNode>()->value;
size_value = (end_value == -1) ? ishape[i] - begin_value : end_value;
} else {
LOG(FATAL) << "Unexpected slice_mode " << attrs->slice_mode << ", expected end or size";
throw;
}
ICHECK_GT(size_value, 0);
size.push_back(std::to_string(size_value));
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/contrib/cublas/cublas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ inline void CallLtIgemm(TVMArgs args, TVMRetValue* ret, cublasLtHandle_t hdl) {
ICHECK(CheckMixPrecisionType(A->dtype, C->dtype)) << "Unsupported data type";
int32_t alpha = args.size() > 5 ? args[5] : 1;
int32_t beta = args.size() > 6 ? args[6] : 0;
cublasLtMatrixLayout_t Adesc = NULL, Bdesc = NULL, Cdesc = NULL;
cublasLtMatrixLayout_t Adesc = nullptr, Bdesc = nullptr, Cdesc = nullptr;
auto A_data = reinterpret_cast<void*>(static_cast<char*>(A->data) + A->byte_offset);
auto B_data = reinterpret_cast<void*>(static_cast<char*>(B->data) + B->byte_offset);
auto C_data = reinterpret_cast<void*>(static_cast<char*>(C->data) + C->byte_offset);
Expand Down Expand Up @@ -204,7 +204,7 @@ inline void CallLtIgemm(TVMArgs args, TVMRetValue* ret, cublasLtHandle_t hdl) {
&order_COL32, sizeof(order_COL32)));

CHECK_CUBLAS_ERROR(cublasLtMatmul(hdl, operationDesc, &alpha, B_data, Adesc, A_data, Bdesc, &beta,
C_data, Cdesc, C_data, Cdesc, NULL, NULL, 0, 0));
C_data, Cdesc, C_data, Cdesc, nullptr, nullptr, 0, nullptr));
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/runtime/contrib/cublas/cublas_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ CuBlasThreadEntry::CuBlasThreadEntry() { CHECK_CUBLAS_ERROR(cublasCreate(&handle
CuBlasThreadEntry::~CuBlasThreadEntry() {
if (handle) {
cublasDestroy(handle);
handle = 0;
handle = nullptr;
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/runtime/contrib/json/json_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class JSONRuntimeBase : public ModuleNode {
LoadGraph(graph_json_);
}

const char* type_key() const { return "json"; }
const char* type_key() const override { return "json"; }
Copy link
Member

Choose a reason for hiding this comment

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

should also be final as well, do it to other places that overrides

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, arm compute lib inherits from this class. I'm leaving everything as override.


/*! \brief Initialize a specific json runtime. */
virtual void Init(const Array<NDArray>& consts) = 0;
Expand All @@ -69,7 +69,7 @@ class JSONRuntimeBase : public ModuleNode {
* \param sptr_to_self The pointer to the module node.
* \return The packed function.
*/
virtual PackedFunc GetFunction(const std::string& name, const ObjectPtr<Object>& sptr_to_self) {
PackedFunc GetFunction(const std::string& name, const ObjectPtr<Object>& sptr_to_self) override {
if (name == "get_symbol") {
return PackedFunc(
[sptr_to_self, this](TVMArgs args, TVMRetValue* rv) { *rv = this->symbol_name_; });
Expand Down Expand Up @@ -98,7 +98,7 @@ class JSONRuntimeBase : public ModuleNode {
}
}

virtual void SaveToBinary(dmlc::Stream* stream) {
void SaveToBinary(dmlc::Stream* stream) override {
Copy link
Member

Choose a reason for hiding this comment

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

Should be final

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

// Save the symbol
stream->Write(symbol_name_);
// Save the graph
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/micro/micro_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class MicroTransportChannel : public RPCChannel {
// confusion.
unsigned int seed = random_seed.load();
if (seed == 0) {
seed = (unsigned int)time(NULL);
seed = (unsigned int)time(nullptr);
}
uint8_t initial_nonce = 0;
for (int i = 0; i < kNumRandRetries && initial_nonce == 0; ++i) {
Expand Down