Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CPU][ARM] Fix indices in ACL Interpolate executor #25931

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a side note: do we really need to call InterpolateExecutor::init(aclInterpolateAttrs, srcDescs, dstDescs, attr); inside ACLInterpolateExecutor::init? Seems irrelevant to ACL executor

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems it's not needed, deleted

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brought this line back since InterpolateExecutor::init did some initialization that requires ACL executor.
Without this line some tests segfaults.

Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,6 @@
#include "acl_utils.hpp"
#include "utils/debug_capabilities.h"

static bool getIndices(const ov::intel_cpu::MemoryDescPtr &desc, int& index_h, int& index_w) {
if (desc->hasLayoutType(ov::intel_cpu::LayoutType::ncsp)) {
index_h = 2;
index_w = 3;
return true;
} else if (desc->hasLayoutType(ov::intel_cpu::LayoutType::nspc)) {
index_h = 1;
index_w = 2;
return true;
} else { return false; }
}

bool ov::intel_cpu::ACLInterpolateExecutor::init(const InterpolateAttrs &interpolateAttrs,
const std::vector <MemoryDescPtr> &srcDescs,
const std::vector <MemoryDescPtr> &dstDescs,
Expand All @@ -27,12 +15,8 @@ bool ov::intel_cpu::ACLInterpolateExecutor::init(const InterpolateAttrs &interpo
acl_coord = arm_compute::SamplingPolicy::TOP_LEFT;
auto& out_shape = dstDescs[0]->getShape().getDims();

int index_h, index_w;
if (!getIndices(dstDescs[0], index_h, index_w)) {
DEBUG_LOG("ACL Interpolate unsupported layout: ", dstDescs[0]->serializeFormat());
return false;
}

static const size_t index_h = 2;
static const size_t index_w = 3;
if ((aclInterpolateAttrs.coordTransMode == InterpolateCoordTransMode::pytorch_half_pixel && out_shape[index_h] > 1 && out_shape[index_w] > 1) ||
aclInterpolateAttrs.coordTransMode == InterpolateCoordTransMode::half_pixel) {
acl_coord = arm_compute::SamplingPolicy::CENTER;
Expand Down Expand Up @@ -115,9 +99,8 @@ bool ov::intel_cpu::ACLInterpolateExecutorBuilder::isSupportedConfiguration(
auto& inp_shape = srcDescs[0]->getShape().getDims();
auto& out_shape = dstDescs[0]->getShape().getDims();

int index_h, index_w;
if (!getIndices(srcDescs[0], index_h, index_w)) { return false; }

static const size_t index_h = 2;
static const size_t index_w = 3;
float scale_h = static_cast<float>(out_shape[index_h]) / inp_shape[index_h];
float scale_w = static_cast<float>(out_shape[index_w]) / inp_shape[index_w];
bool is_upsample = scale_h > 1 && scale_w > 1;
Expand Down
Loading