Skip to content

Commit

Permalink
[Snippets][AArch64] Enabled Ceiling and FloorMod tokenization (openvi…
Browse files Browse the repository at this point in the history
…notoolkit#28092)

### Details:
- *The PR enabled Snippets tokenization for ops `Ceiling` (activation)
and `FloorMod` (eltwise):*
   - *Updated tokenization callback*
- *Registered the operations with the corresponding emitters in
`CPUGenerator`*
   - *Added tests*
 - *This PR is example for the further GFIs'*

### Tickets:
 - *N/A*
  • Loading branch information
a-sidorova authored and 11happy committed Dec 23, 2024
1 parent c7e20d4 commit ae54579
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,12 @@ CPUTargetMachine::CPUTargetMachine(dnnl::impl::cpu::aarch64::cpu_isa_t host_isa)

// unary
jitters[ov::op::v0::Abs::get_type_info_static()] = CREATE_CPU_EMITTER(jit_abs_emitter);
jitters[ov::op::v0::Ceiling::get_type_info_static()] = CREATE_CPU_EMITTER(jit_ceiling_emitter);
jitters[ov::op::v0::Clamp::get_type_info_static()] = CREATE_CPU_EMITTER(jit_clamp_emitter);
jitters[ov::op::v0::Elu::get_type_info_static()] = CREATE_CPU_EMITTER(jit_elu_emitter);
jitters[ov::op::v0::Exp::get_type_info_static()] = CREATE_CPU_EMITTER(jit_exp_emitter);
jitters[ov::op::v0::Floor::get_type_info_static()] = CREATE_CPU_EMITTER(jit_floor_emitter);
jitters[ov::op::v1::FloorMod::get_type_info_static()] = CREATE_CPU_EMITTER(jit_floor_mod_emitter);
jitters[ov::op::v0::Gelu::get_type_info_static()] = CREATE_CPU_EMITTER(jit_gelu_erf_emitter);
jitters[ov::op::v7::Gelu::get_type_info_static()] =
CREATE_GELU_V7_EMITTER(jit_gelu_erf_emitter, jit_gelu_tanh_emitter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1117,9 +1117,10 @@ void Transformations::MainSnippets(void) {
auto is_supported_op = [](const std::shared_ptr<const ov::Node>& n) -> bool {
#if defined(OPENVINO_ARCH_ARM64)
return (ov::is_type<ov::op::v0::Abs>(n) || ov::is_type<ov::op::v1::Add>(n) ||
ov::is_type<ov::op::v0::Clamp>(n) || ov::is_type<ov::op::v0::Convert>(n) ||
ov::is_type<ov::op::v1::Divide>(n) || ov::is_type<ov::op::v0::Elu>(n) ||
ov::is_type<ov::op::v0::Exp>(n) || ov::is_type<ov::op::v0::Floor>(n) ||
ov::is_type<ov::op::v0::Clamp>(n) || ov::is_type<ov::op::v0::Ceiling>(n) ||
ov::is_type<ov::op::v0::Convert>(n) || ov::is_type<ov::op::v1::Divide>(n) ||
ov::is_type<ov::op::v0::Elu>(n) || ov::is_type<ov::op::v0::Exp>(n) ||
ov::is_type<ov::op::v0::Floor>(n) || ov::is_type<ov::op::v1::FloorMod>(n) ||
ov::is_type<ov::op::v0::Gelu>(n) || ov::is_type<ov::op::v7::Gelu>(n) ||
ov::is_type<ov::op::v4::HSwish>(n) || ov::is_type<ov::op::v1::Maximum>(n) ||
ov::is_type<ov::op::v1::Minimum>(n) || ov::is_type<ov::op::v4::Mish>(n) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ const std::map<utils::ActivationTypes, std::vector<std::vector<float>>>& activat
static const std::map<utils::ActivationTypes, std::vector<std::vector<float>>> activationTypes {
{Abs, {{}}},
{Exp, {{}}},
{Ceiling, {{}}},
{Clamp, {{-2.0f, 2.0f}}},
{Elu, {{0.1f}}},
{Floor, {{}}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ std::string EltwiseLayerCPUTest::getPrimitiveType(const utils::EltwiseTypes& elt
return "jit";
}
#endif
if (eltwise_type == utils::EltwiseTypes::MOD) {
if (eltwise_type == utils::EltwiseTypes::FLOOR_MOD ||
eltwise_type == utils::EltwiseTypes::MOD) {
return "ref";
} else {
return "acl";
Expand Down Expand Up @@ -317,10 +318,8 @@ const std::vector<utils::EltwiseTypes>& eltwiseOpTypesBinInp() {
#if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64)
utils::EltwiseTypes::SUBTRACT, // TODO: Fix CVS-105430
utils::EltwiseTypes::DIVIDE, // TODO: Fix CVS-105430
utils::EltwiseTypes::FLOOR_MOD, // TODO: Fix CVS-111875
#elif defined(OPENVINO_ARCH_ARM64)
utils::EltwiseTypes::FLOOR_MOD,
#endif
utils::EltwiseTypes::FLOOR_MOD,
utils::EltwiseTypes::SQUARED_DIFF,
utils::EltwiseTypes::MOD,
};
Expand All @@ -331,6 +330,7 @@ const std::vector<utils::EltwiseTypes>& eltwiseOpTypesBinInpSnippets() {
static const std::vector<utils::EltwiseTypes> eltwiseOpTypesBinInp = {
utils::EltwiseTypes::ADD,
utils::EltwiseTypes::MULTIPLY,
utils::EltwiseTypes::FLOOR_MOD,
utils::EltwiseTypes::MOD,
};
return eltwiseOpTypesBinInp;
Expand Down

0 comments on commit ae54579

Please sign in to comment.