Skip to content

Commit b235265

Browse files
committed
Add legacy executor implementations for Interpolate node
1 parent 21aa19b commit b235265

14 files changed

+414
-5
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright (C) 2018-2025 Intel Corporation
2+
// SPDX-License-Identifier: Apache-2.0
3+
//
4+
5+
#include "nodes/executors/acl/acl_interpolate_legacy.hpp"
6+
7+
#include "nodes/interpolate.h"
8+
9+
namespace ov::intel_cpu {
10+
11+
bool InterpolateLegacyAclExecutor::update([[maybe_unused]] const MemoryArgs& memory) {
12+
OPENVINO_ASSERT(m_node, "InterpolateLegacyAclExecutor received null node");
13+
if (!m_node->shapesDefined()) {
14+
return true;
15+
}
16+
m_implType = m_node->prepareForLegacyExecutor();
17+
return (m_implType & impl_desc_type::acl) == impl_desc_type::acl;
18+
}
19+
20+
void InterpolateLegacyAclExecutor::execute([[maybe_unused]] const MemoryArgs& memory) {
21+
OPENVINO_ASSERT(m_node, "InterpolateLegacyAclExecutor received null node");
22+
m_node->executeLegacy();
23+
}
24+
25+
} // namespace ov::intel_cpu
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright (C) 2018-2025 Intel Corporation
2+
// SPDX-License-Identifier: Apache-2.0
3+
//
4+
5+
#pragma once
6+
7+
#include "nodes/executors/executor.hpp"
8+
9+
namespace ov::intel_cpu {
10+
11+
namespace node {
12+
class Interpolate;
13+
}
14+
15+
class InterpolateLegacyAclExecutor : public Executor {
16+
public:
17+
InterpolateLegacyAclExecutor(node::Interpolate* node, ExecutorContext::CPtr context)
18+
: m_node(node), m_context(std::move(context)) {}
19+
20+
bool update(const MemoryArgs& memory) override;
21+
void execute(const MemoryArgs& memory) override;
22+
impl_desc_type implType() const override { return m_implType; }
23+
24+
private:
25+
node::Interpolate* m_node = nullptr;
26+
ExecutorContext::CPtr m_context;
27+
impl_desc_type m_implType = impl_desc_type::undef;
28+
};
29+
30+
} // namespace ov::intel_cpu
31+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright (C) 2018-2025 Intel Corporation
2+
// SPDX-License-Identifier: Apache-2.0
3+
//
4+
5+
#include "nodes/executors/common/ref_interpolate_legacy.hpp"
6+
7+
#include "nodes/interpolate.h"
8+
9+
namespace ov::intel_cpu {
10+
11+
bool InterpolateLegacyCommonExecutor::update([[maybe_unused]] const MemoryArgs& memory) {
12+
OPENVINO_ASSERT(m_node, "InterpolateLegacyCommonExecutor received null node");
13+
if (!m_node->shapesDefined()) {
14+
return true;
15+
}
16+
m_implType = m_node->prepareForLegacyExecutor();
17+
const bool isRef = (m_implType & impl_desc_type::ref) == impl_desc_type::ref;
18+
const bool isJit = (m_implType & impl_desc_type::jit) == impl_desc_type::jit;
19+
const bool isAcl = (m_implType & impl_desc_type::acl) == impl_desc_type::acl;
20+
return isRef && !isJit && !isAcl;
21+
}
22+
23+
void InterpolateLegacyCommonExecutor::execute([[maybe_unused]] const MemoryArgs& memory) {
24+
OPENVINO_ASSERT(m_node, "InterpolateLegacyCommonExecutor received null node");
25+
m_node->executeLegacy();
26+
}
27+
28+
} // namespace ov::intel_cpu
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright (C) 2018-2025 Intel Corporation
2+
// SPDX-License-Identifier: Apache-2.0
3+
//
4+
5+
#pragma once
6+
7+
#include "nodes/executors/executor.hpp"
8+
9+
namespace ov::intel_cpu {
10+
11+
namespace node {
12+
class Interpolate;
13+
}
14+
15+
class InterpolateLegacyCommonExecutor : public Executor {
16+
public:
17+
InterpolateLegacyCommonExecutor(node::Interpolate* node, ExecutorContext::CPtr context)
18+
: m_node(node), m_context(std::move(context)) {}
19+
20+
bool update(const MemoryArgs& memory) override;
21+
void execute(const MemoryArgs& memory) override;
22+
impl_desc_type implType() const override { return m_implType; }
23+
24+
private:
25+
node::Interpolate* m_node = nullptr;
26+
ExecutorContext::CPtr m_context;
27+
impl_desc_type m_implType = impl_desc_type::undef;
28+
};
29+
30+
} // namespace ov::intel_cpu
31+

