Skip to content

Commit

Permalink
Fixing clang format issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Uros Petkovic committed Jan 3, 2025
1 parent b4b980c commit a3cdc74
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,18 +210,18 @@ MIGraphXExecutionProvider::~MIGraphXExecutionProvider() {
}

AllocatorPtr MIGraphXExecutionProvider::CreateMIGraphXAllocator(OrtDevice::DeviceId device_id,
size_t migx_mem_limit,
ArenaExtendStrategy arena_extend_strategy,
MIGraphXExecutionProviderExternalAllocatorInfo
external_allocator_info,
const OrtArenaCfg* default_memory_arena_cfg) {
size_t migx_mem_limit,

Check warning on line 213 in onnxruntime/core/providers/migraphx/migraphx_execution_provider.cc

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] onnxruntime/core/providers/migraphx/migraphx_execution_provider.cc#L213

Do not indent within a namespace. [whitespace/indent_namespace] [4]
Raw output
onnxruntime/core/providers/migraphx/migraphx_execution_provider.cc:213:  Do not indent within a namespace.  [whitespace/indent_namespace] [4]
ArenaExtendStrategy arena_extend_strategy,

Check warning on line 214 in onnxruntime/core/providers/migraphx/migraphx_execution_provider.cc

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] onnxruntime/core/providers/migraphx/migraphx_execution_provider.cc#L214

Do not indent within a namespace. [whitespace/indent_namespace] [4]
Raw output
onnxruntime/core/providers/migraphx/migraphx_execution_provider.cc:214:  Do not indent within a namespace.  [whitespace/indent_namespace] [4]
MIGraphXExecutionProviderExternalAllocatorInfo

Check warning on line 215 in onnxruntime/core/providers/migraphx/migraphx_execution_provider.cc

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] onnxruntime/core/providers/migraphx/migraphx_execution_provider.cc#L215

Do not indent within a namespace. [whitespace/indent_namespace] [4]
Raw output
onnxruntime/core/providers/migraphx/migraphx_execution_provider.cc:215:  Do not indent within a namespace.  [whitespace/indent_namespace] [4]
external_allocator_info,

Check warning on line 216 in onnxruntime/core/providers/migraphx/migraphx_execution_provider.cc

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] onnxruntime/core/providers/migraphx/migraphx_execution_provider.cc#L216

Do not indent within a namespace. [whitespace/indent_namespace] [4]
Raw output
onnxruntime/core/providers/migraphx/migraphx_execution_provider.cc:216:  Do not indent within a namespace.  [whitespace/indent_namespace] [4]
const OrtArenaCfg* default_memory_arena_cfg) {

Check warning on line 217 in onnxruntime/core/providers/migraphx/migraphx_execution_provider.cc

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] onnxruntime/core/providers/migraphx/migraphx_execution_provider.cc#L217

Do not indent within a namespace. [whitespace/indent_namespace] [4]
Raw output
onnxruntime/core/providers/migraphx/migraphx_execution_provider.cc:217:  Do not indent within a namespace.  [whitespace/indent_namespace] [4]
if (external_allocator_info.UseExternalAllocator()) {
AllocatorCreationInfo default_memory_info(
[external_allocator_info](OrtDevice::DeviceId id) {
return std::make_unique<MIGraphXExternalAllocator>(id, HIP,
external_allocator_info.alloc,
external_allocator_info.free,
external_allocator_info.empty_cache);
external_allocator_info.alloc,
external_allocator_info.free,
external_allocator_info.empty_cache);
},
device_id,
false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class MIGraphXExecutionProvider : public IExecutionProvider {
std::unique_ptr<onnxruntime::IDataTransfer> GetDataTransfer() const override;

static AllocatorPtr CreateMIGraphXAllocator(OrtDevice::DeviceId device_id, size_t migx_mem_limit, ArenaExtendStrategy arena_extend_strategy,

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

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] onnxruntime/core/providers/migraphx/migraphx_execution_provider.h#L79

Lines should be <= 120 characters long [whitespace/line_length] [2]
Raw output
onnxruntime/core/providers/migraphx/migraphx_execution_provider.h:79:  Lines should be <= 120 characters long  [whitespace/line_length] [2]
MIGraphXExecutionProviderExternalAllocatorInfo external_alloc_info, const OrtArenaCfg* arena_cfg);
MIGraphXExecutionProviderExternalAllocatorInfo external_alloc_info, const OrtArenaCfg* arena_cfg);

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

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] onnxruntime/core/providers/migraphx/migraphx_execution_provider.h#L80

