diff --git a/onnxruntime/core/framework/fallback_cpu_capability.cc b/onnxruntime/core/framework/fallback_cpu_capability.cc index f12598cd58..46b825a149 100644 --- a/onnxruntime/core/framework/fallback_cpu_capability.cc +++ b/onnxruntime/core/framework/fallback_cpu_capability.cc @@ -38,12 +38,12 @@ static bool IsSmallInitializer(const onnxruntime::GraphViewer& graph, const Node } } // namespace -InlinedHashSet GetCpuPreferredNodes(const onnxruntime::GraphViewer& graph, - const std::string& provider_type, - gsl::span kernel_registries, - gsl::span tentative_nodes) { +std::unordered_set GetCpuPreferredNodes(const onnxruntime::GraphViewer& graph, + const std::string& provider_type, + gsl::span kernel_registries, + gsl::span tentative_nodes) { // automatic conversion from const std::vector& - gsl::span ordered_nodes = graph.GetNodesInTopologicalOrder(); + const auto& ordered_nodes = graph.GetNodesInTopologicalOrder(); InlinedVector node_id_to_order_map(graph.MaxNodeIndex()); for (size_t id = 0, limit = ordered_nodes.size(); id < limit; ++id) { const NodeIndex& node_id = ordered_nodes[id]; @@ -55,7 +55,7 @@ InlinedHashSet GetCpuPreferredNodes(const onnxruntime::GraphViewer& g return node_id_to_order_map[n1] > node_id_to_order_map[n2]; }; - std::priority_queue, decltype(greater_order_comp)> candidates(greater_order_comp); + std::priority_queue, decltype(greater_order_comp)> candidates(greater_order_comp); InlinedHashSet cpu_output_args; @@ -95,10 +95,10 @@ InlinedHashSet GetCpuPreferredNodes(const onnxruntime::GraphViewer& g })); } - gsl::span graph_inputs = graph.GetInputs(); + const auto& graph_inputs = graph.GetInputs(); InlinedHashSet visited; visited.reserve(candidates.size()); - InlinedHashSet cpu_nodes; + std::unordered_set cpu_nodes; cpu_nodes.reserve(candidates.size()); // The algo below is trying to identity a subgraph that only depends on cpu tensors. // Usually it is a subgraph that doing shape calculation based on a GPU tensor, then reshape it back. diff --git a/onnxruntime/core/framework/fallback_cpu_capability.h b/onnxruntime/core/framework/fallback_cpu_capability.h index fda5fdb188..531c1c0746 100644 --- a/onnxruntime/core/framework/fallback_cpu_capability.h +++ b/onnxruntime/core/framework/fallback_cpu_capability.h @@ -18,9 +18,9 @@ namespace onnxruntime { @param kernel_registries Kernel registries for the target EP @param tentative_nodes Nodes that are tentative to be placed on on target EP */ -InlinedHashSet GetCpuPreferredNodes(const GraphViewer& graph, - const std::string& provider_type, - gsl::span kernel_registries, - gsl::span tentative_nodes); + std::unordered_set GetCpuPreferredNodes(const GraphViewer& graph, + const std::string& provider_type, + gsl::span kernel_registries, + gsl::span tentative_nodes); } // namespace onnxruntime diff --git a/onnxruntime/core/providers/shared_library/provider_api.h b/onnxruntime/core/providers/shared_library/provider_api.h index 9688559795..efc55f600a 100644 --- a/onnxruntime/core/providers/shared_library/provider_api.h +++ b/onnxruntime/core/providers/shared_library/provider_api.h @@ -251,10 +251,10 @@ std::unique_ptr CreateROCMPinnedAllocator(int16_t device_id, const c std::unique_ptr CreateGPUDataTransfer(void* stream); -InlinedHashSet GetCpuPreferredNodes(const onnxruntime::GraphViewer& graph, - const std::string& provider_type, - gsl::span kernel_registries, - gsl::span tentative_nodes); +std::unordered_set GetCpuPreferredNodes(const onnxruntime::GraphViewer& graph, + const std::string& provider_type, + gsl::span kernel_registries, + gsl::span tentative_nodes); std::string GetEnvironmentVar(const std::string& var_name); diff --git a/onnxruntime/core/providers/shared_library/provider_bridge_provider.cc b/onnxruntime/core/providers/shared_library/provider_bridge_provider.cc index eb6ebb390a..ccbcd47cd1 100644 --- a/onnxruntime/core/providers/shared_library/provider_bridge_provider.cc +++ b/onnxruntime/core/providers/shared_library/provider_bridge_provider.cc @@ -347,10 +347,10 @@ std::string GetEnvironmentVar(const std::string& var_name) { return g_host->GetEnvironmentVar(var_name); } -InlinedHashSet GetCpuPreferredNodes(const onnxruntime::GraphViewer& graph, - const std::string& provider_type, - gsl::span kernel_registries, - gsl::span tentative_nodes) { +std::unordered_set GetCpuPreferredNodes(const onnxruntime::GraphViewer& graph, + const std::string& provider_type, + gsl::span kernel_registries, + gsl::span tentative_nodes) { return g_host->GetCpuPreferredNodes(graph, provider_type, kernel_registries, tentative_nodes); } diff --git a/onnxruntime/core/providers/shared_library/provider_interfaces.h b/onnxruntime/core/providers/shared_library/provider_interfaces.h index 72dc98ef53..a9f85fe2b5 100644 --- a/onnxruntime/core/providers/shared_library/provider_interfaces.h +++ b/onnxruntime/core/providers/shared_library/provider_interfaces.h @@ -173,10 +173,10 @@ struct ProviderHost { virtual bool RocmCall_true(int retCode, const char* exprString, const char* libName, int successCode, const char* msg) = 0; #endif - virtual InlinedHashSet GetCpuPreferredNodes(const onnxruntime::GraphViewer& graph, - const std::string& provider_type, - gsl::span kernel_registries, - gsl::span tentative_nodes) = 0; + virtual std::unordered_set GetCpuPreferredNodes(const onnxruntime::GraphViewer& graph, + const std::string& provider_type, + gsl::span kernel_registries, + gsl::span tentative_nodes) = 0; virtual Status UnpackTensor(const ONNX_NAMESPACE::TensorProto& tensor, const void* raw_data, size_t raw_data_len, /*out*/ bool* p_data, size_t expected_size) = 0; virtual Status UnpackTensor(const ONNX_NAMESPACE::TensorProto& tensor, const void* raw_data, size_t raw_data_len, /*out*/ float* p_data, size_t expected_size) = 0; diff --git a/onnxruntime/core/session/provider_bridge_ort.cc b/onnxruntime/core/session/provider_bridge_ort.cc index f55b56209d..c730472f31 100644 --- a/onnxruntime/core/session/provider_bridge_ort.cc +++ b/onnxruntime/core/session/provider_bridge_ort.cc @@ -207,10 +207,10 @@ struct ProviderHostImpl : ProviderHost { std::string GetEnvironmentVar(const std::string& var_name) override { return Env::Default().GetEnvironmentVar(var_name); } - InlinedHashSet GetCpuPreferredNodes(const onnxruntime::GraphViewer& graph, - const std::string& provider_type, - gsl::span kernel_registries, - gsl::span tentative_nodes) override { + std::unordered_set GetCpuPreferredNodes(const onnxruntime::GraphViewer& graph, + const std::string& provider_type, + gsl::span kernel_registries, + gsl::span tentative_nodes) override { return onnxruntime::GetCpuPreferredNodes(graph, provider_type, kernel_registries, tentative_nodes); }