Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
add tests and nodes (#31)
Browse files Browse the repository at this point in the history
Co-authored-by: Wang,Zhe <zhe1.wang@intel.com>
  • Loading branch information
VincyZhang and zhewang1-intc authored Jan 15, 2024
1 parent ffd5ade commit c031228
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 15 deletions.
11 changes: 0 additions & 11 deletions .github/workflows/cpp-graph-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,6 @@ jobs:
run: |
bash ${{ github.workspace }}/.github/workflows/scripts/prepare_env_with_conda.sh "cpp-graph-test-neural-speed" "3.8"
- name: Binary build
if: 0 == 1
run: |
cd ${{ github.workspace }}
conda activate cpp-graph-test-neural-speed || source activate cpp-graph-test-neural-speed
pip install build --upgrade
pip install -r requirements.txt
python setup.py sdist bdist_wheel
pip install dist/neuralspeed*.whl
pip list
- name: BF16 Benchmark
run: |
cd ${{ github.workspace }}/.github/workflows/scripts/models
Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/unit-test-bestla.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Bestla Unit Test

on:
pull_request:
branches: [main]
paths:
- bestla/**"
- .github/workflows/unit-test-bestla.yml
- '!bestla/README.md'
workflow_dispatch:
inputs:
compiler_version:
description: 'compiler_version'
required: false
type: string
default: '13.1.0'

# If there is a new commit, the previous jobs will be canceled
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
INPUT_COMPILER_VERSION: ${{ inputs.compiler_version || '13.1.0' }}
WORKING_DIR: ${{ github.workspace }}

jobs:
unit-test:
runs-on: [self-hosted, linux, X64, spr]
steps:
- name: Checkout out Repo
uses: actions/checkout@v3
with:
submodules: "recursive"
fetch-tags: true

- name: Env build
run: |
echo "do not need conda env"
#bash ${{ github.workspace }}/.github/workflows/scripts/prepare_env_with_conda.sh "unit-test-bestla" "3.8"
#conda activate unit-test-bestla || source activate unit-test-bestla
#if [[ "${{ env.INPUT_COMPILER_VERSION }}" != "11.4.1" ]]; then
# conda install --update-deps -c conda-forge gxx==${{ env.INPUT_COMPILER_VERSION }} gcc==${{ env.INPUT_COMPILER_VERSION }} gxx_linux-64==${{ env.INPUT_COMPILER_VERSION }} libstdcxx-ng sysroot_linux-64 -y
#fi
- name: Run UT
run: |
source /opt/rh/gcc-toolset-12/enable
#conda activate unit-test-bestla || source activate unit-test-bestla
#export LD_LIBRARY_PATH=${HOME}/miniconda3/envs/${conda_env}/lib/:$LD_LIBRARY_PATH
cd ${{ github.workspace }}/bestla && mkdir build && cd build && cmake .. -DBTLA_UT_ALL=ON && make -j
./bestla_ut 2>&1 | tee unit_test_bestla.log
- name: Check Result
run: |
if [[ $(grep -c "No such file or directory" ${{ github.workspace }}/bestla/build/unit_test_bestla.log) != 0 ]]; then
echo "neural-speed Compile Failed"
exit 1
fi
if [[ $(grep -c "Case Failed" ${{ github.workspace }}/bestla/build/unit_test_bestla.log) != 0 ]]; then
echo "UT Failed! Please check UT log."
exit 1
fi
- name: Publish pipeline artifact
uses: actions/upload-artifact@v3
if: ${{ !cancelled() }}
with:
name: Bestla Unit Test
path: ${{ github.workspace }}/bestla/build/unit_test*.*
4 changes: 2 additions & 2 deletions bestla/bestla/ut/bestla_ut.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ static int8_t cache[CacheSize];
#define FP16_ERR 0.001f
#define BF16_ERR 0.02f
#define INT8_ERR 0.2f
#define F8_ERR 1.2f
#define INT4_ERR 2.f
#define F8_ERR 1.4f
#define INT4_ERR 3.f
#define FP4_ERR 3.f

static inline float get_ut_err(BTLA_DTYPE qtype) {
Expand Down
4 changes: 2 additions & 2 deletions bestla/bestla/ut/kernel_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class UT_PaddingInterleaveMN {
src.data(), ref.data(), row, col, row_pad, col_pad, row_pad, col);
kernel::wrapper::PaddingInterleaveMN<NTile, RowPack>::template forward<BTLA_ISA::AVX512_FP16>(
src.data(), dst.data(), row, col, row_pad, col_pad, col, row_pad);
ut::buffer_error(dst.data(), ref.data(), dst.size());
ut::buffer_error(dst.data(), ref.data(), dst.size(), T_DST(100));
}
};
#ifdef BTLA_UT_KERNEL_WRAPPER
Expand Down Expand Up @@ -161,7 +161,7 @@ class UT_PaddingTransInterleaveMN {
src.data(), ref.data(), row, col, row_pad, col_pad, row_pad, col);
kernel::wrapper::PaddingTransInterleaveMN<MTile, ColPack>::template forward<BTLA_ISA::AVX512_FP16>(
src.data(), dst.data(), row, col, row_pad, col_pad, col, row_pad);
ut::buffer_error(dst.data(), ref.data(), dst.size());
ut::buffer_error(dst.data(), ref.data(), dst.size(), T_DST(100));
}
};
#ifdef BTLA_UT_KERNEL_WRAPPER
Expand Down

0 comments on commit c031228

Please sign in to comment.