Skip to content
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
cdcc047
add submodule
Semyon1104 Oct 21, 2025
a514899
add EWLayer_oneDNN
Semyon1104 Oct 22, 2025
1b844c2
Update .gitmodules
Semyon1104 Oct 22, 2025
499ed46
fix
Semyon1104 Oct 22, 2025
9a6af4b
clang
Semyon1104 Oct 22, 2025
d86e1c1
Update ci.yml
Semyon1104 Oct 22, 2025
00d79bb
fix unused
Semyon1104 Oct 22, 2025
b3cdf0c
fix cmake, default with err
Semyon1104 Oct 23, 2025
b57dba8
Update ci.yml
Semyon1104 Oct 23, 2025
d09f86f
fix parallel in cmake
Semyon1104 Oct 28, 2025
96ccc43
Update ci.yml
Semyon1104 Oct 28, 2025
60f5e61
fix parallel in cmake
Semyon1104 Oct 28, 2025
7d2afb5
fix parallel in cmake
Semyon1104 Oct 28, 2025
2ac1d8f
fix parallel in cmake
Semyon1104 Oct 28, 2025
b252d6c
fix parallel in cmake
Semyon1104 Oct 28, 2025
9e879fe
Update ci.yml
Semyon1104 Oct 28, 2025
09099ac
fix parallel in cmake
Semyon1104 Oct 28, 2025
38f4588
Update ci.yml
Semyon1104 Oct 28, 2025
a44af97
fix parallel in cmake
Semyon1104 Oct 28, 2025
9e16ac0
Merge branch 'Semyon1104/IntegrateOneDNN' of https://github.com/embed…
Semyon1104 Oct 28, 2025
24d7e52
Update ci.yml
Semyon1104 Oct 28, 2025
9393e7b
Update ci.yml
Semyon1104 Oct 28, 2025
070a477
fix parallel in cmake
Semyon1104 Oct 28, 2025
d00b0d4
fix parallel in cmake
Semyon1104 Oct 28, 2025
1fbb7cf
Update static-analysis.yml
Semyon1104 Oct 28, 2025
cfa6aea
Update ci.yml
Semyon1104 Oct 29, 2025
4e56912
check evaluate
Semyon1104 Oct 29, 2025
8cb7a2c
Update ci.yml
Semyon1104 Oct 29, 2025
920a377
analisys, add int
Semyon1104 Oct 29, 2025
c0def70
Merge branch 'Semyon1104/IntegrateOneDNN' of https://github.com/embed…
Semyon1104 Oct 29, 2025
0352eb9
check evaluate
Semyon1104 Oct 29, 2025
afbf56b
add tests
Semyon1104 Oct 29, 2025
d660ff5
Merge branch 'Semyon1104/IntegrateOneDNN' of https://github.com/embed…
Semyon1104 Oct 29, 2025
89ef1ae
fix
Semyon1104 Oct 29, 2025
cc68ec8
clean ci.yml
Semyon1104 Oct 29, 2025
a4ce91e
rename files
Semyon1104 Oct 29, 2025
cfd1d58
Merge branch 'Semyon1104/IntegrateOneDNN' of https://github.com/embed…
Semyon1104 Oct 29, 2025
3566fd4
try macos
Semyon1104 Oct 29, 2025
c6ac48e
macos
Semyon1104 Oct 29, 2025
24a4934
clean
Semyon1104 Nov 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 124 additions & 40 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
max-size: 2G
- name: Build
run: |
cmake -S . -B build \
cmake -S . -B build -G Ninja \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
key: ccache-${{ github.job }}
- name: Build
run: |
cmake -S . -B build \
cmake -S . -B build -G Ninja \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER=clang \
Expand All @@ -117,20 +117,33 @@ jobs:
submodules: true
- name: Install prerequisites
run: |
brew install libomp
brew install libomp ninja
brew link libomp --overwrite --force
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ccache-${{ github.job }}
- name: Build
run: |
cmake -S . -B build \
OPENMP_PATH=$(brew --prefix libomp)
echo "OpenMP path: $OPENMP_PATH"
cmake -S . -B build -G Ninja \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_FLAGS="-I$(brew --prefix libomp)/include" \
-DCMAKE_CXX_FLAGS="-I$(brew --prefix libomp)/include"
-DCMAKE_PREFIX_PATH=$OPENMP_PATH \
-DCMAKE_INCLUDE_PATH=$OPENMP_PATH/include \
-DCMAKE_LIBRARY_PATH=$OPENMP_PATH/lib \
-DOpenMP_C_FLAGS="-Xclang -fopenmp -I$OPENMP_PATH/include" \
-DOpenMP_CXX_FLAGS="-Xclang -fopenmp -I$OPENMP_PATH/include" \
-DOpenMP_C_LIB_NAMES="omp" \
-DOpenMP_CXX_LIB_NAMES="omp" \
-DOpenMP_omp_LIBRARY="$OPENMP_PATH/lib/libomp.dylib" \
-DCMAKE_EXE_LINKER_FLAGS="-L$OPENMP_PATH/lib -lomp" \
-DCMAKE_SHARED_LINKER_FLAGS="-L$OPENMP_PATH/lib -lomp"
cmake --build build --parallel
env:
LDFLAGS: "-L$(brew --prefix libomp)/lib -lomp"
CPPFLAGS: "-I$(brew --prefix libomp)/include"
- name: Test
run: cmake --build build -t test
env:
Expand Down Expand Up @@ -175,7 +188,7 @@ jobs:
key: ccache-${{ github.job }}
- name: Build and Test
run: |
cmake -S . -B build \
cmake -S . -B build -G Ninja \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_BUILD_TYPE=Release
Expand All @@ -201,7 +214,7 @@ jobs:
max-size: 2G
- name: Build
run: |
cmake -S . -B build \
cmake -S . -B build -G Ninja \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_FLAGS="--coverage" \
Expand All @@ -222,19 +235,46 @@ jobs:
slug: embedded-dev-research/ITLabAI

