Skip to content

Fix Incorrect output for A or B with dim=1 in GEMM #5301

Fix Incorrect output for A or B with dim=1 in GEMM

Fix Incorrect output for A or B with dim=1 in GEMM #5301

Workflow file for this run

name: macos-x64-gpu
on:
push:
branches: [master]
paths:
- '.github/workflows/macos-x64-gpu.yml'
- 'CMakeLists.txt'
- 'cmake/**'
- 'src/*'
- 'src/layer/*'
- 'src/layer/x86/**'
- 'src/layer/vulkan/**'
- 'tests/**'
- 'tools/**'
- '!tools/pnnx/**'
- 'examples/**'
pull_request:
branches: [master]
paths:
- '.github/workflows/macos-x64-gpu.yml'
- 'CMakeLists.txt'
- 'cmake/**'
- 'src/*'
- 'src/layer/*'
- 'src/layer/x86/**'
- 'src/layer/vulkan/**'
- 'tests/**'
- 'tools/**'
- '!tools/pnnx/**'
- 'examples/**'
concurrency:
group: macos-x64-gpu-${{ github.ref }}
cancel-in-progress: true
env:
DEVELOPER_DIR: /Applications/Xcode_13.4.1.app/Contents/Developer
MAC_DEPLOYMENT_TARGET: '10.9'
MAC_ARM64_DEPLOYMENT_TARGET: '11.0'
ENABLE_BITCODE: OFF
ENABLE_ARC: OFF
ENABLE_VISIBILITY: OFF
permissions:
contents: read
jobs:
macos-clang-gpu:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: protobuf
run: brew install protobuf opencv3
- name: cache-openmp
id: cache-openmp
uses: actions/cache@v3
with:
path: openmp-install
key: openmp-macos-install-20230504
- name: openmp
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/openmp-11.0.0.src.tar.xz
tar -xf openmp-11.0.0.src.tar.xz
cd openmp-11.0.0.src
sed -i'' -e '/.size __kmp_unnamed_critical_addr/d' runtime/src/z_Linux_asm.S
sed -i'' -e 's/__kmp_unnamed_critical_addr/___kmp_unnamed_critical_addr/g' runtime/src/z_Linux_asm.S
- name: openmp-build-x86_64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-11.0.0.src
mkdir -p build-x86_64 && cd build-x86_64
cmake -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake -DPLATFORM=MAC -DARCHS="x86_64" \
-DDEPLOYMENT_TARGET=$MAC_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \
-DPERL_EXECUTABLE=/usr/local/bin/perl \
-DLIBOMP_ENABLE_SHARED=OFF -DLIBOMP_OMPT_SUPPORT=OFF -DLIBOMP_USE_HWLOC=OFF ..
cmake --build . -j 3
cmake --build . --target install
- name: openmp-build-arm64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-11.0.0.src
mkdir -p build-arm64 && cd build-arm64
cmake -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake -DPLATFORM=MAC_ARM64 -DARCHS="arm64" \
-DDEPLOYMENT_TARGET=$MAC_ARM64_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \
-DPERL_EXECUTABLE=/usr/local/bin/perl \
-DLIBOMP_ENABLE_SHARED=OFF -DLIBOMP_OMPT_SUPPORT=OFF -DLIBOMP_USE_HWLOC=OFF ..
cmake --build . -j 3
cmake --build . --target install
- name: openmp-merge-fat-library
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
mkdir -p $GITHUB_WORKSPACE/openmp-install
cp -a openmp-11.0.0.src/build-x86_64/install/include $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install/lib
lipo -create \
openmp-11.0.0.src/build-x86_64/install/lib/libomp.a \
openmp-11.0.0.src/build-arm64/install/lib/libomp.a \
-o $GITHUB_WORKSPACE/openmp-install/lib/libomp.a
- name: install-openmp
run: |
sudo cp $GITHUB_WORKSPACE/openmp-install/include/* $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
sudo cp $GITHUB_WORKSPACE/openmp-install/lib/libomp.a $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib
- name: vulkansdk
run: |
wget https://sdk.lunarg.com/sdk/download/1.3.236.0/mac/vulkansdk-macos-1.3.236.0.dmg?Human=true -O vulkansdk-macos-1.3.236.0.dmg
hdiutil attach vulkansdk-macos-1.3.236.0.dmg
sudo /Volumes/vulkansdk-macos-1.3.236.0/InstallVulkan.app/Contents/MacOS/InstallVulkan --root $GITHUB_WORKSPACE/vulkansdk-macos-1.3.236.0 --accept-licenses --default-answer --confirm-command install
hdiutil detach /Volumes/vulkansdk-macos-1.3.236.0
- name: cache-swiftshader
id: cache-swiftshader
uses: actions/cache@v3
with:
path: swiftshader-install
key: swiftshader-macos-install-20230420
- name: checkout-swiftshader
if: steps.cache-swiftshader.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: google/swiftshader
path: swiftshader
ref: dd55e592406dc0bae219df11adec6363840aff4a
- name: checkout-swiftshader-submodules
if: steps.cache-swiftshader.outputs.cache-hit != 'true'
run: |
cd swiftshader
git -c submodule."third_party/git-hooks".update=none submodule update --init --recursive
- name: swiftshader
if: steps.cache-swiftshader.outputs.cache-hit != 'true'
run: |
cd swiftshader
mkdir -p build; cd build
cmake -DCMAKE_INSTALL_PREFIX=install -DSWIFTSHADER_BUILD_EGL=FALSE -DSWIFTSHADER_BUILD_GLESv2=FALSE -DSWIFTSHADER_BUILD_GLES_CM=FALSE -DSWIFTSHADER_BUILD_VULKAN=TRUE -DSWIFTSHADER_BUILD_PVR=FALSE -DSWIFTSHADER_BUILD_TESTS=FALSE -DSWIFTSHADER_ENABLE_ASTC=FALSE -DSWIFTSHADER_WARNINGS_AS_ERRORS=FALSE -DREACTOR_BACKEND=Subzero -DREACTOR_DEFAULT_OPT_LEVEL=Default -DCMAKE_BUILD_TYPE=Release ..
cmake --build . -j 3
mkdir $GITHUB_WORKSPACE/swiftshader-install
cp Darwin/* $GITHUB_WORKSPACE/swiftshader-install
- name: build
run: |
export VULKAN_SDK=$GITHUB_WORKSPACE/vulkansdk-macos-1.3.236.0/macOS
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake -DPLATFORM=MAC -DARCHS="x86_64" \
-DDEPLOYMENT_TARGET=$MAC_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libomp.a" \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \
-DNCNN_VULKAN=ON -DNCNN_BUILD_TESTS=ON ..
cmake --build . -j 3
- name: test
run: |
printf "[Processor]\nThreadCount=1\n" > build/tests/SwiftShader.ini
export DYLD_LIBRARY_PATH="$GITHUB_WORKSPACE/vulkansdk-macos-1.3.236.0/macOS/lib":$DYLD_LIBRARY_PATH
export VK_ICD_FILENAMES="$GITHUB_WORKSPACE/swiftshader-install/vk_swiftshader_icd.json"
cd build && ctest --output-on-failure -j 3
- name: build-shared
run: |
export VULKAN_SDK=$GITHUB_WORKSPACE/vulkansdk-macos-1.3.236.0/macOS
mkdir build-shared && cd build-shared
cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake -DPLATFORM=MAC -DARCHS="x86_64" \
-DDEPLOYMENT_TARGET=$MAC_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libomp.a" \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \
-DNCNN_VULKAN=ON -DNCNN_SHARED_LIB=ON ..
cmake --build . -j 3