-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Snippets: precision propagation (#14996)
- Loading branch information
Showing
48 changed files
with
2,066 additions
and
327 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
46 changes: 0 additions & 46 deletions
46
src/common/snippets/include/snippets/pass/align_element_type.hpp
This file was deleted.
Oops, something went wrong.
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
48 changes: 48 additions & 0 deletions
48
src/common/snippets/include/snippets/pass/propagate_precision.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,48 @@ | ||
// Copyright (C) 2023 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include <memory> | ||
#include <ngraph/pass/pass.hpp> | ||
#include "snippets/generator.hpp" | ||
|
||
namespace ngraph { | ||
namespace snippets { | ||
namespace pass { | ||
|
||
/** | ||
* @class PropagatePrecision | ||
* @ingroup snippets | ||
* @brief PropagatePrecision transformation propagate precision from parameters to results. | ||
*/ | ||
class PropagatePrecision: public ngraph::pass::FunctionPass { | ||
public: | ||
OPENVINO_RTTI("PropagatePrecision", "0"); | ||
PropagatePrecision(const std::shared_ptr<const TargetMachine>& target_machine); | ||
bool run_on_model(const std::shared_ptr<ov::Model>& m) override; | ||
|
||
static std::vector<element::Type> get_precisions( | ||
const std::vector<element::Type>& input_precisions, | ||
const std::set<std::vector<element::Type>>& supported_precisions) noexcept; | ||
|
||
// if can_be_removed returns true then actual convertion (actual_before => actual_after) | ||
// can be replaced to required (actual_before => required_after) | ||
static bool can_be_removed( | ||
const element::Type& actual_before, | ||
const element::Type& actual_after, | ||
const element::Type& required_after) noexcept; | ||
|
||
// if can_be_fused returns true then actual convertion can be replaced to required | ||
static bool can_be_fused( | ||
const element::Type& actual, | ||
const element::Type& required) noexcept; | ||
|
||
private: | ||
const std::shared_ptr<const TargetMachine> target_machine; | ||
}; | ||
|
||
} // namespace pass | ||
} // namespace snippets | ||
} // namespace ngraph |
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.