evaluate-model:
runs-on: ubuntu-latest
needs: [build-linux]
permissions:
contents: write
runs-on: ubuntu-latest
needs: [build-linux]
permissions:
contents: write

steps:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download binary and libs
uses: actions/download-artifact@v4
with:
name: mnist-RELEASE
path: build/

- name: Verify downloaded artifacts
run: |
echo "### Verifying downloaded artifacts ###"
echo "Current directory: $(pwd)"
echo "Build directory contents:"
ls -la build/ || echo "No build directory"
echo "Looking for ACC binary:"
find build/ -name "ACC" -type f 2>/dev/null || echo "ACC not found"
echo "Checking bin directory:"
ls -la build/bin/ 2>/dev/null || echo "No bin directory"

- name: Set binary path
id: set_eval_binary
run: |
echo "EVAL_BINARY=build/bin/ACC" >> $GITHUB_OUTPUT

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, leave this as is. I think this output is redundant and the CI script becomes more fragile due to this. Similar comment is applicable for other modifications of CI scripts. Please, remove debug output here and all temporary workarounds

if [ -f "build/bin/ACC" ]; then
echo "ACC binary found at build/bin/ACC"
echo "EVAL_BINARY=build/bin/ACC" >> $GITHUB_OUTPUT
else
echo "ERROR: ACC binary not found at build/bin/ACC"
echo "Available files:"
find build/ -type f -name "*" 2>/dev/null | head -20
exit 1
fi

- name: Install system dependencies
run: |
sudo apt-get update
Expand All @@ -243,11 +283,14 @@ jobs:
libtbb12 \
libjpeg-dev \
libpng-dev \
libtiff-dev
libtiff-dev \
libopenjp2-7 \
libdnnl3
sudo ldconfig

- name: Generate model JSON
run: |
cd docs && mkdir jsons
cd docs && mkdir -p jsons
cd ..
cd app/Converters
pip install -r requirements.txt
Expand All @@ -273,50 +316,91 @@ jobs:
rm -rf main.zip MNIST_dataset-main
echo "Downloaded $(ls docs/mnist/mnist/test | wc -l) images"

- name: Download binary and libs
uses: actions/download-artifact@v4
with:
name: mnist-RELEASE
path: build/

- name: Prepare environment
run: |
echo "### Preparing environment ###"
echo "Binary path: ${{ steps.set_eval_binary.outputs.EVAL_BINARY }}"

