name: linux-x64-sde
on:
  push:
    branches: [master]
    paths:
    - '.github/workflows/linux-x64-sde.yml'
    - 'CMakeLists.txt'
    - 'cmake/**'
    - 'src/*'
    - 'src/layer/*'
    - 'src/layer/x86/**'
    - 'tests/**'
    - 'tools/**'
    - '!tools/pnnx/**'
    - 'examples/**'
  pull_request:
    branches: [master]
    paths:
    - '.github/workflows/linux-x64-sde.yml'
    - 'CMakeLists.txt'
    - 'cmake/**'
    - 'src/*'
    - 'src/layer/*'
    - 'src/layer/x86/**'
    - 'tests/**'
    - 'tools/**'
    - '!tools/pnnx/**'
    - 'examples/**'
concurrency:
  group: linux-x64-sde-${{ github.ref }}
  cancel-in-progress: true
permissions:
  contents: read

jobs:
  gcc-sde:
    runs-on: ubuntu-24.04
    steps:
    - uses: actions/checkout@v4
    - name: update
      run: sudo apt-get update
    - name: gcc14
      run: sudo apt-get install gcc-14 g++-14
    - name: Setup SDE binaries
      uses: petarpetrovt/setup-sde@v2.4
    - name: build
      env:
        CC: gcc-14
        CXX: g++-14
      run: |
        mkdir build && cd build
        cmake -DNCNN_BUILD_TESTS=ON ..
        cmake --build . -j $(nproc)
    - name: test-p4p
      run: |
        cd build
        TESTS_EXECUTABLE_LOADER=$SDE_PATH/sde64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-p4p;--" ctest --output-on-failure -j $(nproc)
    - name: test-snb
      run: |
        cd build
        TESTS_EXECUTABLE_LOADER=$SDE_PATH/sde64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-snb;--" ctest --output-on-failure -j $(nproc)
    - name: test-hsw
      run: |
        cd build
        TESTS_EXECUTABLE_LOADER=$SDE_PATH/sde64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-hsw;--" ctest --output-on-failure -j $(nproc)
    - name: test-adl
      run: |
        cd build
        TESTS_EXECUTABLE_LOADER=$SDE_PATH/sde64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-adl;--" ctest --output-on-failure -j $(nproc)
    - name: test-arl
      run: |
        cd build
        TESTS_EXECUTABLE_LOADER=$SDE_PATH/sde64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-arl;--" ctest --output-on-failure -j $(nproc)
    - name: test-skx
      run: |
        cd build
        TESTS_EXECUTABLE_LOADER=$SDE_PATH/sde64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-skx;--" ctest --output-on-failure -j $(nproc)
    - name: test-spr
      run: |
        cd build
        TESTS_EXECUTABLE_LOADER=$SDE_PATH/sde64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-spr;--" ctest --output-on-failure -j $(nproc)
    - name: test-gnr
      run: |
        cd build
        TESTS_EXECUTABLE_LOADER=$SDE_PATH/sde64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-gnr;--" ctest --output-on-failure -j $(nproc)
