File tree Expand file tree Collapse file tree 6 files changed +20
-17
lines changed
src/plugins/intel_npu/src
common/include/intel_npu/common Expand file tree Collapse file tree 6 files changed +20
-17
lines changed Original file line number Diff line number Diff line change @@ -56,18 +56,15 @@ class IEngineBackend : public std::enable_shared_from_this<IEngineBackend> {
56
56
57
57
class ICompilerAdapter {
58
58
public:
59
- ICompilerAdapter (ov::intel_npu::CompilerType compilerType) : _compilerType(compilerType) {}
60
59
virtual std::shared_ptr<IGraph> compile (const std::shared_ptr<const ov::Model>& model,
61
60
const Config& config) const = 0;
62
61
virtual std::shared_ptr<IGraph> parse (std::vector<uint8_t > network, const Config& config) const = 0;
63
62
virtual std::shared_ptr<IGraph> parse (const std::shared_ptr<ov::AlignedBuffer>& mmapNetwork, const Config& config) const = 0;
64
63
virtual ov::SupportedOpsMap query (const std::shared_ptr<const ov::Model>& model, const Config& config) const = 0;
64
+ virtual ov::intel_npu::CompilerType getCompilerType () const = 0;
65
65
66
66
virtual ~ICompilerAdapter () = default ;
67
67
68
- ov::intel_npu::CompilerType getCompilerType () {
69
- return _compilerType;
70
- }
71
68
private:
72
69
ov::intel_npu::CompilerType _compilerType;
73
70
};
Original file line number Diff line number Diff line change @@ -22,16 +22,20 @@ namespace intel_npu {
22
22
23
23
class DriverCompilerAdapter final : public ICompilerAdapter {
24
24
public:
25
- DriverCompilerAdapter (const std::shared_ptr<ZeroInitStructsHolder>& zeroInitStruct, ov::intel_npu::CompilerType compilerType );
25
+ DriverCompilerAdapter (const std::shared_ptr<ZeroInitStructsHolder>& zeroInitStruct);
26
26
27
27
std::shared_ptr<IGraph> compile (const std::shared_ptr<const ov::Model>& model, const Config& config) const override ;
28
28
29
29
std::shared_ptr<IGraph> parse (std::vector<uint8_t > network, const Config& config) const override ;
30
30
31
- std::shared_ptr<IGraph> parse (const std::shared_ptr<ov::AlignedBuffer>& mmapNetwork, const Config& config) const ;
31
+ std::shared_ptr<IGraph> parse (const std::shared_ptr<ov::AlignedBuffer>& mmapNetwork, const Config& config) const override ;
32
32
33
33
ov::SupportedOpsMap query (const std::shared_ptr<const ov::Model>& model, const Config& config) const override ;
34
34
35
+ ov::intel_npu::CompilerType getCompilerType () const override {
36
+ return ov::intel_npu::CompilerType::DRIVER;
37
+ }
38
+
35
39
private:
36
40
/* *
37
41
* @brief Serialize input / output information to string format.
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ namespace intel_npu {
17
17
18
18
class PluginCompilerAdapter final : public ICompilerAdapter {
19
19
public:
20
- PluginCompilerAdapter (const std::shared_ptr<ZeroInitStructsHolder>& zeroInitStruct, ov::intel_npu::CompilerType compilerType );
20
+ PluginCompilerAdapter (const std::shared_ptr<ZeroInitStructsHolder>& zeroInitStruct);
21
21
22
22
std::shared_ptr<IGraph> compile (const std::shared_ptr<const ov::Model>& model, const Config& config) const override ;
23
23
@@ -29,6 +29,10 @@ class PluginCompilerAdapter final : public ICompilerAdapter {
29
29
30
30
ov::SupportedOpsMap query (const std::shared_ptr<const ov::Model>& model, const Config& config) const override ;
31
31
32
+ ov::intel_npu::CompilerType getCompilerType () const override {
33
+ return ov::intel_npu::CompilerType::MLIR;
34
+ }
35
+
32
36
private:
33
37
std::shared_ptr<ZeroInitStructsHolder> _zeroInitStruct;
34
38
Original file line number Diff line number Diff line change @@ -141,10 +141,9 @@ std::string rankToLegacyLayoutString(const size_t rank) {
141
141
142
142
namespace intel_npu {
143
143
144
- DriverCompilerAdapter::DriverCompilerAdapter (const std::shared_ptr<ZeroInitStructsHolder>& zeroInitStruct, ov::intel_npu::CompilerType compilerType )
144
+ DriverCompilerAdapter::DriverCompilerAdapter (const std::shared_ptr<ZeroInitStructsHolder>& zeroInitStruct)
145
145
: _zeroInitStruct(zeroInitStruct),
146
- _logger (" DriverCompilerAdapter" , Logger::global().level()),
147
- ICompilerAdapter(compilerType) {
146
+ _logger (" DriverCompilerAdapter" , Logger::global().level()) {
148
147
_logger.debug (" initialize DriverCompilerAdapter start" );
149
148
150
149
uint32_t graphExtVersion = _zeroInitStruct->getGraphDdiTable ().version ();
Original file line number Diff line number Diff line change @@ -52,10 +52,9 @@ ov::SoPtr<intel_npu::ICompiler> loadCompiler(const std::string& libpath) {
52
52
53
53
namespace intel_npu {
54
54
55
- PluginCompilerAdapter::PluginCompilerAdapter (const std::shared_ptr<ZeroInitStructsHolder>& zeroInitStruct, ov::intel_npu::CompilerType compilerType )
55
+ PluginCompilerAdapter::PluginCompilerAdapter (const std::shared_ptr<ZeroInitStructsHolder>& zeroInitStruct)
56
56
: _zeroInitStruct(zeroInitStruct),
57
- _logger (" PluginCompilerAdapter" , Logger::global().level()),
58
- ICompilerAdapter(compilerType) {
57
+ _logger (" PluginCompilerAdapter" , Logger::global().level()) {
59
58
_logger.debug (" initialize PluginCompilerAdapter start" );
60
59
61
60
_logger.info (" MLIR compiler will be used." );
Original file line number Diff line number Diff line change @@ -847,15 +847,15 @@ std::unique_ptr<ICompilerAdapter> Plugin::getCompiler(const Config& config) cons
847
847
switch (compilerType) {
848
848
case ov::intel_npu::CompilerType::MLIR: {
849
849
if (_backends->getBackendName () != " LEVEL0" ) {
850
- return std::make_unique<PluginCompilerAdapter>(nullptr , compilerType );
850
+ return std::make_unique<PluginCompilerAdapter>(nullptr );
851
851
}
852
852
853
853
auto zeroBackend = std::dynamic_pointer_cast<ZeroEngineBackend>(_backends->getIEngineBackend ()._ptr );
854
854
if (zeroBackend == nullptr ) {
855
- return std::make_unique<PluginCompilerAdapter>(nullptr , compilerType );
855
+ return std::make_unique<PluginCompilerAdapter>(nullptr );
856
856
}
857
857
858
- return std::make_unique<PluginCompilerAdapter>(zeroBackend->getInitStruct (), compilerType );
858
+ return std::make_unique<PluginCompilerAdapter>(zeroBackend->getInitStruct ());
859
859
}
860
860
case ov::intel_npu::CompilerType::DRIVER: {
861
861
if (_backends->getBackendName () != " LEVEL0" ) {
@@ -867,7 +867,7 @@ std::unique_ptr<ICompilerAdapter> Plugin::getCompiler(const Config& config) cons
867
867
OPENVINO_THROW (" Failed to cast zeroBackend, zeroBackend is a nullptr" );
868
868
}
869
869
870
- return std::make_unique<DriverCompilerAdapter>(zeroBackend->getInitStruct (), compilerType );
870
+ return std::make_unique<DriverCompilerAdapter>(zeroBackend->getInitStruct ());
871
871
}
872
872
default :
873
873
OPENVINO_THROW (" Invalid NPU_COMPILER_TYPE" );
You can’t perform that action at this time.
0 commit comments