Lines should be <= 120 characters long [whitespace/line_length] [2]
Raw output
onnxruntime/core/providers/migraphx/migraphx_execution_provider.h:80:  Lines should be <= 120 characters long  [whitespace/line_length] [2]

std::unique_ptr<IndexedSubGraph> GetSubGraph(const std::vector<std::size_t>& graph_nodes_index, const GraphViewer& graph) const;
void RegisterStreamHandlers(IStreamCommandHandleRegistry& stream_handle_registry, AllocatorMap& allocators) const override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct MIGraphXExecutionProviderInfo {
std::string load_model_file{"./compiled_model.mxr"};
bool exhaustive_tune{false};

size_t mem_limit{std::numeric_limits<size_t>::max()}; // Will be over-ridden by contents of `default_memory_arena_cfg` (if specified)
size_t mem_limit{std::numeric_limits<size_t>::max()}; // Will be over-ridden by contents of `default_memory_arena_cfg` (if specified)

Check warning on line 54 in onnxruntime/core/providers/migraphx/migraphx_execution_provider_info.h

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] onnxruntime/core/providers/migraphx/migraphx_execution_provider_info.h#L54

Lines should be <= 120 characters long [whitespace/line_length] [2]
Raw output
onnxruntime/core/providers/migraphx/migraphx_execution_provider_info.h:54:  Lines should be <= 120 characters long  [whitespace/line_length] [2]
ArenaExtendStrategy arena_extend_strategy{ArenaExtendStrategy::kNextPowerOfTwo}; // Will be over-ridden by contents of `default_memory_arena_cfg` (if specified)

Check warning on line 55 in onnxruntime/core/providers/migraphx/migraphx_execution_provider_info.h

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] onnxruntime/core/providers/migraphx/migraphx_execution_provider_info.h#L55

Lines should be <= 120 characters long [whitespace/line_length] [2]
Raw output
onnxruntime/core/providers/migraphx/migraphx_execution_provider_info.h:55:  Lines should be <= 120 characters long  [whitespace/line_length] [2]

OrtArenaCfg* default_memory_arena_cfg{nullptr};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct ProviderInfo_MIGraphX_Impl final : ProviderInfo_MIGraphX {
HIP_CALL_THROW(hipMemcpy(dst, src, count, hipMemcpyDeviceToHost));
}

std::shared_ptr<IAllocator> CreateMIGraphXAllocator(int16_t device_id, size_t migx_mem_limit, onnxruntime::ArenaExtendStrategy arena_extend_strategy, onnxruntime::MIGraphXExecutionProviderExternalAllocatorInfo& external_allocator_info, const OrtArenaCfg* default_memory_arena_cfg) override {
std::shared_ptr<IAllocator> CreateMIGraphXAllocator(int16_t device_id, size_t migx_mem_limit, onnxruntime::ArenaExtendStrategy arena_extend_strategy, onnxruntime::MIGraphXExecutionProviderExternalAllocatorInfo& external_allocator_info, const OrtArenaCfg* default_memory_arena_cfg) override {

Check warning on line 64 in onnxruntime/core/providers/migraphx/migraphx_provider_factory.cc

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] onnxruntime/core/providers/migraphx/migraphx_provider_factory.cc#L64

Lines should be <= 120 characters long [whitespace/line_length] [2]
Raw output
onnxruntime/core/providers/migraphx/migraphx_provider_factory.cc:64:  Lines should be <= 120 characters long  [whitespace/line_length] [2]
return MIGraphXExecutionProvider::CreateMIGraphXAllocator(device_id, migx_mem_limit, arena_extend_strategy, external_allocator_info, default_memory_arena_cfg);

Check warning on line 65 in onnxruntime/core/providers/migraphx/migraphx_provider_factory.cc

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] onnxruntime/core/providers/migraphx/migraphx_provider_factory.cc#L65

