Skip to content

Commit 06e7dd0

Browse files
authored
Merge branch 'master' into fix-tests
2 parents 1614227 + 7af0e52 commit 06e7dd0

File tree

112 files changed

+2753
-733
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+2753
-733
lines changed

.git-blame-ignore-revs

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Migrate to clang-format-8
2+
b823044b5430455dc3d59c465ec36ae2e0a18b06
3+
1a6d9f00ba9f84c9c0dea1920ab3e4c75c127767
4+
07e0bf6909d9afdca8eff74dc18824c126e051fe
5+
e01989e10e361b826db5cc7eb367d64bed52c394
6+
1a6c2f4c728c3fb6af6c925444a414e21b040776
7+
56713c812379c60d59f1014c495ea450ecb5619b
8+
218e7561a11f5104349b67457915071ce0325844
9+
41644d4d0c74427112d0df94d627e47d7e1af182
10+
d1d46e759110533bc406aec983a4f1965783c1bb
11+
13740fae0d2dadfc2e61d8a749eccdda2f59f651
12+
7484db3e41d443e77bd577189b9b89704b4f77e7
13+
89294e72fb7f87090cfbc9a64d1efe3127b43707
14+
e9555b203ba4affd74dadd1766abe2de123759f3
15+
03b2c33a74858288300c0ea1f8624751eb6cba6b
16+
fbfbad9f72eab095f1ef62f629e0c2004c8ce2d1
17+
88213431c517cdd01fa38027a4ca59db247349dd
18+
a65367238d22ada6ee67b3bc8c17aafd5ce79fed
19+
07ec6705b265a36bbb110fc92373dfd81dadd977
20+
b97bb692fb5450b2407f0edaad71de035d2c99df
21+
fa047652d28926c44a167ce3db14b4d699fc4d72
22+
45f473c88c7a49317cae260afc394335e4d996b0
23+
987140eb8444b4404035fad2010386e8ebef06d4
24+
9321f323e685f87c43a958ec18f9c8899e5cec66
25+
ca07434330c7fb4896731ecd9a6642c4cf3ea32a
26+
4e38da075e0c3049ea2c67e7a23704dbf00976f8
27+
f3b1e7a0d25da2986368bd9e3c966d20e398cd2f
28+
0bac725cb5fda66712bfe4898f7c2c7339fd9c95
29+
a7fe0607307cbb7a6c52d6ce88bed61a0546bea9
30+
21f79d6a95ec9ce1cec1773b994db21936000b84
31+
e135aa4e84538adeca76eb6c5a3f96b47e14928a
32+
2d3e893883ae1594318980941128cf0dfbfce2f3
33+
de4fb32af5e79485b52236790149eed44762a0e7
34+
b27695f7000a84e130b15b872a4c5998a5572449
35+
45b57db3e26620929d3d653c22702383afc5bd73
36+
21612ef572e1e6214dece9a7da8b3ed91a35c512
37+
c32fc746d6ab7a51a7df2f4804e1916f9ea083dd
38+
a6600d1649e6c0789dbd32968f840e08df9609c3
39+
7a56078687ecd6b6fb5d54cd4fea9f5e32788667
40+
589bb2dd216592712ed4e1d00fbdde56e0c578df
41+
5365de4f0121efd12eaced56cdb9f3319f403c3e
42+
ce664a17eb02cf34b1291edb9056e831a78abe39
43+
e3b0dbd1c6166eb89e8f43edb2bc06bc104fe536
44+
e3b0dbd1c6166eb89e8f43edb2bc06bc104fe536
45+
950795b83427eb06a381d36ef020093470527763
46+
ab99392cba9c2aa4d8660e2854143cb3b5696fbd
47+
8ac5bd503ae57152b6b45c80f9c57315461bed9d
48+
536cd365ee933aee0ba9c4c4ed80300170d2b818
49+
10da7333257bf5b15f007ed03d6dea2b2bc6226e
50+
432a2e2a347c9f824583ef40f7bcb281c2df8ceb
51+
c58f815fd4864b1f9ca03584616b2fae32c262b3
52+
2b531e4ae4e91a0f202b67a91af0d8de07e72a9c
53+
0da03ab09ea30fcc5d16a3e82d9eb9e353f3f7d6
54+
f0f13a9add58c17d4cd26aa839b71ab9f1126961
55+
f40f1757207a4c3fcaeb94cb9c05310d30da45aa
56+
1af2b04dd222a53580ad897d033da02749dea5a3
57+
559e5a5dee0c5a5d49ae026e8f417e982d3014f1
58+
06f93e959f17b1e8aae9f66a7d79409961511744
59+
e45913706aebaaf028045c3efe7a7894f98c30be
60+
151d5c5ec65c8e398a7ff143b770ac7468424082
61+
070fef8051c1397b76cdcbedc2b4140473f42ddd
62+
241a5b08406f2bed7318455dec8b8aac3541e1f3
63+
64+
# Migrate to clang-format-16
65+
a3a157a3e5a15f2c23ab3c55c0b76aa2db224710
66+
67+
# Migrate to yapf 0.40.2
68+
19e8a47269665cd9d00d27f945d43a6936efdc30

