-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[Snippets][CPU] Introduce jit_binary_call emitter on ARM, fix large offsets issue in Gemm #31553
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
[Snippets][CPU] Introduce jit_binary_call emitter on ARM, fix large offsets issue in Gemm #31553
Conversation
5d584fa
to
b0328ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed everything except jit_load_store_emitter
parts
src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/kernel_executors/gemm.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/kernel_executors/gemm.hpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_gemm_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_gemm_emitter.cpp
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_binary_call_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_binary_call_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_binary_call_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_binary_call_emitter.hpp
Outdated
Show resolved
Hide resolved
1b05f56
to
e163aef
Compare
src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_gemm_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_memory_emitters.cpp
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/kernel_executors/gemm.cpp
Outdated
Show resolved
Hide resolved
const bool is_dynamic_offset = ov::snippets::utils::is_dynamic_value(m_memory_offsets[i]); | ||
const bool is_valid_buffer_id = !ov::snippets::utils::is_dynamic_value(m_buffer_ids[i]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Please compare
m_buffer_id
withSIZE_MAX
because this value is returned fromov::intel_cpu::utils::get_buffer_cluster_id
. If we change dynamic value fromsize_max
to any another (for example,size_max-1
), this check will be invalid. So let's align check with withget_buffer_cluster_id
here -
Should we call assert if the offset is dynamic and
id
issize_max
? As it's done in memory emitters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added these checks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OPENVINO_ASSERT
is still missed here. Please double-check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returned it back
src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_gemm_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_gemm_copy_b_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_binary_call_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_binary_call_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_binary_call_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_load_store_emitters.cpp
Show resolved
Hide resolved
4bb0d29
to
e02ae65
Compare
src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_load_store_emitters.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/kernel_executors/gemm.cpp
Outdated
Show resolved
Hide resolved
const bool is_dynamic_offset = ov::snippets::utils::is_dynamic_value(m_memory_offsets[i]); | ||
const bool is_valid_buffer_id = !ov::snippets::utils::is_dynamic_value(m_buffer_ids[i]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OPENVINO_ASSERT
is still missed here. Please double-check
src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_gemm_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_gemm_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_gemm_copy_b_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_binary_call_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_emitter.cpp
Outdated
Show resolved
Hide resolved
if (off_mod == 0 && off_mul_vl >= 0 && off_mul_vl <= 4095) { | ||
h->ldr(QReg(dst.getIdx()), ptr(src, static_cast<uint32_t>(offset))); | ||
} else { | ||
h->add_imm(h->X_DEFAULT_ADDR, src, offset, h->X_TMP_0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a question for better understanding: is it safe to use h->X_DEFAULT_ADDR
and h->X_TMP_0
here? How do we guarantee that src
or dst
are not X_DEFAULT_ADDR
and X_TMP_0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YEs, we do. They are basically not used in code generation as inputs or outputs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@v-Golubev I had the same question but these registers are in blacklist for AssignRegister
pass:
openvino/src/plugins/intel_cpu/src/emitters/snippets/aarch64/cpu_generator.cpp
Lines 379 to 384 in 954c63f
// Note: more details on the usage of reserved registers in aarch64/jit_kernel_emitter.cpp | |
if (none_of(i, Operand::SP, Operand::X18, Operand::X23, Operand::X24, Operand::X28, Operand::X29)) { | |
reg_pool.emplace_back(snippets::RegType::gpr, i); | |
} | |
} | |
return reg_pool; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to create a static vector with reserved registers somewhere? Just to avoid such questions in the future: we will have one place (vec initialization) where we will explain why they are in a blacklist. And we will be able to use them in the places we need using this vec. @a-sidorova @aobolensk what do you think?
src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_load_store_emitters.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/kernel_executors/gemm.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_binary_call_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_binary_call_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_gemm_emitter.cpp
Outdated
Show resolved
Hide resolved
4b9f771
to
a20f240
Compare
if (off_mod == 0 && off_mul_vl >= 0 && off_mul_vl <= 4095) { | ||
h->ldr(QReg(dst.getIdx()), ptr(src, static_cast<uint32_t>(offset))); | ||
} else { | ||
h->add_imm(h->X_DEFAULT_ADDR, src, offset, h->X_TMP_0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@v-Golubev I had the same question but these registers are in blacklist for AssignRegister
pass:
openvino/src/plugins/intel_cpu/src/emitters/snippets/aarch64/cpu_generator.cpp
Lines 379 to 384 in 954c63f
// Note: more details on the usage of reserved registers in aarch64/jit_kernel_emitter.cpp | |
if (none_of(i, Operand::SP, Operand::X18, Operand::X23, Operand::X24, Operand::X28, Operand::X29)) { | |
reg_pool.emplace_back(snippets::RegType::gpr, i); | |
} | |
} | |
return reg_pool; |
src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_gemm_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_gemm_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_load_store_emitters.cpp
Outdated
Show resolved
Hide resolved
d0e26c7
to
a8fec5c
Compare
…nary-call-emitter
e7031da
to
34483bb
Compare
src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_emitter.cpp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_emitter.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_load_store_emitters.cpp
Show resolved
Hide resolved
src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_gemm_emitter.cpp
Outdated
Show resolved
Hide resolved
if (off_mod == 0 && off_mul_vl >= 0 && off_mul_vl <= 4095) { | ||
h->ldr(QReg(dst.getIdx()), ptr(src, static_cast<uint32_t>(offset))); | ||
} else { | ||
h->add_imm(h->X_DEFAULT_ADDR, src, offset, h->X_TMP_0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to create a static vector with reserved registers somewhere? Just to avoid such questions in the future: we will have one place (vec initialization) where we will explain why they are in a blacklist. And we will be able to use them in the places we need using this vec. @a-sidorova @aobolensk what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
3195c6f
Details:
Tickets: