-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CPU] [ARM] FullyConnected: int8 support
- Loading branch information
Showing
89 changed files
with
358 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...plugins/intel_cpu/src/transformations/snippets/common/pass/snippets_mark_skipped_base.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Copyright (C) 2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
#include "snippets_mark_skipped_base.hpp" | ||
|
||
#include "snippets/pass/tokenization.hpp" | ||
#include "snippets/op/subgraph.hpp" | ||
#include "snippets/utils.hpp" | ||
|
||
#include "transformations/utils/utils.hpp" | ||
#include "transformations/utils.hpp" | ||
#include "utils/general_utils.h" | ||
#include "utils/cpu_utils.hpp" | ||
#include "cpu/x64/cpu_isa_traits.hpp" | ||
|
||
#include "itt.hpp" | ||
|
||
|
||
namespace ov { | ||
namespace intel_cpu { | ||
|
||
bool SnippetsMarkSkippedBase::canBePerformedAsScaleShift(const std::shared_ptr<const Node> &node, const int channelAxis) { | ||
size_t fusingPort = 0; | ||
size_t numNonConstInputs = 0; | ||
ov::PartialShape dataShape; | ||
for (size_t i = 0; i < node->get_input_size(); i++) { | ||
const auto parent = node->get_input_node_shared_ptr(i); | ||
if (!ov::is_type<ov::op::v0::Constant>(parent)) { | ||
fusingPort = i; | ||
dataShape = node->get_input_partial_shape(i); | ||
// only one non-const parent is allowed | ||
if (++numNonConstInputs != 1) | ||
return false; | ||
} else { | ||
// every const parent must have exactly one child | ||
const auto out = parent->outputs(); | ||
const bool has_only_child = (out.size() == 1) && (out[0].get_target_inputs().size() == 1); | ||
if (!has_only_child) | ||
return false; | ||
} | ||
} | ||
|
||
const auto isBroadcastableToDataInput = [&]() { | ||
for (size_t i = 0; i < node->get_input_size(); i++) { | ||
if (i == fusingPort) | ||
continue; | ||
const ov::PartialShape weightShape = node->get_input_partial_shape(i); | ||
if (!isPerTensorOrPerChannelBroadcastable(dataShape.get_max_shape(), weightShape.get_max_shape(), channelAxis, true)) | ||
return false; | ||
} | ||
return true; | ||
}; | ||
|
||
// Prelu and MulAdd are still ignored | ||
// isConvertablePowerStatic() is ignored | ||
return (ov::is_type<ov::opset1::Add>(node) || | ||
ov::is_type<ov::opset1::Multiply>(node) || | ||
ov::is_type<ov::opset1::Subtract>(node) || | ||
ov::is_type<ov::opset1::Divide>(node)) && | ||
isBroadcastableToDataInput(); | ||
} | ||
|
||
} // namespace intel_cpu | ||
} // namespace ov |
22 changes: 22 additions & 0 deletions
22
...plugins/intel_cpu/src/transformations/snippets/common/pass/snippets_mark_skipped_base.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (C) 2018-2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "openvino/pass/graph_rewrite.hpp" | ||
|
||
namespace ov { | ||
namespace intel_cpu { | ||
|
||
/** | ||
* @interface SnippetsMarkSkippedBase | ||
* @brief Base class to mark operations that should be ignored by snippets on tokenization stage. | ||
*/ | ||
class SnippetsMarkSkippedBase : public ov::pass::ModelPass { | ||
protected: | ||
bool canBePerformedAsScaleShift(const std::shared_ptr<const Node> &node, const int channelAxis); | ||
}; | ||
|
||
} // namespace intel_cpu | ||
} // namespace ov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.