forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
433 additions
and
327 deletions.
There are no files selected for viewing
284 changes: 2 additions & 282 deletions
284
src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected.cpp
Large diffs are not rendered by default.
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
330 changes: 328 additions & 2 deletions
330
src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected_utils.cpp
Large diffs are not rendered by default.
Oops, something went wrong.
101 changes: 98 additions & 3 deletions
101
src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected_utils.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 |
---|---|---|
@@ -1,13 +1,108 @@ | ||
// Copyright (C) 2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "acl_common_executor.hpp" | ||
#include "ov_optional.hpp" | ||
#include "nodes/executors/fullyconnected_config.hpp" | ||
|
||
namespace ov { | ||
namespace intel_cpu { | ||
|
||
struct ACLFCAttrs { | ||
ov::element::Type inputPrecision; | ||
bool isConvertedWeights = false; | ||
bool isWeightsRepacked = false; | ||
bool weightsNonTransposed; | ||
}; | ||
|
||
namespace acl_fc_executor { | ||
|
||
VectorDims makeDummyInputDims(const Shape& inShape, const Shape& wShape); | ||
|
||
VectorDims makeDummyOutputDims(const VectorDims& inShape, const VectorDims& wShape, const size_t out_rank); | ||
|
||
DnnlMemoryDescPtr makeTransposedWeightDescriptor(const DnnlMemoryDescPtr srcDesc, | ||
const DnnlMemoryDescPtr dstDesc); | ||
|
||
ov::optional<MemoryPtr> convertWeightPrecision(MemoryPtr input, | ||
MemoryPtr output, | ||
ov::element::Type weightPrecision); | ||
|
||
ov::optional<MemoryPtr> reorderDataFallback(MemoryPtr input, | ||
MemoryPtr output, | ||
ExecutorContext::CPtr context); | ||
|
||
MemoryPtr reorderData(DnnlMemoryDescPtr srcWeightDesc, | ||
DnnlMemoryDescPtr dstWeightDesc, | ||
MemoryCPtr weightsMem, | ||
ExecutorContext::CPtr context); | ||
|
||
MemoryPtr reorderWeights(const MemoryArgs &memory, | ||
const ExecutorContext::CPtr context, | ||
ACLFCAttrs& aclfcAttrs, | ||
DnnlMemoryDescPtr dnnlSrcDesc, | ||
DnnlMemoryDescPtr dnnlDstDesc); | ||
|
||
MemoryPtr prepareWeightMemory(const MemoryArgs &memory, | ||
const ExecutorContext::CPtr context, | ||
const FCAttrs &attrs, | ||
ACLFCAttrs& aclfcAttrs, | ||
const PostOps &postOps, | ||
arm_compute::WeightFormat& expectedWeightFormat, | ||
arm_compute::TensorInfo& weiTensorInfo); | ||
|
||
arm_compute::TensorShape normalizeDimsTo2D(const arm_compute::TensorShape shape); | ||
|
||
void updateFCTensorsShapes(ACLShapes& aclMemoryShapes); | ||
|
||
class ACLWeightsConverter : public ACLCommonExecutor { | ||
public: | ||
ACLWeightsConverter() = default; | ||
void updateTensorsShapes(ACLShapes& aclMemoryShapes) override {} | ||
arm_compute::Status validateTensorsInfo(const ACLInfos & aclMemoryInfos) override; | ||
ACLFunction configureFunction(const ACLTensors & aclMemoryTensors) override; | ||
}; | ||
|
||
class ACLWeightsTranspose : public ACLCommonExecutor { | ||
public: | ||
ACLWeightsTranspose() = default; | ||
void updateTensorsShapes(ACLShapes& aclMemoryShapes) override {} | ||
arm_compute::Status validateTensorsInfo(const ACLInfos & aclMemoryInfos) override; | ||
ACLFunction configureFunction(const ACLTensors & aclMemoryTensors) override; | ||
}; | ||
|
||
class ACLWeightFormatGenerator : public ACLCommonExecutor { | ||
public: | ||
ACLWeightFormatGenerator(const FCAttrs& attrs, | ||
const PostOps& postOps, | ||
const MemoryArgs& memory); | ||
void updateTensorsShapes(ACLShapes& aclMemoryShapes) override; | ||
arm_compute::Status validateTensorsInfo(const ACLInfos & aclMemoryInfos) override; | ||
ACLFunction configureFunction(const ACLTensors & aclMemoryTensors) override; | ||
arm_compute::WeightFormat getOptImplWeightFormat() { | ||
return expectedWeightFormat; | ||
} | ||
private: | ||
arm_compute::FullyConnectedLayerInfo fullyConnectedLayerInfo; | ||
arm_compute::WeightsInfo weightsInfo; | ||
ACLFCAttrs aclfcAttrs; | ||
arm_compute::WeightFormat expectedWeightFormat; | ||
}; | ||
|
||
class ACLWeightsReorder : public ACLCommonExecutor { | ||
public: | ||
ACLWeightsReorder(arm_compute::WeightFormat inWeightFormat, | ||
arm_compute::WeightFormat outWeightFormat) | ||
: inWeightFormat(inWeightFormat), outWeightFormat(outWeightFormat) {} | ||
void updateTensorsShapes(ACLShapes& aclMemoryShapes) override {} | ||
arm_compute::Status validateTensorsInfo(const ACLInfos & aclMemoryInfos) override; | ||
ACLFunction configureFunction(const ACLTensors & aclMemoryTensors) override; | ||
private: | ||
arm_compute::WeightFormat inWeightFormat; | ||
arm_compute::WeightFormat outWeightFormat; | ||
}; | ||
|
||
} // namespace acl_fc_executor | ||
} // namespace intel_cpu | ||
} // namespace ov | ||
} // 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
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