mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-28 22:56:32 +00:00
Address some code scan issues. (#9752)
This commit is contained in:
parent
ac57afc3a6
commit
9acbfeba09
2 changed files with 10 additions and 10 deletions
|
|
@ -47,7 +47,7 @@ enum StatusCode {
|
|||
EP_FAIL = 11
|
||||
};
|
||||
|
||||
inline const char* StatusCodeToString(StatusCode status) noexcept {
|
||||
constexpr const char* StatusCodeToString(StatusCode status) noexcept {
|
||||
switch (status) {
|
||||
case StatusCode::OK:
|
||||
return "SUCCESS";
|
||||
|
|
@ -79,7 +79,7 @@ inline const char* StatusCodeToString(StatusCode status) noexcept {
|
|||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
inline HRESULT StatusCodeToHRESULT(StatusCode status) noexcept {
|
||||
constexpr HRESULT StatusCodeToHRESULT(StatusCode status) noexcept {
|
||||
switch (status)
|
||||
{
|
||||
case StatusCode::OK:
|
||||
|
|
@ -89,23 +89,23 @@ inline HRESULT StatusCodeToHRESULT(StatusCode status) noexcept {
|
|||
case StatusCode::INVALID_ARGUMENT:
|
||||
return E_INVALIDARG;
|
||||
case StatusCode::NO_SUCHFILE:
|
||||
return __HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
|
||||
return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
|
||||
case StatusCode::NO_MODEL:
|
||||
return __HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
|
||||
return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
|
||||
case StatusCode::ENGINE_ERROR:
|
||||
return E_FAIL;
|
||||
case StatusCode::RUNTIME_EXCEPTION:
|
||||
return E_FAIL;
|
||||
case StatusCode::INVALID_PROTOBUF:
|
||||
return __HRESULT_FROM_WIN32(ERROR_FILE_CORRUPT);
|
||||
return HRESULT_FROM_WIN32(ERROR_FILE_CORRUPT);
|
||||
case StatusCode::MODEL_LOADED:
|
||||
return __HRESULT_FROM_WIN32(ERROR_INTERNAL_ERROR);
|
||||
return HRESULT_FROM_WIN32(ERROR_INTERNAL_ERROR);
|
||||
case StatusCode::NOT_IMPLEMENTED:
|
||||
return E_NOTIMPL;
|
||||
case StatusCode::INVALID_GRAPH:
|
||||
return __HRESULT_FROM_WIN32(ERROR_FILE_CORRUPT);
|
||||
return HRESULT_FROM_WIN32(ERROR_FILE_CORRUPT);
|
||||
case StatusCode::EP_FAIL:
|
||||
return __HRESULT_FROM_WIN32(ERROR_INTERNAL_ERROR);
|
||||
return HRESULT_FROM_WIN32(ERROR_INTERNAL_ERROR);
|
||||
default:
|
||||
return E_FAIL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -630,8 +630,8 @@ void LambMultiTensorReductionFunctor<TIn1, TIn2, TOut1, TOut2, TBuf>::operator()
|
|||
const int shared_memory_size = thread_count / GPU_WARP_SIZE * 2 * sizeof(TBuf);
|
||||
|
||||
// Enforce assumptions used inside this reduction CUDA kernel.
|
||||
ORT_ENFORCE(thread_count % GPU_WARP_SIZE == 0);
|
||||
ORT_ENFORCE((thread_count & (thread_count - 1)) == 0);
|
||||
static_assert(thread_count % GPU_WARP_SIZE == 0, "thread_count must be a multiple of GPU_WARP_SIZE");
|
||||
static_assert((thread_count & (thread_count - 1)) == 0, "thread_count must be a power of two");
|
||||
|
||||
const int num_blocks = chunk_group.chunk_count;
|
||||
const size_t w_buffer_size = num_blocks * sizeof(TOut1);
|
||||
|
|
|
|||
Loading…
Reference in a new issue