src/plugins/intel_cpu/src/nodes/executors/executor.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ enum class ExecutorType : uint8_t {
4242
Kleidiai,
4343
};
4444

45-
enum class OperationType : uint8_t { FullyConnected, MatMul, Convolution, Eltwise };
45+
enum class OperationType : uint8_t { FullyConnected, MatMul, Convolution, Eltwise, Interpolate };
4646

4747
std::string ExecutorTypeToString(ExecutorType type);
4848
ExecutorType ExecutorTypeFromString(const std::string& typeStr);

src/plugins/intel_cpu/src/nodes/executors/implementations.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "nodes/executors/eltwise_config.hpp"
1212
#include "nodes/executors/executor_implementation.hpp"
1313
#include "nodes/executors/fullyconnected_config.hpp"
14+
#include "nodes/executors/interpolate.hpp"
1415
#include "nodes/executors/matmul_config.hpp"
1516

1617
namespace ov::intel_cpu {
@@ -41,4 +42,8 @@ const std::vector<ExecutorImplementation<EltwiseAttrs>>& getImplementations();
4142
template <>
4243
const std::vector<ExecutorImplementation<MatMulAttrs>>& getImplementations();
4344

45+
// Interpolate
46+
template <>
47+
const std::vector<ExecutorImplementation<InterpolateAttrs>>& getImplementations();
48+
4449
} // namespace ov::intel_cpu

src/plugins/intel_cpu/src/nodes/executors/interpolate.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ static constexpr int MAX_INPUT_INTERPOLATE = 8;
2525

