Skip to content

Commit 8a5bbcd

Browse files
committed
Apply suggestions from code review
1 parent 700b5b1 commit 8a5bbcd

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/executor_pa.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,6 +1279,7 @@ struct MHAHelper {
12791279
for (size_t h = hq_beg; h < hq_end; h++) {
12801280
// apply attention mask & sofmax
12811281
float* score = _weight.ptr<float>(ithr, h - hq_beg, pq);
1282+
OPENVINO_DEBUG_ASSERT(score != nullptr, "PagedAttention: _weight buffer must be allocated");
12821283
float* alibi_lookup = nullptr;
12831284
float alibi_slope = 0.F;
12841285
if (alibi_slopes) {
@@ -1489,6 +1490,7 @@ struct MHAHelper {
14891490
auto ncausal = cur_kv_len;
14901491
// apply attention mask & sofmax
14911492
float* score = _weight_bhl.ptr<float>(b, h, pq);
1493+
OPENVINO_DEBUG_ASSERT(score != nullptr, "PagedAttention: _weight_bhl buffer must be allocated");
14921494
float* alibi_lookup = nullptr;
14931495
float alibi_slope = 0.F;
14941496
if (alibi_slopes) {

src/plugins/intel_cpu/src/nodes/paged_attn.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,13 @@ bool PagedAttention::isSupportedOperation(const std::shared_ptr<const ov::Node>&
313313
errorMessage = "Only Constant operation on sink input is supported";
314314
return false;
315315
}
316-
#if defined(OPENVINO_ARCH_ARM64)
317-
// ARM platform doesn't support non-empty sink input yet
318-
// Check if sink input is non-empty (shape size > 0)
316+
#ifndef OPENVINO_ARCH_X86_64
317+
// Non-x86_64 platforms do not support non-empty sink tensors yet
318+
// Fail fast if the sink input shape has any elements
319319
const auto& sink_shape = op->get_input_partial_shape(PagedAttentionExecutor::ID_SINKS);
320320
if (sink_shape.is_static() && ov::shape_size(sink_shape.to_shape()) > 0) {
321-
errorMessage = "PagedAttentionExtension with non-empty sink input is not supported on ARM platform";
321+
errorMessage =
322+
"PagedAttentionExtension with non-empty sink input is not supported on non-x86_64 platforms";
322323
return false;
323324
}
324325
#endif

src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/paged_attn.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
//
44

55
#include "common_test_utils/include/common_test_utils/ov_tensor_utils.hpp"
6+
#include "common_test_utils/node_builders/constant.hpp"
67
#include "internal_properties.hpp"
78
#include "openvino/core/type/float16.hpp"
89
#include "openvino/op/add.hpp"
@@ -143,14 +144,11 @@ class PagedAttnTestBase : public testing::WithParamInterface<PagedAttnTestParams
143144
// Use shape [1, head_num, 1, 1] when use_sink_input=true, or empty shape [0] when false
144145
std::shared_ptr<ov::op::v0::Constant> sinks;
145146
if (use_sink_input) {
146-
// Create real sink tokens for testing sink functionality
147-
std::vector<float> sink_data(static_cast<size_t>(head_num), 0.1f);
148-
sinks = std::make_shared<ov::op::v0::Constant>(data_type,
149-
Shape{1, static_cast<size_t>(head_num), 1, 1},
150-
sink_data);
147+
sinks = std::static_pointer_cast<ov::op::v0::Constant>(
148+
ov::test::utils::make_constant(data_type, Shape{1, static_cast<size_t>(head_num), 1, 1}));
151149
} else {
152150
// Create empty sink (matching SDPA->PA transformation behavior when no sink)
153-
sinks = std::make_shared<ov::op::v0::Constant>(data_type, Shape{0}, std::vector<float>{});
151+
sinks = std::static_pointer_cast<ov::op::v0::Constant>(ov::test::utils::make_constant(data_type, Shape{0}));
154152
}
155153

156154
ParameterVector params =

0 commit comments

Comments
 (0)