Lines should be <= 120 characters long [whitespace/line_length] [2]
Raw output
onnxruntime/core/providers/migraphx/migraphx_provider_factory.cc:65:  Lines should be <= 120 characters long  [whitespace/line_length] [2]
}
} g_info;
Expand Down
51 changes: 30 additions & 21 deletions onnxruntime/python/onnxruntime_pybind_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,7 @@ void addGlobalMethods(py::module& m) {
ORT_UNUSED_PARAMETER(algo);
ORT_THROW("set_cudnn_conv_algo_search is not supported in ROCM");
#else
cudnn_conv_algo_search = algo;
cudnn_conv_algo_search = algo;
#endif
});
// TODO remove deprecated global config
Expand All @@ -1443,7 +1443,7 @@ void addGlobalMethods(py::module& m) {
ORT_UNUSED_PARAMETER(use_single_stream);
ORT_THROW("set_do_copy_in_default_stream is not supported in ROCM");
#else
do_copy_in_default_stream = use_single_stream;
do_copy_in_default_stream = use_single_stream;
#endif
});
// TODO remove deprecated global config
Expand Down Expand Up @@ -1808,10 +1808,10 @@ Applies to session load, initialization, etc. Default is 0.)pbdoc")
}
ORT_THROW_IF_ERROR(options->value.AddExternalInitializers(names_ptrs, values_ptrs));
#else
ORT_UNUSED_PARAMETER(options);
ORT_UNUSED_PARAMETER(names);
ORT_UNUSED_PARAMETER(ort_values);
ORT_THROW("External initializers are not supported in this build.");
ORT_UNUSED_PARAMETER(options);
ORT_UNUSED_PARAMETER(names);
ORT_UNUSED_PARAMETER(ort_values);
ORT_THROW("External initializers are not supported in this build.");
#endif
});