2626
namespace ov::intel_cpu {
2727

28+
namespace node {
29+
class Interpolate;
30+
} // namespace node
31+
2832
enum InterpolateLayoutType : uint8_t { planar, block, by_channel };
2933

3034
enum InterpolateMode : uint8_t { nearest, linear, linear_onnx, cubic, bilinear_pillow, bicubic_pillow };
@@ -63,6 +67,7 @@ struct InterpolateAttrs {
6367
// 2. axis alignment [1,2] to [2,3].
6468
// 3. config planar layout support and treated it as channel_first layout.
6569
bool NCHWAsNHWC = false;
70+
node::Interpolate* node = nullptr;
6671
};
6772

6873
inline VectorDims getPaddedInputShape(const VectorDims& srcDims,
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Copyright (C) 2018-2025 Intel Corporation
2+
// SPDX-License-Identifier: Apache-2.0
3+
//
4+
5+
#include <memory>
6+
7+
#include "nodes/executors/implementation_utils.hpp"
8+
#include "nodes/executors/implementations.hpp"
9+
#include "nodes/executors/interpolate.hpp"
10+
#include "nodes/executors/acl/acl_interpolate_legacy.hpp"
11+
#include "nodes/executors/common/ref_interpolate_legacy.hpp"
12+
#include "nodes/executors/x64/jit_interpolate_legacy.hpp"
13+
#include "nodes/interpolate.h"
14+
#include "openvino/core/except.hpp"
15+
16+
namespace ov::intel_cpu {
17+
18+
template <>
19+
const std::vector<ExecutorImplementation<InterpolateAttrs>>& getImplementations() {
20+
static const std::vector<ExecutorImplementation<InterpolateAttrs>> interpolateImplementations{
21+
// Prefer ACL if available
22+
ExecutorImplementation<InterpolateAttrs>{
23+
"interpolate_legacy_acl",
24+
ExecutorType::Acl,
25+
OperationType::Interpolate,
26+
SupportsAnyConfig<InterpolateAttrs>{},
27+
HasNoOptimalConfig<InterpolateAttrs>{},
28+
AcceptsAnyShape<InterpolateAttrs>,
29+
[](const InterpolateAttrs& attrs,
30+
[[maybe_unused]] const MemoryArgs& memory,
31+
const ExecutorContext::CPtr& context) -> ExecutorPtr {
32+
OPENVINO_ASSERT(attrs.node, "Interpolate legacy ACL executor requires node");
33+
return std::make_shared<InterpolateLegacyAclExecutor>(attrs.node, context);
34+
}},
35+
// JIT path
36+
ExecutorImplementation<InterpolateAttrs>{
37+
"interpolate_legacy_jit",
38+
ExecutorType::Jit,
39+
OperationType::Interpolate,
40+
SupportsAnyConfig<InterpolateAttrs>{},
41+
HasNoOptimalConfig<InterpolateAttrs>{},
42+
AcceptsAnyShape<InterpolateAttrs>,
43+
[](const InterpolateAttrs& attrs,
44+
[[maybe_unused]] const MemoryArgs& memory,
45+
const ExecutorContext::CPtr& context) -> ExecutorPtr {
46+
OPENVINO_ASSERT(attrs.node, "Interpolate legacy JIT executor requires node");
47+
return std::make_shared<InterpolateLegacyJitExecutor>(attrs.node, context);
48+
}},
49+
// Common (reference) path
50+
ExecutorImplementation<InterpolateAttrs>{
51+
"interpolate_legacy_common",
52+
ExecutorType::Common,
53+
OperationType::Interpolate,
54+
SupportsAnyConfig<InterpolateAttrs>{},
55+
HasNoOptimalConfig<InterpolateAttrs>{},
56+
AcceptsAnyShape<InterpolateAttrs>,
57+
[](const InterpolateAttrs& attrs,
58+
[[maybe_unused]] const MemoryArgs& memory,
59+
const ExecutorContext::CPtr& context) -> ExecutorPtr {
60+
OPENVINO_ASSERT(attrs.node, "Interpolate legacy common executor requires node");
61+
return std::make_shared<InterpolateLegacyCommonExecutor>(attrs.node, context);
62+
}}};
63+
64+
return interpolateImplementations;
65+
}
66+
67+
} // namespace ov::intel_cpu
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright (C) 2018-2025 Intel Corporation
2+
// SPDX-License-Identifier: Apache-2.0
3+
//
4+
5+
#include "interpolate_legacy.hpp"
6+
7+
#include "nodes/interpolate.h"
8+
9+
namespace ov::intel_cpu {
10+
11+
InterpolateLegacyExecutor::InterpolateLegacyExecutor(node::Interpolate* node,
12+
[[maybe_unused]] ExecutorContext::CPtr context)
13+
: m_node(node) {}
14+
15+
bool InterpolateLegacyExecutor::update([[maybe_unused]] const MemoryArgs& memory) {
16+
OPENVINO_ASSERT(m_node, "InterpolateLegacyExecutor received null node");
17+
if (!m_node->shapesDefined()) {
18+
return true;
19+
}
20+
m_implType = m_node->prepareForLegacyExecutor();
21+
return true;
22+
}
23+
24+
void InterpolateLegacyExecutor::execute([[maybe_unused]] const MemoryArgs& memory) {
25+
OPENVINO_ASSERT(m_node, "InterpolateLegacyExecutor received null node");
26+
m_node->executeLegacy();
27+
}
28+
29+
impl_desc_type InterpolateLegacyExecutor::implType() const {
30+
return m_implType;
31+
}
32+
33+
// Specialized adapters are implemented in dedicated files.
34+
35+
} // namespace ov::intel_cpu
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (C) 2018-2025 Intel Corporation
2+
// SPDX-License-Identifier: Apache-2.0
3+
//
4+
5+
#pragma once
6+
7+
#include "nodes/executors/executor.hpp"
8+
9+
namespace ov::intel_cpu {
10+
11+
namespace node {
12+
class Interpolate;
13+
}
14+
15+
class InterpolateLegacyExecutor : public Executor {
16+
public:
17+
InterpolateLegacyExecutor(node::Interpolate* node, ExecutorContext::CPtr context);
18+
19+
bool update(const MemoryArgs& memory) override;
20+
void execute(const MemoryArgs& memory) override;
21+
impl_desc_type implType() const override;
22+
23+
private:
24+
node::Interpolate* m_node = nullptr;
25+
impl_desc_type m_implType = impl_desc_type::undef;
26+
};
27+
28+
// Specialized legacy adapters (jit/acl/common) are defined in separate files.
29+
30+
} // namespace ov::intel_cpu

0 commit comments

Comments
 (0)