Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into jiwaszki/fuse_mul…
Browse files Browse the repository at this point in the history
…_fc_one_cmds
  • Loading branch information
jiwaszki committed Aug 21, 2024
2 parents 51dd43c + ac4d588 commit d23e1fd
Show file tree
Hide file tree
Showing 173 changed files with 9,019 additions and 1,157 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/check-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
check-format:
name: Check format
runs-on: ubuntu-20.04
if: github.repository_owner == 'Samsung'

steps:
- name: Checkout
Expand Down Expand Up @@ -54,6 +55,7 @@ jobs:
check-copyright:
name: Check copyright
runs-on: ubuntu-20.04
if: github.repository_owner == 'Samsung'

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-pr-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
name: Check commit message
runs-on: ubuntu-20.04
# Skip on draft, check on draft -> ready
if: github.event.pull_request.draft == false
if: github.repository_owner == 'Samsung' && github.event.pull_request.draft == false

steps:
- name: Checkout
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/run-onecc-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,23 @@ jobs:
onecc-test:
# Tested ubuntu version is decided by docker image, not runner
runs-on: ubuntu-latest
if: github.repository_owner == 'Samsung'
strategy:
# TODO Support various ubuntu version
matrix:
type: [ Debug, Release ]
ubuntu_code: [ focal, jammy ]
include:
- ubuntu_code: focal
ubuntu_ver: 20.04
- ubuntu_code: jammy
ubuntu_ver: 22.04
container:
image: nnfw/one-devtools:focal
image: nnfw/one-devtools:${{ matrix.ubuntu_code }}
options: --user root
env:
NNCC_WORKSPACE : build
NNCC_INSTALL_PREFIX : install
name: onecc ubuntu 20.04 ${{ matrix.type }} test
name: onecc ubuntu ${{ matrix.ubuntu_ver }} ${{ matrix.type }} test

steps:
- name: Checkout
Expand All @@ -67,7 +73,7 @@ jobs:
uses: actions/cache@v4
with:
path: ${{ env.NNCC_WORKSPACE }}/overlay
key: overlay-onecc-focal-${{ hashFiles('compiler/common-artifacts/CMakeLists.txt') }}-${{ hashFiles('infra/cmake/packages/**/*.cmake') }}
key: overlay-onecc-${{ matrix.ubuntu_code }}-${{ hashFiles('compiler/common-artifacts/CMakeLists.txt') }}-${{ hashFiles('infra/cmake/packages/**/*.cmake') }}

- name: Build
run: |
Expand Down
39 changes: 25 additions & 14 deletions .github/workflows/run-onert-android-build.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
name: Run ONERT Android Release Build

on:
push:
branches:
- master
- release/*
paths:
- '.github/workflows/run-onert-android-build.yml'
- 'nn*'
- 'Makefile.template'
- 'compute/**'
- 'infra/buildtool/**'
- 'infra/cmake/**'
- 'infra/nncc/**'
- 'infra/nnfw/**'
- 'runtime/**'
- 'tests/**'
- '!**/*.md'
pull_request:
branches:
- master
- release/*
paths:
- '.github/workflows/run-onert-android-build.yml'
- 'nnas'
- 'nnfw'
- 'nn*'
- 'Makefile.template'
- 'compute/**'
- 'infra/**'
- '!infra/debian/**'
- '!infra/docker/**'
- '!infra/doxygen/**'
- '!infra/git-hooks/**'
- '!infra/nncc/**'
- '!infra/onert-micro/**'
- '!infra/packaging/**'
- 'nnpackage/**'
- '!nnpackage/spec/**'
- 'infra/buildtool/**'
- 'infra/cmake/**'
- 'infra/nncc/**'
- 'infra/nnfw/**'
- 'runtime/**'
- 'tests/**'
- '!**.md'
- '!**/*.md'

defaults:
run:
Expand All @@ -32,6 +41,7 @@ defaults:
jobs:
build:
runs-on: ubuntu-22.04
if: github.repository_owner == 'Samsung'
env:
TARGET_ARCH: aarch64
TARGET_OS: android
Expand All @@ -45,8 +55,9 @@ jobs:
uses: actions/cache@v4
with:
path: externals
key: external-onert-ndk26
key: external-onert-ndk26-${{ hashFiles('infra/cmake/packages/**/*.cmake') }}-${{ hashFiles('infra/nnfw/cmake/packages/**/*.cmake') }}
restore-keys: |
external-onert-ndk26-
external-onert-ndk
external-onert-
external-
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/run-onert-micro-unit-tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: Run onert-micro Unit tests