ls -la "${{ steps.set_eval_binary.outputs.EVAL_BINARY }}"
chmod +x "${{ steps.set_eval_binary.outputs.EVAL_BINARY }}"

export LD_LIBRARY_PATH=$PWD/build/bin/opencv_libs:/usr/lib/x86_64-linux-gnu
echo "Final LD_LIBRARY_PATH: $LD_LIBRARY_PATH"

- name: Verify library integrity
run: |
echo "### Library verification ###"
file build/bin/opencv_libs/libopencv_imgcodecs.so.4.12.0 | grep "shared object"
echo "### Library verification ###"
ls -la build/bin/opencv_libs/ || echo "No opencv_libs directory"
file build/bin/opencv_libs/libopencv_imgcodecs.so* 2>/dev/null | head -1 || echo "No opencv_imgcodecs library found"

- name: Run evaluation
- name: Test binary execution
run: |
echo "### Pre-run checks ###"
export LD_LIBRARY_PATH=$PWD/build/bin/opencv_libs:/usr/lib/x86_64-linux-gnu
echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH"

LD_DEBUG=files "${{ steps.set_eval_binary.outputs.EVAL_BINARY }}" --model alexnet_mnist 2> ld_debug.log
echo "### Library loading debug ###"
grep -i "opencv_imgcodecs" ld_debug.log
echo "### Testing binary execution ###"
export LD_LIBRARY_PATH=$PWD/build/bin/opencv_libs:/usr/lib/x86_64-linux-gnu

echo "Binary dependencies:"
ldd "${{ steps.set_eval_binary.outputs.EVAL_BINARY }}" 2>/dev/null || echo "ldd failed"

echo "Testing help command:"
timeout 10s "${{ steps.set_eval_binary.outputs.EVAL_BINARY }}" --help > /dev/null 2>&1 || echo "Help test completed"

"${{ steps.set_eval_binary.outputs.EVAL_BINARY }}" > accuracy.txt
echo "Accuracy: $(cat accuracy.txt)"
- name: Run evaluation
run: |
echo "### Running evaluation ###"
export LD_LIBRARY_PATH=$PWD/build/bin/opencv_libs:/usr/lib/x86_64-linux-gnu
echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH"

echo "### Checking binary execution permissions ###"
ls -la "${{ steps.set_eval_binary.outputs.EVAL_BINARY }}"
file "${{ steps.set_eval_binary.outputs.EVAL_BINARY }}"

echo "### Testing direct execution ###"
set +e
"${{ steps.set_eval_binary.outputs.EVAL_BINARY }}" --version > version_output.txt 2>&1
VERSION_EXIT_CODE=$?
echo "Version command exit code: $VERSION_EXIT_CODE"
cat version_output.txt

"${{ steps.set_eval_binary.outputs.EVAL_BINARY }}" --help > help_output.txt 2>&1
HELP_EXIT_CODE=$?
echo "Help command exit code: $HELP_EXIT_CODE"
cat help_output.txt

echo "### Running MNIST evaluation ###"
mkdir -p docs/mnist/mnist/test

"${{ steps.set_eval_binary.outputs.EVAL_BINARY }}" --model alexnet_mnist > accuracy.txt 2>&1
EVAL_EXIT_CODE=$?
echo "Evaluation exit code: $EVAL_EXIT_CODE"

if [ $EVAL_EXIT_CODE -ne 0 ]; then
echo "Trying without --model parameter..."
"${{ steps.set_eval_binary.outputs.EVAL_BINARY }}" > accuracy.txt 2>&1
EVAL_EXIT_CODE=$?
echo "Fallback evaluation exit code: $EVAL_EXIT_CODE"
fi

echo "### Evaluation output ###"
cat accuracy.txt
set -e

- name: Extract accuracy value
run: |
echo "### Extracting accuracy ###"
ACCURACY=$(grep -oE '[0-9]+\.?[0-9]*%' accuracy.txt | head -1 || echo "0%")
echo "Accuracy: $ACCURACY"
echo "$ACCURACY" > accuracy_value.txt