Expand Down Expand Up @@ -1873,7 +1873,8 @@ including arg name, arg type (contains both type and shape).)pbdoc")
return *(na.Type());
},
"node type")
.def("__str__", [](const onnxruntime::NodeArg& na) -> std::string {
.def(
"__str__", [](const onnxruntime::NodeArg& na) -> std::string {
std::ostringstream res;
res << "NodeArg(name='" << na.Name() << "', type='" << *(na.Type()) << "', shape=";
auto shape = na.Shape();
Expand All @@ -1900,7 +1901,8 @@ including arg name, arg type (contains both type and shape).)pbdoc")
res << ")";

return std::string(res.str()); }, "converts the node into a readable string")
.def_property_readonly("shape", [](const onnxruntime::NodeArg& na) -> std::vector<py::object> {
.def_property_readonly(
"shape", [](const onnxruntime::NodeArg& na) -> std::vector<py::object> {
auto shape = na.Shape();
std::vector<py::object> arr;
if (shape == nullptr || shape->dim_size() == 0) {
Expand Down Expand Up @@ -2108,25 +2110,32 @@ including arg name, arg type (contains both type and shape).)pbdoc")
.def_property_readonly("get_profiling_start_time_ns", [](const PyInferenceSession* sess) -> uint64_t {
return sess->GetSessionHandle()->GetProfiling().GetStartTimeNs();
})
.def("get_providers", [](const PyInferenceSession* sess) -> const std::vector<std::string>& { return sess->GetSessionHandle()->GetRegisteredProviderTypes(); }, py::return_value_policy::reference_internal)
.def("get_provider_options", [](const PyInferenceSession* sess) -> const ProviderOptionsMap& { return sess->GetSessionHandle()->GetAllProviderOptions(); }, py::return_value_policy::reference_internal)
.def_property_readonly("session_options", [](const PyInferenceSession* sess) -> PySessionOptions* {
.def(
"get_providers", [](const PyInferenceSession* sess) -> const std::vector<std::string>& { return sess->GetSessionHandle()->GetRegisteredProviderTypes(); }, py::return_value_policy::reference_internal)

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

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] onnxruntime/python/onnxruntime_pybind_state.cc#L2114

Lines should be <= 120 characters long [whitespace/line_length] [2]
Raw output
onnxruntime/python/onnxruntime_pybind_state.cc:2114:  Lines should be <= 120 characters long  [whitespace/line_length] [2]

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

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] onnxruntime/python/onnxruntime_pybind_state.cc#L2114

Add #include <string> for string [build/include_what_you_use] [4]
Raw output
onnxruntime/python/onnxruntime_pybind_state.cc:2114:  Add #include <string> for string  [build/include_what_you_use] [4]
.def(
"get_provider_options", [](const PyInferenceSession* sess) -> const ProviderOptionsMap& { return sess->GetSessionHandle()->GetAllProviderOptions(); }, py::return_value_policy::reference_internal)

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

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] onnxruntime/python/onnxruntime_pybind_state.cc#L2116

Lines should be <= 120 characters long [whitespace/line_length] [2]
Raw output
onnxruntime/python/onnxruntime_pybind_state.cc:2116:  Lines should be <= 120 characters long  [whitespace/line_length] [2]
.def_property_readonly(
"session_options", [](const PyInferenceSession* sess) -> PySessionOptions* {
auto session_options = std::make_unique<PySessionOptions>();
session_options->value = sess->GetSessionHandle()->GetSessionOptions();
return session_options.release(); }, py::return_value_policy::take_ownership)
.def_property_readonly("inputs_meta", [](const PyInferenceSession* sess) -> const std::vector<const onnxruntime::NodeArg*>& {
.def_property_readonly(
"inputs_meta", [](const PyInferenceSession* sess) -> const std::vector<const onnxruntime::NodeArg*>& {
auto res = sess->GetSessionHandle()->GetModelInputs();
OrtPybindThrowIfError(res.first);
return *(res.second); }, py::return_value_policy::reference_internal)
.def_property_readonly("outputs_meta", [](const PyInferenceSession* sess) -> const std::vector<const onnxruntime::NodeArg*>& {
.def_property_readonly(
"outputs_meta", [](const PyInferenceSession* sess) -> const std::vector<const onnxruntime::NodeArg*>& {
auto res = sess->GetSessionHandle()->GetModelOutputs();
OrtPybindThrowIfError(res.first);
return *(res.second); }, py::return_value_policy::reference_internal)
.def_property_readonly("overridable_initializers", [](const PyInferenceSession* sess) -> const std::vector<const onnxruntime::NodeArg*>& {
.def_property_readonly(
"overridable_initializers", [](const PyInferenceSession* sess) -> const std::vector<const onnxruntime::NodeArg*>& {

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

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] onnxruntime/python/onnxruntime_pybind_state.cc#L2133

Lines should be <= 120 characters long [whitespace/line_length] [2]
Raw output
onnxruntime/python/onnxruntime_pybind_state.cc:2133:  Lines should be <= 120 characters long  [whitespace/line_length] [2]
auto res = sess->GetSessionHandle()->GetOverridableInitializers();
OrtPybindThrowIfError(res.first);
return *(res.second); }, py::return_value_policy::reference_internal)
.def_property_readonly("model_meta", [](const PyInferenceSession* sess) -> const onnxruntime::ModelMetadata& {
.def_property_readonly(
"model_meta", [](const PyInferenceSession* sess) -> const onnxruntime::ModelMetadata& {
auto res = sess->GetSessionHandle()->GetModelMetadata();
OrtPybindThrowIfError(res.first);
return *(res.second); }, py::return_value_policy::reference_internal)
Expand Down Expand Up @@ -2154,8 +2163,8 @@ including arg name, arg type (contains both type and shape).)pbdoc")

return ret;
#else
ORT_UNUSED_PARAMETER(sess);
ORT_THROW("TunableOp and get_tuning_results are not supported in this build.");
ORT_UNUSED_PARAMETER(sess);
ORT_THROW("TunableOp and get_tuning_results are not supported in this build.");
#endif
})
.def("set_tuning_results", [](PyInferenceSession* sess, py::list results, bool error_on_invalid) -> void {
Expand Down Expand Up @@ -2186,10 +2195,10 @@ including arg name, arg type (contains both type and shape).)pbdoc")
throw std::runtime_error("Error in execution: " + status.ErrorMessage());
}
#else
ORT_UNUSED_PARAMETER(sess);
ORT_UNUSED_PARAMETER(results);
ORT_UNUSED_PARAMETER(error_on_invalid);
ORT_THROW("TunableOp and set_tuning_results are not supported in this build.");
ORT_UNUSED_PARAMETER(sess);
ORT_UNUSED_PARAMETER(results);
ORT_UNUSED_PARAMETER(error_on_invalid);
ORT_THROW("TunableOp and set_tuning_results are not supported in this build.");
#endif
});

Expand Down

0 comments on commit a3cdc74

Please sign in to comment.