[LPT] [GPU] Multiply to group convolution (#9971)
* [LPT] MultiplyToGroupConvolution optimization for GPU * [LPT] MatMul in FP32 in GPU workarround support * [LPT] GPU plugin tests
This commit is contained in:
1 parent
8c7e0d9479
commit
cc19ff74f1
12 files changed
+102
-35
No files matched your search
+7
-2
@@ -239,9 +239,11 @@ public:
|
||||
public:
|
||||
Params(
|
||||
const bool updatePrecisions = true,
|
||||
element::Type deqPrecision = element::f32) :
|
||||
element::Type deqPrecision = element::f32,
|
||||
const bool reshapeIgnorePerTensorQuantizationCheck = false) :
|
||||
updatePrecisions(updatePrecisions),
|
||||
deqPrecision(deqPrecision) {}
|
||||
deqPrecision(deqPrecision),
|
||||
reshapeIgnorePerTensorQuantizationCheck(reshapeIgnorePerTensorQuantizationCheck) {}
|
||||
|
||||
Params& setUpdatePrecisions(const bool updatePrecisions) {
|
||||
this->updatePrecisions = updatePrecisions;
|
||||
@@ -255,6 +257,8 @@ public:
|
||||
|
||||
bool updatePrecisions;
|
||||
element::Type deqPrecision;
|
||||
// to support GPU workarround to keep Reshape and MatMul in FP32
|
||||
bool reshapeIgnorePerTensorQuantizationCheck;
|
||||
};
|
||||
|
||||
class PrecisionDetails {
|
||||
@@ -322,6 +326,7 @@ protected:
|
||||
|
||||
bool updatePrecisions;
|
||||
element::Type deqPrecision;
|
||||
bool reshapeIgnorePerTensorQuantizationCheck;
|
||||
|
||||
static constexpr char originalLayerPostfix[] = "_original";
|
||||
TransformationContext* context;
|
||||
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
|
||||
static std::shared_ptr<opset1::Constant> toScalar(std::shared_ptr<opset1::Constant> constant);
|
||||
|
||||
static std::shared_ptr<Node> getConstantInput(const std::shared_ptr<Node>& node, const bool convertIsExpected = false);
|
||||
static std::shared_ptr<Node> getConstantInput(const std::shared_ptr<const Node>& node, const bool convertIsExpected = false);
|
||||
|
||||
static std::vector<size_t> updateReshapeValues(
|
||||
const Shape& elementwiseConstantShape,
|
||||
|
||||
@@ -30,6 +30,7 @@ std::mutex LayerTransformation::defaultPrecisionsMutex;
|
||||
LayerTransformation::LayerTransformation(const Params& params) :
|
||||
updatePrecisions(params.updatePrecisions),
|
||||
deqPrecision(params.deqPrecision),
|
||||
reshapeIgnorePerTensorQuantizationCheck(params.reshapeIgnorePerTensorQuantizationCheck),
|
||||
context(nullptr) {}
|
||||
|
||||
void LayerTransformation::setContext(TransformationContext* context) noexcept {
|
||||
|
||||
@@ -373,7 +373,7 @@ std::shared_ptr<opset1::Constant> NetworkHelper::toScalar(std::shared_ptr<opset1
|
||||
return std::make_shared<opset1::Constant>(constant->get_element_type(), Shape{}, constant->get_data_ptr());
|
||||
}
|
||||
|
||||
std::shared_ptr<Node> NetworkHelper::getConstantInput(const std::shared_ptr<Node>& node, const bool convertIsExpected) {
|
||||
std::shared_ptr<Node> NetworkHelper::getConstantInput(const std::shared_ptr<const Node>& node, const bool convertIsExpected) {
|
||||
std::shared_ptr<Node> parent = ov::as_type_ptr<opset1::Constant>(node->input_value(0).get_node_shared_ptr());
|
||||
if (parent != nullptr) {
|
||||
return parent;
|
||||
|
||||
@@ -195,8 +195,18 @@ bool ReshapeTransformation::canBeTransformed(const TransformationContext& contex
|
||||
return false;
|
||||
}
|
||||
|
||||
if (((dequantization.subtract == nullptr) || NetworkHelper::isScalarLike(dequantization.subtractConstant)) &&
|
||||
((dequantization.multiply == nullptr) || NetworkHelper::isScalarLike(dequantization.multiplyConstant))) {
|
||||
bool ignorePerTensorQuantizationCheck = false;
|
||||
if (reshapeIgnorePerTensorQuantizationCheck) {
|
||||
const auto inputs = op->get_output_target_inputs(0);
|
||||
if (inputs.size() == 1ul) {
|
||||
const auto consumer = inputs.begin()->get_node();
|
||||
ignorePerTensorQuantizationCheck = ngraph::as_type<ngraph::opset1::MatMul>(consumer) != nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ignorePerTensorQuantizationCheck &&
|
||||
(((dequantization.subtract == nullptr) || NetworkHelper::isScalarLike(dequantization.subtractConstant)) &&
|
||||
((dequantization.multiply == nullptr) || NetworkHelper::isScalarLike(dequantization.multiplyConstant)))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user