Skip to content

Commit

Permalink
Further Fixes for C++ lint
Browse files Browse the repository at this point in the history
  • Loading branch information
TedThemistokleous committed Oct 27, 2023
1 parent 3fbb77f commit e8c5c59
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 25 deletions.
10 changes: 5 additions & 5 deletions include/onnxruntime/core/session/onnxruntime_c_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -598,11 +598,11 @@ typedef struct OrtTensorRTProviderOptions {
* \see OrtApi::SessionOptionsAppendExecutionProvider_MIGraphX
*/
typedef struct OrtMIGraphXProviderOptions {
int device_id; // hip device id.
int migraphx_fp16_enable; // enable MIGraphX FP16 precision. Default 0 = false, nonzero = true
int migraphx_int8_enable; // enable MIGraphX INT8 precision. Default 0 = false, nonzero = true
int migraphx_use_native_calibration_table; // MIGraphx INT8 cal table. Default 0 = false, noznero = true
const char* migraphx_int8_calibration_table_name; // MIGraphx INT8 calibration table name
int device_id; // hip device id.
int migraphx_fp16_enable; // enable MIGraphX FP16 precision. Default 0 = false, nonzero = true
int migraphx_int8_enable; // enable MIGraphX INT8 precision. Default 0 = false, nonzero = true
int migraphx_use_native_calibration_table; // MIGraphx INT8 cal table. Default 0 = false, noznero = true
const char* migraphx_int8_calibration_table_name; // MIGraphx INT8 calibration table name
} OrtMIGraphXProviderOptions;

/** \brief OpenVINO Provider Options
Expand Down
4 changes: 2 additions & 2 deletions onnxruntime/core/providers/migraphx/migraphx_call.cc
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#include "core/providers/shared_library/provider_api.h"
#include <unistd.h>
#include <string.h>
#include <miopen/miopen.h>
#include <rocblas/rocblas.h>
#include "migraphx_call.h"
#include "core/providers/shared_library/provider_api.h"
#include "core/common/common.h"
#include "core/common/status.h"
#include "migraphx_call.h"

Check warning on line 11 in onnxruntime/core/providers/migraphx/migraphx_call.cc

View workflow job for this annotation

GitHub Actions / Lint C++

[cpplint] reported by reviewdog 🐶 Include the directory when naming header files [build/include_subdir] [4] Raw Output: onnxruntime/core/providers/migraphx/migraphx_call.cc:11: Include the directory when naming header files [build/include_subdir] [4]

namespace onnxruntime {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License
#include <fstream>
#include <algorithm>
#include <iterator>
#include <unordered_map>
#include <set>

#include "core/providers/shared_library/provider_api.h"
#define ORT_API_MANUAL_INIT
Expand All @@ -12,14 +17,10 @@
#include "gpu_data_transfer.h"
#include "migraphx_inc.h"

#include <fstream>
#include <algorithm>
#include <iterator>
#include <unordered_map>

// TODO: find a better way to share this
#include "core/providers/rocm/rocm_stream_handle.h"


#if defined(_MSC_VER)
#pragma warning(disable : 4244 4245)
#elif __GNUC__
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@

#pragma once

#include <map>
#include <unordered_map>
#include <miopen/miopen.h>

Check warning on line 8 in onnxruntime/core/providers/migraphx/migraphx_execution_provider.h

View workflow job for this annotation

GitHub Actions / Lint C++

[cpplint] reported by reviewdog 🐶 Found C system header after C++ system header. Should be: migraphx_execution_provider.h, c system, c++ system, other. [build/include_order] [4] Raw Output: onnxruntime/core/providers/migraphx/migraphx_execution_provider.h:8: Found C system header after C++ system header. Should be: migraphx_execution_provider.h, c system, c++ system, other. [build/include_order] [4]
#include <rocblas/rocblas.h>

Check warning on line 9 in onnxruntime/core/providers/migraphx/migraphx_execution_provider.h

View workflow job for this annotation

GitHub Actions / Lint C++

[cpplint] reported by reviewdog 🐶 Found C system header after C++ system header. Should be: migraphx_execution_provider.h, c system, c++ system, other. [build/include_order] [4] Raw Output: onnxruntime/core/providers/migraphx/migraphx_execution_provider.h:9: Found C system header after C++ system header. Should be: migraphx_execution_provider.h, c system, c++ system, other. [build/include_order] [4]
#include "core/framework/arena_extend_strategy.h"
#include "core/framework/execution_provider.h"
#include "core/platform/ort_mutex.h"
#include "migraphx_execution_provider_info.h"

#include <map>
#include <unordered_map>
#include "migraphx_inc.h"
// TODO: find a better way to share this
// #include "core/providers/cuda/rocm_stream_handle.h"
#include <miopen/miopen.h>
#include <rocblas/rocblas.h>


namespace onnxruntime {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ bool canEvalNodeArgument(const GraphViewer& graph,
return true;
}

float ConvertSinglePrecisionIEEE754ToFloat(uint32_t input) {
float ConvertSinglePrecisionIEEE754ToFloat(unisgned long input) {

Check warning on line 155 in onnxruntime/core/providers/migraphx/migraphx_execution_provider_utils.h

View workflow job for this annotation

GitHub Actions / Lint C++

[cpplint] reported by reviewdog 🐶 Use int16/int64/etc, rather than the C type long [runtime/int] [4] Raw Output: onnxruntime/core/providers/migraphx/migraphx_execution_provider_utils.h:155: Use int16/int64/etc, rather than the C type long [runtime/int] [4]
int s = (input >> 31) & 0x01;
int e = ((input & 0x7f800000) >> 23) - 127;
int p = -1;
Expand Down Expand Up @@ -224,7 +224,7 @@ bool ReadDynamicRange(const std::string file_name,
size_t length = infile.tellg();
infile.seekg(0, std::ios::beg);
std::unique_ptr<char[]> data{new char[length]};
infile.read((char*)data.get(), length);
infile.read(reinterpret_cast<char*>(data.get()), length);
infile.close();
auto flat_table = flatbuffers::GetRoot<CalTableFlatBuffers::TrtTable>(reinterpret_cast<char*>(data.get()));
auto flat_dict = flat_table->dict();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License
#include <atomic>

#include "core/providers/shared_library/provider_api.h"
#include "core/providers/migraphx/migraphx_provider_factory.h"
Expand All @@ -8,7 +9,6 @@
#include "hip_allocator.h"
#include "gpu_data_transfer.h"
#include "core/framework/provider_options.h"
#include <atomic>

#include "core/session/onnxruntime_c_api.h"

Expand Down Expand Up @@ -48,7 +48,8 @@ struct MIGraphX_Provider : Provider {
info.target_device = "gpu";
info.fp16_enable = options.migraphx_fp16_enable;
info.int8_enable = options.migraphx_int8_enable;
info.int8_calibration_table_name = options.migraphx_int8_calibration_table_name == nullptr ? "" : options.migraphx_int8_calibration_table_name;
info.int8_calibration_table_name = options.migraphx_int8_calibration_table_name == nullptr ? "" :
options.migraphx_int8_calibration_table_name;
info.int8_use_native_calibration_table = options.migraphx_use_native_calibration_table != 0;
return std::make_shared<MIGraphXProviderFactory>(info);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#ifndef ONNXRUNTIME_CORE_PROVIDERS_MIGRAPHX_ORT_TRT_INT8_CAL_TABLE_FBS_H_
#define ONNXRUNTIME_CORE_PROVIDERS_MIGRAPHX_ORT_TRT_INT8_CAL_TABLE_FBS_H_

#include "flatbuffers/flatbuffers.h"
#include <vector>
#include "flatbuffers/flatbuffers.h"

namespace CalTableFlatBuffers {

Expand Down
9 changes: 6 additions & 3 deletions onnxruntime/python/onnxruntime_pybind_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,10 @@ std::unique_ptr<IExecutionProvider> CreateExecutionProviderInstance(
}
}
}
LOGS_DEFAULT(WARNING) << "Failed to create " << type << ". Please reference https://onnxruntime.ai/docs/execution-providers/TensorRT-ExecutionProvider.html#requirements to ensure all dependencies are met.";
LOGS_DEFAULT(WARNING) << "Failed to create "
<< type
<< ". Please reference "
<< "https://onnxruntime.ai/docs/execution-providers/TensorRT-ExecutionProvider.html#requirements to ensure all dependencies are met.";

Check warning on line 724 in onnxruntime/python/onnxruntime_pybind_state.cc

View workflow job for this annotation

GitHub Actions / Lint C++

[cpplint] reported by reviewdog 🐶 Lines should be <= 120 characters long [whitespace/line_length] [2] Raw Output: onnxruntime/python/onnxruntime_pybind_state.cc:724: Lines should be <= 120 characters long [whitespace/line_length] [2]
#endif
} else if (type == kMIGraphXExecutionProvider) {
#ifdef USE_MIGRAPHX
Expand Down Expand Up @@ -820,8 +823,8 @@ std::unique_ptr<IExecutionProvider> CreateExecutionProviderInstance(
LOGS_DEFAULT(WARNING) << "Failed to create "
<< type
<< ". Please reference "
<< " https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#requirements"
<< " to ensure all dependencies are met.";
<< "https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#requirements"
<< "to ensure all dependencies are met.";
#endif
} else if (type == kRocmExecutionProvider) {
#ifdef USE_ROCM
Expand Down

0 comments on commit e8c5c59

Please sign in to comment.