.github/workflows/check-format.yml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ jobs:
2323
steps:
2424
- name: Checkout
2525
uses: actions/checkout@v4
26+
with:
27+
# Fetch all history and branch (default: 1)
28+
# Require all history to get file creation date
29+
fetch-depth: 0
2630

2731
- name: Install uv
2832
uses: astral-sh/setup-uv@v7
@@ -32,19 +36,3 @@ jobs:
3236
- name: Check format all files
3337
run: |
3438
uv run pre-commit run -a
35-
36-
check-copyright:
37-
name: Check copyright
38-
runs-on: ubuntu-22.04
39-
if: github.repository_owner == 'Samsung'
40-
41-
steps:
42-
- name: Checkout
43-
uses: actions/checkout@v4
44-
with:
45-
# Fetch all history and branch (default: 1)
46-
# Require all history to get file creation date
47-
fetch-depth: 0
48-
49-
- name: Check copyright
50-
run: ./nnas copyright-check

.github/workflows/pub-circle-int-launchpad.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ jobs:
104104
run: |
105105
CIR_INTP_ITEMS="angkor;cwrap;pepper-str;pepper-strcast;pepper-csv2vec;pp"
106106
CIR_INTP_ITEMS="${CIR_INTP_ITEMS};oops;loco;logo-core;logo;locop"
107-
CIR_INTP_ITEMS="${CIR_INTP_ITEMS};hermes;hermes-std;safemain;mio-circle08"
107+
CIR_INTP_ITEMS="${CIR_INTP_ITEMS};hermes;hermes-std;safemain;mio-circle"
108108
CIR_INTP_ITEMS="${CIR_INTP_ITEMS};luci-compute;luci;luci-interpreter"
109109
CIR_INTP_ITEMS="${CIR_INTP_ITEMS};foder;arser;vconone;circle-interpreter"
110110
echo ${CIR_INTP_ITEMS}

.pre-commit-config.yaml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@ repos:
1010
exclude: \.(svg)$
1111
- name: 'Check trailing whitespace'
1212
id: trailing-whitespace
13-
# TODO add shebang to all excutable python/shell scripts
1413
- name: 'Check executable files'
1514
id: check-executables-have-shebangs
16-
exclude: \.(py|sh)$
15+
exclude:
16+
(?x)^(
17+
.*/__init__.py$|
18+
compiler/nnc/utils/.*\.py$|
19+
runtime/tests/scripts/models/.*/config\.sh$|
20+
res/TensorFlowTests/.*\.py$
21+
)
1722

