Skip to content

Commit

Permalink
Removed API 1.0 from NVIDIA plugin (openvinotoolkit#835)
Browse files Browse the repository at this point in the history
* Removed API 1.0 from NVIDIA plugin

* Fixed chacing tests
  • Loading branch information
ilya-lavrenov authored Jan 18, 2024
1 parent 1c448b2 commit a16af94
Show file tree
Hide file tree
Showing 27 changed files with 23 additions and 156 deletions.
65 changes: 0 additions & 65 deletions modules/nvidia_plugin/include/nvidia/nvidia_config.hpp

This file was deleted.

2 changes: 0 additions & 2 deletions modules/nvidia_plugin/src/cancellation_token.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

#pragma once

#include <ie_extension.h>

#include <atomic>
#include <error.hpp>
#include <functional>
Expand Down
1 change: 0 additions & 1 deletion modules/nvidia_plugin/src/cuda/blas.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#pragma once

#include <cublas_v2.h>
#include <ie_extension.h>

#include "runtime.hpp"

Expand Down
1 change: 0 additions & 1 deletion modules/nvidia_plugin/src/cuda_compiled_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "memory_manager/cuda_immutable_memory_block_builder.hpp"
#include "memory_manager/cuda_memory_manager.hpp"
#include "memory_manager/model/cuda_memory_model_builder.hpp"
#include "nvidia/nvidia_config.hpp"
#include "nvidia/properties.hpp"
#include "openvino/runtime/exec_model_info.hpp"
#include "openvino/runtime/internal_properties.hpp"
Expand Down
2 changes: 1 addition & 1 deletion modules/nvidia_plugin/src/cuda_compiled_model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CompiledModel : public ov::ICompiledModel {
const Configuration& cfg,
const std::shared_ptr<ov::threading::ITaskExecutor>& wait_executor,
const std::shared_ptr<const ov::IPlugin>& plugin,
bool loaded_from_cache = false);
bool loaded_from_cache);

~CompiledModel();

Expand Down
20 changes: 1 addition & 19 deletions modules/nvidia_plugin/src/cuda_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
//

#include "cuda_config.hpp"
#include "openvino/runtime/internal_properties.hpp"

#include <fmt/format.h>

#include <cpp_interfaces/interface/ie_internal_plugin_config.hpp>
#include <error.hpp>
#include <regex>

