← Back to Pull requests

[Snippets][CPU][ARM] Unify reserved GPR handling in allocators #38277

Merged
aobolensk merged 3 files (59 lines) on Oct 16, 2026 14:24 UTC
View on GitHub
aobolensk aobolensk commented on Sep 20, 2026 16:55 UTC
Author

Details:


utils and cpu generators had different lists of reserved registers that pursue the same goal, unify them

Tickets:


- N/A

AI Assistance:


- AI assistance used: yes
- Implementation is assisted and after that manually tested and reviewed

Diff: 59 lines (+28 / -31) across 3 files Reviewer: v-Golubev Review duration: 37288m
All Vouch review confidence checks passed
Residual risk 0.04 = Change Risk (0.30) × (1 − Review Confidence (0.88)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.30 · 59 lines diff across 3 files
0.30
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.85 · 5 substantive comment(s)
0.85
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
88%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.245
Real PR Conversation Timeline
16 items
allnes allnes commented on Oct 05, 2026 18:35 UTC
Contributor

build_jenkins

allnes allnes commented on Oct 06, 2026 19:23 UTC
Contributor

build_jenkins

aobolensk aobolensk commented on Oct 10, 2026 19:17 UTC
Author

@v-Golubev please take a look

v-Golubev v-Golubev commented on code on Oct 12, 2026 10:33 UTC
Code Review
src/plugins/intel_cpu/src/emitters/snippets/aarch64/utils.cpp:1
@@ -197,40 +196,37 @@ void EmitABIRegSpills::postamble() {
 
 namespace utils {
 
-std::vector<Xbyak_aarch64::XReg> get_aux_gprs(const std::vector<size_t>& used_gpr_idxs, size_t count) {
-    // X0 and X1 - runtime parameter registers in the kernel
-    // X18 - platform register should not be used
-    // SP - stack pointer should be preserved
-    static const std::unordered_set<size_t> blacklist_gpr_idxs = {
-        0,   // abi_param1 (X0)
-        1,   // abi_param2 (X1)
-        18,  // Platform register (X18)
-        31,  // Stack pointer (SP)
-    };
-
-    OPENVINO_ASSERT(count <= 32 - blacklist_gpr_idxs.size(),
-                    "Cannot allocate more than ",
-                    32 - blacklist_gpr_idxs.size(),
-                    " auxiliary registers");
-
-    // Convert used_gpr_idxs to unordered_set for O(1) lookups
-    const std::unordered_set<size_t> used_set(used_gpr_idxs.begin(), used_gpr_idxs.end());
+bool is_reserved_gpr(size_t idx) {
+    using Xbyak_aarch64::Operand;
+    return ov::intel_cpu::any_of(idx,
+                                 Operand::X18,
+                                 Operand::X23,
+                                 Operand::X24,
+                                 Operand::X28,
+                                 Operand::X29,
+                                 Operand::SP);

blacklist_gpr_idxs contained X0 and X1, which are not represented here. Am I mistaken?

aobolensk aobolensk commented on code on Oct 12, 2026 18:47 UTC
Code Review
src/plugins/intel_cpu/src/emitters/snippets/aarch64/utils.cpp:1
@@ -197,40 +196,37 @@ void EmitABIRegSpills::postamble() {
 
 namespace utils {
 
-std::vector<Xbyak_aarch64::XReg> get_aux_gprs(const std::vector<size_t>& used_gpr_idxs, size_t count) {
-    // X0 and X1 - runtime parameter registers in the kernel
-    // X18 - platform register should not be used
-    // SP - stack pointer should be preserved
-    static const std::unordered_set<size_t> blacklist_gpr_idxs = {
-        0,   // abi_param1 (X0)
-        1,   // abi_param2 (X1)
-        18,  // Platform register (X18)
-        31,  // Stack pointer (SP)
-    };
-
-    OPENVINO_ASSERT(count <= 32 - blacklist_gpr_idxs.size(),
-                    "Cannot allocate more than ",
-                    32 - blacklist_gpr_idxs.size(),
-                    " auxiliary registers");
-
-    // Convert used_gpr_idxs to unordered_set for O(1) lookups
-    const std::unordered_set<size_t> used_set(used_gpr_idxs.begin(), used_gpr_idxs.end());
+bool is_reserved_gpr(size_t idx) {
+    using Xbyak_aarch64::Operand;
+    return ov::intel_cpu::any_of(idx,
+                                 Operand::X18,
+                                 Operand::X23,
+                                 Operand::X24,
+                                 Operand::X28,
+                                 Operand::X29,
+                                 Operand::SP);

They are abi_param1 and abi_param2 and they are skipped in get_aux_gprs()

aobolensk aobolensk commented on code on Oct 12, 2026 18:47 UTC
Code Review
src/plugins/intel_cpu/src/emitters/snippets/aarch64/utils.cpp:1
@@ -197,40 +196,37 @@ void EmitABIRegSpills::postamble() {
 
 namespace utils {
 
-std::vector<Xbyak_aarch64::XReg> get_aux_gprs(const std::vector<size_t>& used_gpr_idxs, size_t count) {
-    // X0 and X1 - runtime parameter registers in the kernel
-    // X18 - platform register should not be used
-    // SP - stack pointer should be preserved
-    static const std::unordered_set<size_t> blacklist_gpr_idxs = {
-        0,   // abi_param1 (X0)
-        1,   // abi_param2 (X1)
-        18,  // Platform register (X18)
-        31,  // Stack pointer (SP)
-    };
-
-    OPENVINO_ASSERT(count <= 32 - blacklist_gpr_idxs.size(),
-                    "Cannot allocate more than ",
-                    32 - blacklist_gpr_idxs.size(),
-                    " auxiliary registers");
-
-    // Convert used_gpr_idxs to unordered_set for O(1) lookups
-    const std::unordered_set<size_t> used_set(used_gpr_idxs.begin(), used_gpr_idxs.end());
+bool is_reserved_gpr(size_t idx) {
+    using Xbyak_aarch64::Operand;
+    return ov::intel_cpu::any_of(idx,
+                                 Operand::X18,
+                                 Operand::X23,
+                                 Operand::X24,
+                                 Operand::X28,
+                                 Operand::X29,
+                                 Operand::SP);

line 217 in this file

v-Golubev v-Golubev commented on Oct 13, 2026 07:10 UTC
Contributor

build_jenkins

v-Golubev v-Golubev commented on code on Oct 15, 2026 14:16 UTC
Code Review
src/plugins/intel_cpu/src/emitters/snippets/aarch64/utils.cpp:1
@@ -197,40 +196,37 @@ void EmitABIRegSpills::postamble() {
 
 namespace utils {
 
-std::vector<Xbyak_aarch64::XReg> get_aux_gprs(const std::vector<size_t>& used_gpr_idxs, size_t count) {
-    // X0 and X1 - runtime parameter registers in the kernel
-    // X18 - platform register should not be used
-    // SP - stack pointer should be preserved
-    static const std::unordered_set<size_t> blacklist_gpr_idxs = {
-        0,   // abi_param1 (X0)
-        1,   // abi_param2 (X1)
-        18,  // Platform register (X18)
-        31,  // Stack pointer (SP)
-    };
-
-    OPENVINO_ASSERT(count <= 32 - blacklist_gpr_idxs.size(),
-                    "Cannot allocate more than ",
-                    32 - blacklist_gpr_idxs.size(),
-                    " auxiliary registers");
-
-    // Convert used_gpr_idxs to unordered_set for O(1) lookups
-    const std::unordered_set<size_t> used_set(used_gpr_idxs.begin(), used_gpr_idxs.end());
+bool is_reserved_gpr(size_t idx) {

Minor: please add a short reference to jit_kernel_emitter.cpp here, since this predicate is now the shared source for both the pool and auxiliary allocations and the rationale for X23/X24/X28/X29 otherwise remains at the old caller.

v-Golubev v-Golubev commented on code on Oct 15, 2026 16:16 UTC
Code Review
src/plugins/intel_cpu/src/emitters/snippets/aarch64/utils.cpp:1
@@ -197,40 +196,37 @@ void EmitABIRegSpills::postamble() {
 
 namespace utils {
 
-std::vector<Xbyak_aarch64::XReg> get_aux_gprs(const std::vector<size_t>& used_gpr_idxs, size_t count) {
-    // X0 and X1 - runtime parameter registers in the kernel

Can we move this comment to L217?

v-Golubev v-Golubev commented on code on Oct 15, 2026 16:16 UTC
Code Review
src/plugins/intel_cpu/src/emitters/snippets/aarch64/utils.cpp:1
@@ -197,40 +196,37 @@ void EmitABIRegSpills::postamble() {
 
 namespace utils {
 
-std::vector<Xbyak_aarch64::XReg> get_aux_gprs(const std::vector<size_t>& used_gpr_idxs, size_t count) {
-    // X0 and X1 - runtime parameter registers in the kernel
-    // X18 - platform register should not be used
-    // SP - stack pointer should be preserved
-    static const std::unordered_set<size_t> blacklist_gpr_idxs = {
-        0,   // abi_param1 (X0)
-        1,   // abi_param2 (X1)
-        18,  // Platform register (X18)
-        31,  // Stack pointer (SP)
-    };
-
-    OPENVINO_ASSERT(count <= 32 - blacklist_gpr_idxs.size(),
-                    "Cannot allocate more than ",
-                    32 - blacklist_gpr_idxs.size(),
-                    " auxiliary registers");
-
-    // Convert used_gpr_idxs to unordered_set for O(1) lookups
-    const std::unordered_set<size_t> used_set(used_gpr_idxs.begin(), used_gpr_idxs.end());
+bool is_reserved_gpr(size_t idx) {
+    using Xbyak_aarch64::Operand;
+    return ov::intel_cpu::any_of(idx,

Could you please provide a short comment for each register on why it is reserved?

aobolensk aobolensk commented on code on Oct 15, 2026 18:01 UTC
Code Review
src/plugins/intel_cpu/src/emitters/snippets/aarch64/utils.cpp:1
@@ -197,40 +196,37 @@ void EmitABIRegSpills::postamble() {
 
 namespace utils {
 
-std::vector<Xbyak_aarch64::XReg> get_aux_gprs(const std::vector<size_t>& used_gpr_idxs, size_t count) {
-    // X0 and X1 - runtime parameter registers in the kernel
-    // X18 - platform register should not be used
-    // SP - stack pointer should be preserved
-    static const std::unordered_set<size_t> blacklist_gpr_idxs = {
-        0,   // abi_param1 (X0)
-        1,   // abi_param2 (X1)
-        18,  // Platform register (X18)
-        31,  // Stack pointer (SP)
-    };
-
-    OPENVINO_ASSERT(count <= 32 - blacklist_gpr_idxs.size(),
-                    "Cannot allocate more than ",
-                    32 - blacklist_gpr_idxs.size(),
-                    " auxiliary registers");
-
-    // Convert used_gpr_idxs to unordered_set for O(1) lookups
-    const std::unordered_set<size_t> used_set(used_gpr_idxs.begin(), used_gpr_idxs.end());
+bool is_reserved_gpr(size_t idx) {
+    using Xbyak_aarch64::Operand;
+    return ov::intel_cpu::any_of(idx,

Done, restored them

aobolensk aobolensk commented on code on Oct 15, 2026 18:01 UTC
Code Review
src/plugins/intel_cpu/src/emitters/snippets/aarch64/utils.cpp:1
@@ -197,40 +196,37 @@ void EmitABIRegSpills::postamble() {
 
 namespace utils {
 
-std::vector<Xbyak_aarch64::XReg> get_aux_gprs(const std::vector<size_t>& used_gpr_idxs, size_t count) {
-    // X0 and X1 - runtime parameter registers in the kernel
-    // X18 - platform register should not be used
-    // SP - stack pointer should be preserved
-    static const std::unordered_set<size_t> blacklist_gpr_idxs = {
-        0,   // abi_param1 (X0)
-        1,   // abi_param2 (X1)
-        18,  // Platform register (X18)
-        31,  // Stack pointer (SP)
-    };
-
-    OPENVINO_ASSERT(count <= 32 - blacklist_gpr_idxs.size(),
-                    "Cannot allocate more than ",
-                    32 - blacklist_gpr_idxs.size(),
-                    " auxiliary registers");
-
-    // Convert used_gpr_idxs to unordered_set for O(1) lookups
-    const std::unordered_set<size_t> used_set(used_gpr_idxs.begin(), used_gpr_idxs.end());
+bool is_reserved_gpr(size_t idx) {

done

aobolensk aobolensk commented on code on Oct 15, 2026 18:03 UTC
Code Review
src/plugins/intel_cpu/src/emitters/snippets/aarch64/utils.cpp:1
@@ -197,40 +196,37 @@ void EmitABIRegSpills::postamble() {
 
 namespace utils {
 
-std::vector<Xbyak_aarch64::XReg> get_aux_gprs(const std::vector<size_t>& used_gpr_idxs, size_t count) {
-    // X0 and X1 - runtime parameter registers in the kernel

done

v-Golubev v-Golubev commented on Oct 15, 2026 18:09 UTC
Contributor

build_jenkins

v-Golubev v-Golubev approved these changes on Oct 15, 2026 18:11 UTC
Approved Reviewer

Approved these changes.

Reviewers
Assignees
aobolensk aobolensk
Labels
risk: low confidence: 88.2% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 30.4% (LOW) · Higher = larger blast radius
30.4%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 88.2% · Lower = rushed or shallow review
88.2%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 3.6% · Safe to merge
3.6%