-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[luci] Introduce Compress weights pass
This commit introduces CopressWeightsPass for Conv2D ONE-DCO-1.0-Signed-off-by: Vyacheslav Bazhenov <[email protected]>
- Loading branch information
Vyacheslav Bazhenov
committed
Aug 9, 2024
1 parent
98ed924
commit 3030741
Showing
48 changed files
with
3,006 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
require("arser") | ||
require("foder") | ||
require("mio-circle08") | ||
require("mio-circle09") | ||
require("safemain") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
require("arser") | ||
require("foder") | ||
require("mio-circle08") | ||
require("mio-circle09") | ||
require("safemain") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
require("arser") | ||
require("foder") | ||
require("mio-circle08") | ||
require("mio-circle09") | ||
require("safemain") |
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
32 changes: 32 additions & 0 deletions
32
compiler/luci/import/include/luci/Import/CircleImporterUtils.h
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,32 @@ | ||
/* | ||
* Copyright (c) 2024 Samsung Electronics Co., Ltd. All Rights Reserved | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef __CIRCLE_IMPORTER_UTILS_H__ | ||
#define __CIRCLE_IMPORTER_UTILS_H__ | ||
|
||
#include <luci/IR/CircleNodes.h> | ||
|
||
#include <loco.h> | ||
|
||
#include <mio/circle/schema_generated.h> | ||
|
||
namespace luci | ||
{ | ||
luci::WeightCompression from_circle_weightcompressiontype(circle::WeightCompressionType type); | ||
|
||
} // namespace luci | ||
|
||
#endif // __CIRCLE_IMPORTER_UTILS_H__ |
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,42 @@ | ||
/* | ||
* Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include "luci/Import/CircleImporterUtils.h" | ||
|
||
#include <oops/InternalExn.h> | ||
|
||
namespace luci | ||
{ | ||
luci::WeightCompression from_circle_weightcompressiontype(circle::WeightCompressionType type) | ||
{ | ||
switch (type) | ||
{ | ||
case circle::WeightCompressionType_NONE: | ||
return luci::WeightCompression::NONE; | ||
case circle::WeightCompressionType_HUFFMAN: | ||
return luci::WeightCompression::HUFFMAN; | ||
case circle::WeightCompressionType_RLE: | ||
return luci::WeightCompression::RLE; | ||
case circle::WeightCompressionType_HUFFMAN_RLE: | ||
return luci::WeightCompression::HUFFMAN_RLE; | ||
case circle::WeightCompressionType_RLE_HUFFMAN: | ||
return luci::WeightCompression::RLE_HUFFMAN; | ||
default: | ||
INTERNAL_EXN_V("trying to convert unsupported luci::WeightCompression", | ||
oops::to_uint32(type)); | ||
} | ||
} | ||
} // namespace luci |
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
36 changes: 36 additions & 0 deletions
36
compiler/luci/lang/include/luci/IR/AttrWeightCompression.h
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,36 @@ | ||
/* | ||
* Copyright (c) 2024 Samsung Electronics Co., Ltd. All Rights Reserved | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef __LUCI_IR_ATTRWEIGHTCOMPRESSION_H__ | ||
#define __LUCI_IR_ATTRWEIGHTCOMPRESSION_H__ | ||
|
||
namespace luci | ||
{ | ||
|
||
enum class WeightCompression | ||
{ | ||
UNDEFINED, // This is not defined by TFLite or Circle. This was added to | ||
// prevent programming error. | ||
NONE, | ||
HUFFMAN, | ||
RLE, | ||
HUFFMAN_RLE, | ||
RLE_HUFFMAN | ||
}; | ||
|
||
} // namespace luci | ||
|
||
#endif // __LUCI_IR_ATTRWEIGHTCOMPRESSION_H__ |
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.