1823
- repo: https://github.com/rhysd/actionlint
1924
rev: 'v1.7.9'
@@ -58,3 +63,21 @@ repos:
5863
id: clang-format
5964
types_or: [file] # override default type check to cl files
6065
files: ((\.c[cl]?)|(\.cpp)|(\.h(pp)?))$
66+
67+
- repo: local
68+
hooks:
69+
- name: 'Check copyright headers'
70+
id: copyright-check
71+
entry: infra/git-hooks/copyright-check.sh
72+
language: script
73+
pass_filenames: true
74+
types: [file]
75+
files: \.(c[cl]?|cpp|h(pp)?)$
76+
# Ignore 3rd-party code
77+
exclude:
78+
(?x)^(
79+
compiler/ann-api/.*|
80+
onert-micro/externals/.*|
81+
runtime/3rdparty/.*|
82+
runtime/tests/nnapi/.*
83+
)

circle-mlir/circle-mlir/lib/dialect/mlir/CircleOps.td

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,6 +1619,32 @@ def CIR_PReluOp : CIR_Op<"prelu", [
16191619
*/
16201620
}
16211621

1622+
def CIR_RangeOp : CIR_Op<"range", [
1623+
Pure,
1624+
CIR_OperandHasRank<0, 0>,
1625+
CIR_OperandHasRank<1, 0>,
1626+
CIR_OperandHasRank<2, 0>,
1627+
PredOpTrait<"operands and output must have same element type",
1628+
And<[TCresVTEtIsSameAsOp<0, 0>, TCresVTEtIsSameAsOp<0, 1>,
1629+
TCresVTEtIsSameAsOp<0, 2>]>>]> {
1630+
let summary = "Range operator";
1631+
1632+
let description = [{
1633+
Returns a 1D tensor defined by a sequence from `start` to `limit` with
1634+
a given `delta`.
1635+
}];
1636+
1637+
let arguments = (ins
1638+
CIR_TensorOf<[I32, F32, I64]>:$start,
1639+
CIR_TensorOf<[I32, F32, I64]>:$limit,
1640+
CIR_TensorOf<[I32, F32, I64]>:$delta
1641+
);
1642+
1643+
let results = (outs CIR_TensorOf<[I32, F32, I64]>:$result);
1644+
1645+
let hasOptions = 1;
1646+
}
1647+
16221648
def CIR_ReduceMaxOp: CIR_Op<"reduce_max", [
16231649
PredOpTrait<"input and output must have same element type",
16241650
CIR_TCresVTEtIsSameAsOp<0, 0>>,

circle-mlir/circle-mlir/lib/pass/src/ConvertONNXToCirclePass.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,13 @@
6464
#include "ops/PowOp.h"
6565
#include "ops/PReluOp.h"
6666
#include "ops/QuantizeLinearOp.h"
67+
#include "ops/RangeOp.h"
6768
#include "ops/ReciprocalOp.h"
6869
#include "ops/ReduceMaxOp.h"
6970
#include "ops/ReduceMeanOp.h"
7071
#include "ops/ReduceProdOp.h"
7172
#include "ops/ReduceSumOp.h"
73+
#include "ops/ReduceSumSquareOp.h"
7274
#include "ops/ReluOp.h"
7375
#include "ops/ReshapeOp.h"
7476
#include "ops/ResizeOp.h"
@@ -246,6 +248,7 @@ void ConvertONNXToCirclePass::runOnOperation()
246248
patterns.insert<ConvPow>(typeConverter, context);
247249
patterns.insert<ConvPRelu>(typeConverter, context);
248250
patterns.insert<ConvQuantizeLinear>(typeConverter, context);
251+
patterns.insert<ConvRange>(typeConverter, context);
249252
patterns.insert<ConvReciprocal>(typeConverter, context);
250253
patterns.insert<ConvReduceMax>(typeConverter, context);
251254
patterns.insert<ConvReduceMaxV13>(typeConverter, context);
@@ -255,6 +258,7 @@ void ConvertONNXToCirclePass::runOnOperation()
255258
patterns.insert<ConvReduceProdV13>(typeConverter, context);
256259
patterns.insert<ConvReduceSum>(typeConverter, context);
257260
patterns.insert<ConvReduceSumV11>(typeConverter, context);
261+
patterns.insert<ConvReduceSumSquareV13>(typeConverter, context);
258262
patterns.insert<ConvRelu>(typeConverter, context);
259263
patterns.insert<ConvReshape>(typeConverter, context);
260264
patterns.insert<ConvResize>(typeConverter, context);

circle-mlir/circle-mlir/lib/pass/src/ops/ConvOp.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ class ConvConv : public mlir::OpConversionPattern<mlir::ONNXConvOp>
9494
// for op.pads != [0,0,0,0]
9595
std::vector<int32_t> padsValue;
9696
if (GetPads(op.getPads(), padsValue))
97+
{
9798
inputPreTr = insertPad(rewriter, op_name, input, outtype, padsValue);
99+
intype = mlir::dyn_cast_or_null<mlir::RankedTensorType>(inputPreTr.getType());
100+
LLVM_DEBUG({ llvm::dbgs() << "ConvConv intype after padding: " << intype << "\n"; });
101+
}
98102

99103
int32_t stride_h = 1;
100104
int32_t stride_w = 1;
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright (c) 2026 Samsung Electronics Co., Ltd. All Rights Reserved
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifndef __CIRCLE_MLIR_PASS_OPS_RANGE_OP_H__
18+
#define __CIRCLE_MLIR_PASS_OPS_RANGE_OP_H__
19+
20+
#include <circle-mlir/dialect/CircleDialect.h>
21+
22+
#include "ConvertHelper.h"
23+
24+
#include <mlir/Transforms/DialectConversion.h>
25+
26+
#include <src/Dialect/ONNX/ONNXOps.hpp>
27+
28+
namespace mlir
29+
{
30+
namespace Circle
31+
{
32+
33+
class ConvRange : public mlir::OpConversionPattern<mlir::ONNXRangeOp>
34+
{
35+
public:
36+
using mlir::OpConversionPattern<mlir::ONNXRangeOp>::OpConversionPattern;
37+
using OpAdaptor = typename mlir::ONNXRangeOp::Adaptor;
38+
39+
mlir::LogicalResult matchAndRewrite(mlir::ONNXRangeOp op, OpAdaptor adaptor,
40+
mlir::ConversionPatternRewriter &rewriter) const override
41+
{
42+
mlir::Value start = adaptor.getStart();
43+
mlir::Value limit = adaptor.getLimit();
44+
mlir::Value delta = adaptor.getDelta();
45+
46+
rewriter.replaceOpWithNewOp<RangeOp>(op, op.getType(), start, limit, delta);
47+
48+
return mlir::success();
49+
}
50+
};
51+
52+
} // namespace Circle
53+
} // namespace mlir
54+
55+
#endif // __CIRCLE_MLIR_PASS_OPS_RANGE_OP_H__

circle-mlir/circle-mlir/lib/pass/src/ops/ReduceSumOp.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17-
#ifndef __CIRCLE_MLIR_PASS_OPS_SUM_OP_H__
18-
#define __CIRCLE_MLIR_PASS_OPS_SUM_OP_H__
17+
#ifndef __CIRCLE_MLIR_PASS_OPS_REDUCE_SUM_OP_H__
18+
#define __CIRCLE_MLIR_PASS_OPS_REDUCE_SUM_OP_H__
1919

2020
#include <circle-mlir/dialect/CircleDialect.h>
2121

@@ -179,4 +179,4 @@ class ConvReduceSumV11 : public mlir::OpConversionPattern<mlir::ONNXReduceSumV11
179179
} // namespace Circle
180180
} // namespace mlir
181181

182-
#endif // __CIRCLE_MLIR_PASS_OPS_SUM_OP_H__
182+
#endif // __CIRCLE_MLIR_PASS_OPS_REDUCE_SUM_OP_H__

0 commit comments

Comments
 (0)