- name: Update README (master only)
if: github.ref == 'refs/heads/master'
run: |
ACCURACY=$(cat accuracy.txt | sed 's/%//g')
ACCURACY=$(cat accuracy_value.txt | sed 's/%//g')
DATE=$(date '+%Y-%m-%d')

echo "Updating README with:"
echo "Accuracy: $ACCURACY"
echo "Accuracy: $ACCURACY%"
echo "Date: $DATE"

echo "Current README content:"
grep -A 2 -B 2 "ACCURACY_PLACEHOLDER" README.md || echo "Placeholder not found"

sed -i "s/<!--ACCURACY_PLACEHOLDER-->.*<!--END_ACCURACY-->/<!--ACCURACY_PLACEHOLDER-->Accuracy: ${ACCURACY}% (updated: ${DATE})<!--END_ACCURACY-->/" README.md

echo "Updated README content:"
Expand All @@ -333,7 +417,7 @@ jobs:
if git diff-index --quiet HEAD --; then
echo "No changes to commit"
else
git commit -m "[CI] Update accuracy: $(cat accuracy.txt)%"
git commit -m "[CI] Update accuracy: $(cat accuracy_value.txt)"
git push origin master
echo "Changes pushed to master branch"
fi
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
key: ccache-${{ github.job }}
- name: Build
run: |
cmake -S . -B build \
cmake -S . -B build -G Ninja \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER=clang \
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
[submodule "3rdparty/Json"]
path = 3rdparty/Json
url = https://github.com/nlohmann/json
[submodule "3rdparty/oneDNN"]
path = 3rdparty/oneDNN
url = https://github.com/uxlfoundation/oneDNN
2 changes: 2 additions & 0 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
add_subdirectory(googletest)

add_subdirectory(oneDNN)

# Unified TBB Configuration
option(TBB_TEST "Build TBB tests" OFF)
option(TBB_EXAMPLES "Build TBB examples" OFF)
Expand Down
1 change: 1 addition & 0 deletions 3rdparty/oneDNN
Submodule oneDNN added at ceb0d6
1 change: 1 addition & 0 deletions app/Graph/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ target_link_libraries(BuildGraph PUBLIC ${OpenCV_LIBS})
target_link_libraries(BuildGraph PUBLIC reader_lib)
target_link_libraries(BuildGraph PUBLIC TBB_unified)
target_link_libraries(BuildGraph PUBLIC layers_lib)
target_link_libraries(BuildGraph PUBLIC layers_oneDNN_lib)
target_link_libraries(BuildGraph PUBLIC gtest_main)

target_include_directories(BuildGraph PUBLIC ${CMAKE_SOURCE_DIR}/3rdparty/Json/include)
Expand Down
8 changes: 5 additions & 3 deletions app/Graph/acc_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ using namespace it_lab_ai;
int main(int argc, char* argv[]) {
std::string model_name = "alexnet_mnist";
bool parallel = false;

bool onednn = false;
for (int i = 1; i < argc; ++i) {
if (std::string(argv[i]) == "--parallel") {
parallel = true;
} else if (std::string(argv[i]) == "--model" && i + 1 < argc) {
model_name = argv[++i];
} else if (std::string(argv[i]) == "--onednn") {
onednn = true;
}
}

Expand Down Expand Up @@ -78,7 +80,7 @@ int main(int argc, char* argv[]) {
Shape sh({static_cast<size_t>(count_pic), 1, 28, 28});
Tensor t = make_tensor<float>(res, sh);
input = t;
build_graph_linear(input, output, false, parallel);
build_graph_linear(input, output, false, parallel, onednn);
std::vector<std::vector<float>> tmp_output =
softmax<float>(*output.as<float>(), 10);
std::vector<size_t> indices;
Expand Down Expand Up @@ -185,7 +187,7 @@ int main(int argc, char* argv[]) {
it_lab_ai::Tensor output =
it_lab_ai::Tensor(output_shape, it_lab_ai::Type::kFloat);

build_graph(input, output, json_path, false, parallel);
build_graph(input, output, json_path, false, parallel, onednn);
std::vector<std::vector<float>> processed_outputs;
const std::vector<float>& raw_output = *output.as<float>();

Expand Down
Loading
Loading