on:
push:
branches:
- master
- release/*
paths:
- 'onert-micro/**'
- '.github/workflows/run-onert-micro-unit-tests.yml'
pull_request:
branches:
- master
Expand All @@ -23,7 +30,7 @@ jobs:
name: Run onert-micro Unit tests
runs-on: ubuntu-20.04
# Skip on draft, check on draft -> ready
if: github.event.pull_request.draft == false
if: github.repository_owner == 'Samsung' && github.event.pull_request.draft == false

steps:
- name: Install Arm GNU Toolchain (arm-none-eabi-gcc)
Expand Down
6 changes: 5 additions & 1 deletion compiler/circledump/driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ int entry(int argc, char **argv)

std::cout << "Dump: " << circle_path << std::endl << std::endl;

std::cout << circlemodel << std::endl;
circledump::ModelEx modelex;
modelex.model = circlemodel;
modelex.rawdata = &modelData;

std::cout << modelex << std::endl;

return 0;
}
13 changes: 10 additions & 3 deletions compiler/circledump/include/circledump/Dump.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,16 @@
namespace circledump
{

void dump_model(std::ostream &os, const circle::Model *model);
}
struct ModelEx
{
const circle::Model *model;
const std::vector<char> *rawdata;
};

void dump_model(std::ostream &os, const circledump::ModelEx &model);

} // namespace circledump

std::ostream &operator<<(std::ostream &os, const circle::Model *model);
std::ostream &operator<<(std::ostream &os, const circledump::ModelEx &model);

#endif // __CIRCLEDUMP_DUMP_H__
18 changes: 11 additions & 7 deletions compiler/circledump/src/Dump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,9 @@ void dump_sub_graph(std::ostream &os, mio::circle::Reader &reader)
os << std::endl;
}

void dump_model(std::ostream &os, const circle::Model *model)
void dump_model(std::ostream &os, const circle::Model *model, const std::vector<char> *rawdata)
{
mio::circle::Reader reader(model);
mio::circle::Reader reader(model, rawdata);

uint32_t num_subgraph = reader.num_subgraph();

Expand Down Expand Up @@ -378,13 +378,17 @@ void dump_model(std::ostream &os, const circle::Model *model)
os << std::endl;

// dump buffer
os << "Buffers: B(index) (length) values, if any" << std::endl;
os << "Buffers: B(index) (length) values, if any; (length *) for ext_offset" << std::endl;
for (uint32_t i = 0; i < buffers->size(); ++i)
{
bool ext_offset = false;
const uint8_t *buff_data;
size_t size = reader.buffer_info(i, &buff_data);
size_t size = reader.buffer_info(i, &buff_data, ext_offset);

os << "B(" << i << ") (" << size << ") ";
os << "B(" << i << ") (" << size;
if (ext_offset)
os << " *";
os << ") ";
if (buff_data != nullptr)
{
dump_buffer(os, buff_data, size, 16);
Expand Down Expand Up @@ -460,8 +464,8 @@ void dump_model(std::ostream &os, const circle::Model *model)

} // namespace circledump

std::ostream &operator<<(std::ostream &os, const circle::Model *model)
std::ostream &operator<<(std::ostream &os, const circledump::ModelEx &modelex)
{
circledump::dump_model(os, model);
circledump::dump_model(os, modelex.model, modelex.rawdata);
return os;
}
30 changes: 23 additions & 7 deletions compiler/luci-interpreter/pal/linux/PALConv2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,30 @@ static inline void Conv(const tflite::ConvParams &params, const tflite::RuntimeS
float *scratchpad_data)
{
(void)scratchpad_shape;
if (scratchpad_data)

const int32_t batches = tflite::MatchingDim(input_shape, 0, output_shape, 0);
const int32_t input_depth = tflite::MatchingDim(input_shape, 3, filter_shape, 3);
const int32_t output_height = output_shape.Dims(1);
const int32_t output_width = output_shape.Dims(2);
const int32_t filter_height = filter_shape.Dims(1);
const int32_t filter_width = filter_shape.Dims(2);

int64_t im2col_flat_size = 1;
im2col_flat_size *= batches;
im2col_flat_size *= output_height;
im2col_flat_size *= output_width;
im2col_flat_size *= input_depth;
im2col_flat_size *= filter_height;
im2col_flat_size *= filter_width;

// This condition checks if integer overflow will occur inside the optimized kernel.
// https://github.com/tensorflow/tensorflow/blob/v2.12.1/tensorflow/lite/kernels/internal/optimized/im2col_utils.h#L81
// If overflow is expected, we fall back to the reference kernel.
// NOTE This is just a rough check.
bool opt_kernel_overflow = im2col_flat_size > std::numeric_limits<int32_t>::max();

if (scratchpad_data and not opt_kernel_overflow)
{
const int32_t batches = tflite::MatchingDim(input_shape, 0, output_shape, 0);
const int32_t input_depth = tflite::MatchingDim(input_shape, 3, filter_shape, 3);
const int32_t output_height = output_shape.Dims(1);
const int32_t output_width = output_shape.Dims(2);
const int32_t filter_height = filter_shape.Dims(1);
const int32_t filter_width = filter_shape.Dims(2);
tflite::RuntimeShape im2col_shape{batches, output_height, output_width,
input_depth * filter_height * filter_width};

Expand Down
Loading

0 comments on commit d23e1fd

Please sign in to comment.