Expand Down Expand Up @@ -154,19 +154,6 @@ Configuration::Configuration(const ov::AnyMap& config, const Configuration& defa

if (ov::num_streams == key) {
num_streams = value.as<ov::streams::Num>();
} if (NVIDIA_CONFIG_KEY(THROUGHPUT_STREAMS) == key) {
if (value != NVIDIA_CONFIG_VALUE(THROUGHPUT_AUTO)) {
try {
num_streams = value.as<ov::streams::Num>();
} catch (...) {
throw_ov_exception(
fmt::format("NVIDIA_CONFIG_KEY(THROUGHPUT_STREAMS) = {} "
"is not a number !!",
value.as<std::string>()));
}
} else {
num_streams = ov::streams::AUTO;
}
} else if (ov::device::id == key) {
// Device id is updated already
continue;
Expand Down Expand Up @@ -215,11 +202,6 @@ ov::Any Configuration::get(const std::string& name) const {
} else if (name == ov::num_streams) {
return (num_streams == 0) ?
ov::streams::Num(get_optimal_number_of_streams()) : num_streams;
} else if (name == NVIDIA_CONFIG_KEY(THROUGHPUT_STREAMS)) {
auto value = (num_streams == 0) ?
ov::streams::Num(get_optimal_number_of_streams()) : num_streams;
return (value == ov::streams::AUTO) ? NVIDIA_CONFIG_VALUE(THROUGHPUT_AUTO)
: ov::util::to_string(value);
} else if (name == ov::hint::num_requests) {
return hint_num_requests;
} else if (name == ov::hint::inference_precision) {
Expand Down
1 change: 0 additions & 1 deletion modules/nvidia_plugin/src/cuda_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <memory>
#include <string>

#include "nvidia/nvidia_config.hpp"
#include "openvino/runtime/properties.hpp"
#include "openvino/runtime/threading/istreams_executor.hpp"

Expand Down
1 change: 0 additions & 1 deletion modules/nvidia_plugin/src/cuda_infer_request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <fmt/format.h>

#include <algorithm>
#include <description_buffer.hpp>
#include <gsl/span_ext>
#include <map>
#include <memory>
Expand Down
6 changes: 4 additions & 2 deletions modules/nvidia_plugin/src/cuda_operation_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include <utility>

#include "cuda_operation_base.hpp"
#include "openvino/core/node.hpp"

namespace ov {
namespace nvidia_gpu {

Expand All @@ -14,8 +16,8 @@ OperationBase::OperationBase(const CreationContext& /*context*/,
IndexCollection&& outputIds)
: node_name_{node.get_friendly_name()},
type_name_{node.get_type_info().name},
input_ids_{move(inputIds)},
output_ids_{move(outputIds)} {
input_ids_{inputIds},
output_ids_{outputIds} {
if (node.get_input_size() > 0) {
runtime_precision_ = node.get_input_element_type(0);
} else if (node.get_output_size() > 0) {
Expand Down
2 changes: 0 additions & 2 deletions modules/nvidia_plugin/src/cuda_operation_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

#pragma once

#include <ie_layouts.h>

#include <cuda/device_pointers.hpp>
#include <cuda_creation_context.hpp>
#include <cuda_inference_request_context.hpp>
Expand Down
1 change: 1 addition & 0 deletions modules/nvidia_plugin/src/cuda_operation_registry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <unordered_map>

#include "cuda_operation_base.hpp"
#include "openvino/core/node.hpp"

namespace ov {
namespace nvidia_gpu {
Expand Down
25 changes: 15 additions & 10 deletions modules/nvidia_plugin/src/cuda_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@
//
#include <fmt/format.h>

#include "ie_metric_helpers.hpp"

#include "cpp_interfaces/interface/ie_internal_plugin_config.hpp"
#include "cuda/props.hpp"
#include "cuda_compiled_model.hpp"
#include "cuda_infer_request.hpp"
#include "cuda_itt.hpp"
#include "cuda_operation_registry.hpp"
#include "cuda_plugin.hpp"
#include "nvidia/nvidia_config.hpp"
#include "openvino/core/op_extension.hpp"
#include "openvino/op/util/op_types.hpp"
#include "openvino/runtime/internal_properties.hpp"
#include "openvino/runtime/core.hpp"
#include "openvino/runtime/properties.hpp"
#include "openvino/runtime/threading/executor_manager.hpp"
Expand Down Expand Up @@ -74,7 +71,8 @@ std::shared_ptr<ov::ICompiledModel> Plugin::compile_model(const std::shared_ptr<
auto compiled_model = std::make_shared<CompiledModel>(model->clone(),
full_config,
wait_executor,
shared_from_this());
shared_from_this(),
false);
return compiled_model;
}

Expand Down Expand Up @@ -105,13 +103,22 @@ std::shared_ptr<ov::ICompiledModel> Plugin::import_model(std::istream& model_str

auto model = get_core()->read_model(xml_string, weights);

auto full_config = get_full_config(properties);
// check ov::loaded_from_cache property and erase it due to not needed any more.
auto _properties = properties;
const auto& it = _properties.find(ov::loaded_from_cache.name());
bool loaded_from_cache = false;
if (it != _properties.end()) {
loaded_from_cache = it->second.as<bool>();
_properties.erase(it);
}

auto full_config = get_full_config(_properties);
auto wait_executor = get_stream_executor(full_config);
auto compiled_model= std::make_shared<CompiledModel>(model,
full_config,
wait_executor,
shared_from_this(),
true);
loaded_from_cache);
return compiled_model;
}

Expand Down Expand Up @@ -193,8 +200,6 @@ void Plugin::set_property(const ov::AnyMap& properties) {
}

ov::Any Plugin::get_property(const std::string& name, const ov::AnyMap& properties) const {
using namespace InferenceEngine::CUDAMetrics;

auto full_config = get_full_config(properties);

if (ov::supported_properties == name) {
Expand Down Expand Up @@ -233,7 +238,7 @@ ov::Any Plugin::get_property(const std::string& name, const ov::AnyMap& properti
ov::device::capability::EXPORT_IMPORT,
ov::device::capability::FP32,
ov::device::capability::FP16}};
} else if (ov::range_for_streams == name) {
} else if (ov::range_for_streams == name) {
return decltype(ov::range_for_streams)::value_type{1, Configuration::reasonable_limit_of_streams};
} else if (ov::range_for_async_infer_requests == name) {
return decltype(ov::range_for_async_infer_requests)::value_type{1, 1, 1};
Expand Down
2 changes: 0 additions & 2 deletions modules/nvidia_plugin/src/cuda_thread_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

#include <fmt/format.h>

#include <details/ie_exception.hpp>

#include "cuda_latch.hpp"

namespace ov {
Expand Down
1 change: 0 additions & 1 deletion modules/nvidia_plugin/src/kernels/details/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include <fmt/format.h>

#include <details/ie_exception.hpp>
#include <error.hpp>
#include <exception>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <cuda_runtime_api.h>

#include <cuda/runtime.hpp>
#include <details/ie_exception.hpp>
#include <iostream>

namespace ov {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#include <cuda_config.hpp>
#include <openvino/core/except.hpp>
#include <nvidia/nvidia_config.hpp>
#include <ops/converters.hpp>

namespace ov::nvidia_gpu::Convolution::Details {
Expand Down
1 change: 0 additions & 1 deletion modules/nvidia_plugin/src/ops/convolution_cudnn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include <cudnn.h>

#include <details/ie_exception.hpp>
#include <openvino/core/except.hpp>

#include "cuda/constant_factory.hpp"
Expand Down
1 change: 0 additions & 1 deletion modules/nvidia_plugin/src/ops/convolution_cudnn_be.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <fmt/format.h>

#include <algorithm>
#include <details/ie_exception.hpp>
#include <openvino/core/except.hpp>
#include <ops/converters.hpp>

Expand Down
10 changes: 0 additions & 10 deletions modules/nvidia_plugin/src/ops/details/cuda_ie_api_import_fix.hpp

This file was deleted.

10 changes: 0 additions & 10 deletions modules/nvidia_plugin/src/ops/details/cuda_ngraph_import_fix.hpp

This file was deleted.

1 change: 0 additions & 1 deletion modules/nvidia_plugin/src/ops/fused_convolution_cudnn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include <cudnn.h>

#include <details/ie_exception.hpp>
#include <openvino/core/except.hpp>
#include <ops/converters.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include <algorithm>
#include <cuda/constant_factory.hpp>
#include <details/ie_exception.hpp>
#include <openvino/core/except.hpp>
#include <ops/converters.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include <cudnn.h>

#include <details/ie_exception.hpp>
#include <openvino/core/except.hpp>
#include <ops/converters.hpp>

Expand Down
1 change: 1 addition & 0 deletions modules/nvidia_plugin/src/ops/logical_not.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "logical_not.hpp"
#include "openvino/core/except.hpp"

#include <cuda_operation_registry.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include <cuda/runtime.hpp>

#include "cpp/ie_cnn_network.h"
#include "cuda_config.hpp"
#include "openvino/core/model.hpp"

Expand Down
Loading

0 comments on commit a16af94

Please sign in to comment.