Skip to content

Commit

Permalink
Merge pull request #322 from PietroGhg/pietro/update_30_jan
Browse files Browse the repository at this point in the history
Update sycl_native_experimental branch
  • Loading branch information
PietroGhg authored Jan 30, 2024
2 parents a5ec372 + 542ee12 commit 558b76c
Show file tree
Hide file tree
Showing 935 changed files with 16,032 additions and 10,862 deletions.
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ IncludeCategories:
- Regex: '.*'
Priority: 3
DerivePointerAlignment: false
QualifierAlignment: Left
PointerAlignment: Right
...
30 changes: 30 additions & 0 deletions .github/actions/build_portBLAS_action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: build-portBLAS
description: Action to clone and build portBLAS using oneAPI

inputs:
workspace:
description: 'Main workflow workspace'
default: ${{ github.workspace }}

runs:
# We don't want a new docker just a list of steps, so mark as composite
using: "composite"
steps:
- name: Clone portBLAS
shell: bash
run: git clone --recursive https://github.com/codeplaysoftware/portBLAS

- name: Set up Environment and Build portBLAS
shell: bash
run: |
ls
export LD_LIBRARY_PATH=${{ inputs.workspace }}/linux_nightly_release/lib:$LD_LIBRARY_PATH
export CMAKE_CXX_COMPILER=${{ inputs.workspace }}/linux_nightly_release/bin/clang++
export CMAKE_C_COMPILER=${{ inputs.workspace }}/linux_nightly_release/bin/clang
export OCL_ICD_FILENAMES=${{ inputs.workspace }}/install/lib/libCL.so
export CXX=${{ inputs.workspace }}/linux_nightly_release/bin/clang++
# Note: With default options enabled, portBLAS supports complex math using
# <ext/oneapi/experimental/sycl_complex.hpp>. It was removed in DPC++ in 0b5757bf.
# To disable this -DBLAS_ENABLE_COMPLEX=OFF needs to added to cmake command line.
cmake -B portBLAS_build_dir portBLAS -GNinja -DSYCL_COMPILER=dpcpp -DBLAS_ENABLE_COMPLEX=OFF
ninja -C $(pwd)/portBLAS_build_dir
27 changes: 27 additions & 0 deletions .github/actions/build_portDNN_action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: build-portDNN
description: Action to clone and build portDNN using oneAPI

inputs:
workspace:
description: 'Main workflow workspace'
default: ${{ github.workspace }}

runs:
# We don't want a new docker just a list of steps, so mark as composite
using: "composite"
steps:
- name: Clone portDNN
shell: bash
run: git clone --recursive https://github.com/codeplaysoftware/portDNN.git

- name: Set up Environment and build portDNN
shell: bash
run: |
ls
export LD_LIBRARY_PATH=${{ inputs.workspace }}/linux_nightly_release/lib:$LD_LIBRARY_PATH
export CMAKE_CXX_COMPILER=${{ inputs.workspace }}/linux_nightly_release/bin/clang++
export CMAKE_C_COMPILER=${{ inputs.workspace }}/linux_nightly_release/bin/clang
export OCL_ICD_FILENAMES=${{ inputs.workspace }}/install/lib/libCL.so
cmake -B portDNN_build_dir portDNN -GNinja -DCMAKE_CXX_COMPILER=$(pwd)/linux_nightly_release/bin/clang++ -DSNN_BUILD_BENCHMARKS=OFF -DSNN_BENCH_SYCLBLAS=OFF -DSNN_BUILD_DOCUMENTATION=OFF
ninja -C portDNN_build_dir
90 changes: 90 additions & 0 deletions .github/actions/build_vgg_resnet_action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Setup and build networks; VGG16, Resnet50
description: Build and run VGG16 and Resnet50 with oneAPI base toolkit and oneAPI-Construction-Kit

inputs:
workspace:
description: 'Main workflow workspace'
default: ${{ github.workspace }}

runs:
# We don't want a new docker just a list of steps, so mark as composite
using: "composite"
steps:
- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: Install Python libraries and system dependencies
shell: bash
run: |
pip install --user requests numpy h5py Pillow
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install -y libblas-dev libopenblas64-dev libopenblas-dev libpthread-stubs0-dev libboost-all-dev
- name: Clone portDNN
shell: bash
run: git clone --recursive --depth 1 --single-branch https://github.com/codeplaysoftware/portDNN.git

- name: Download Daily Release
shell: bash
run: |
wget "https://github.com/intel/llvm/releases/download/nightly-2023-12-18/sycl_linux.tar.gz"
mkdir linux_nightly_release
tar -xzf sycl_linux.tar.gz -C linux_nightly_release
- name: Download Image for testing
shell: bash
run: |
wget https://upload.wikimedia.org/wikipedia/commons/8/8d/Labrador_Retriever_Molly.jpg
- name: Set up environment and build networks
shell: bash
run: |
export LD_LIBRARY_PATH=${{ inputs.workspace }}/install/lib:${{ inputs.workspace }}/linux_nightly_release/lib/libsycl.so:${{ inputs.workspace }}/linux_nightly_release/lib:$LD_LIBRARY_PATH
export CMAKE_CXX_COMPILER=${{ inputs.workspace }}/linux_nightly_release/bin/clang++
export CMAKE_C_COMPILER=${{ inputs.workspace }}/linux_nightly_release/bin/clang
export CA_HAL_DEBUG=1
export CA_PROFILE_LEVEL=3
export ONEAPI_DEVICE_SELECTOR=opencl:acc
export OCL_ICD_FILENAMES=${{ inputs.workspace }}/install/lib/libCL.so
# As the oneAPI basetoolkit release has a whitelist of devices, it filters out RefSi.
# To override it, as a temporary solution we can point SYCL_CONFIG_FILE_NAME to ``.
# This way it doesn't set the default sycl.conf.
export SYCL_CONFIG_FILE_NAME=""
export portDNN_source=$(pwd)/portDNN
export OCL_ICD_VENDORS=/dev/null
# VGG16
mkdir vdata
cd vdata
wget --no-verbose https://storage.googleapis.com/tensorflow/keras-applications/vgg16/vgg16_weights_tf_dim_ordering_tf_kernels.h5
python $portDNN_source/samples/networks/vgg/h5toBin.py vgg16_weights_tf_dim_ordering_tf_kernels.h5
cd ..
# Resnet50
mkdir rdata
cd rdata
wget --no-verbose https://storage.googleapis.com/tensorflow/keras-applications/resnet/resnet50_weights_tf_dim_ordering_tf_kernels.h5
python $portDNN_source/samples/networks/resnet50/h5toBin.py resnet50_weights_tf_dim_ordering_tf_kernels.h5
cd ..
# Preparing an image
python $portDNN_source/samples/networks/img2bin.py $(pwd)/Labrador_Retriever_Molly.jpg
# Testing on image for VGG16
CA_HAL_DEBUG=1 CA_PROFILE_LEVEL=3 OCL_ICD_FILENAMES=${{ inputs.workspace }}/install/lib/libCL.so ONEAPI_DEVICE_SELECTOR=opencl:acc SYCL_CONFIG_FILE_NAME= ${{ inputs.workspace }}/portDNN_build_dir/samples/networks/vgg/vgg vdata/ $(pwd)/Labrador_Retriever_Molly.jpg.bin
# Testing on image for Resnet50
CA_HAL_DEBUG=1 CA_PROFILE_LEVEL=3 OCL_ICD_FILENAMES=${{ inputs.workspace }}/install/lib/libCL.so ONEAPI_DEVICE_SELECTOR=opencl:acc SYCL_CONFIG_FILE_NAME= ${{ inputs.workspace }}/portDNN_build_dir/samples/networks/resnet50/resnet50 rdata/ $(pwd)/Labrador_Retriever_Molly.jpg.bin
- name: Package artifacts
shell: bash
run: |
tar -cvzf network_artifacts.tar.gz vdata rdata Labrador_Retriever_Molly.jpg Labrador_Retriever_Molly.jpg.bin
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: network_build
path: network_artifacts.tar.gz
4 changes: 4 additions & 0 deletions .github/actions/do_build_ock/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ inputs:
enable_rvv_scalable_VP_vecz_check:
description: "Enable RVV scalable vecz VP check (default OFF)"
default: OFF
install_dir:
description: "Install directory for OCK"
default: install

runs:
# We don't want a new docker just a list of steps, so mark as composite
Expand Down Expand Up @@ -104,6 +107,7 @@ runs:
-DCA_RISCV_ENABLED=${{ inputs.riscv_enabled }}
-DCA_CL_ENABLE_RVV_SCALABLE_VECZ_CHECK=${{ inputs.enable_rvv_scalable_vecz_check }}
-DCA_CL_ENABLE_RVV_SCALABLE_VP_VECZ_CHECK=${{ inputs.enable_rvv_scalable_vp_vecz_check }}
-DCMAKE_INSTALL_PREFIX=${{ inputs.install_dir }}
${{ inputs.extra_flags }}
.
- name: build_ock
Expand Down
4 changes: 4 additions & 0 deletions .github/actions/do_build_ock/do_build_m1/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ inputs:
build_type:
description: 'build type (Release, ReleaseAssert)'
default: ReleaseAssert
extra_flags:
description: 'any additional flags'
default: ''

runs:
# We don't want a new docker just a list of steps, so mark as composite
Expand All @@ -20,3 +23,4 @@ runs:
riscv_enabled: ON
enable_rvv_scalable_vecz_check: ON
enable_rvv_scalable_VP_vecz_check: ON
extra_flags: ${{ inputs.extra_flags }}
98 changes: 98 additions & 0 deletions .github/workflows/create_publish_artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Build and Package
on:
push:
branches:
- stable
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:

# build and run for RISCV
run_riscv_m1_nightly_package:
runs-on: ubuntu-22.04

env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}

steps:
- name: Checkout repo
uses: actions/checkout@v3

# installs tools, ninja, installs llvm and sets up sccache
- name: Setup ubuntu
uses: ./.github/actions/setup_ubuntu_build
with:
llvm_version: 17
llvm_build_type: Release

- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: Build riscv M1
uses: ./.github/actions/do_build_ock/do_build_m1
with:
build_type: Release
extra_flags: '-DCA_REFSI_M1_DEMO_MODE=ON'

- name: Create OCK install
run: |
ninja -C $(pwd)/build install
- name: Download Daily Release
run: |
# TODO: Update the nightly release from intel/llvm from 2023-12-18 to daily once
# everything has stablised
wget "https://github.com/intel/llvm/releases/download/nightly-2023-12-18/sycl_linux.tar.gz"
mkdir linux_nightly_release
tar -xzf sycl_linux.tar.gz -C linux_nightly_release
- name: Clone oneAPI-samples
run: git clone https://github.com/oneapi-src/oneAPI-samples.git

- name: Setup environment and test Vector Add
run: |
export ONEAPI_ROOT=$(pwd)/linux_nightly_release
export PATH=$(pwd)/linux_nightly_release/bin:$PATH
export LD_LIBRARY_PATH=$(pwd)/linux_nightly_release/lib:$(pwd)/install/lib:$LD_LIBRARY_PATH
$(pwd)/linux_nightly_release/bin/clang++ -fsycl $(pwd)/oneAPI-samples/DirectProgramming/C++SYCL/DenseLinearAlgebra/vector-add/src/vector-add-buffers.cpp -o vect
CA_RISCV_DUMP_IR=1 CA_HAL_DEBUG=1 OCL_ICD_FILENAMES=$(pwd)/install/lib/libCL.so ONEAPI_DEVICE_SELECTOR=opencl:acc SYCL_CONFIG_FILE_NAME="" ./vect
- name: Package Artifacts
run: |
tar -czf ock_install.tar.gz install
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: riscv-build
path: ock_install.tar.gz

- name: Compute tag
id: tag
run: |
if [ "${{ github.event_name == 'schedule' }}" == "true" ]; then
echo "TAG=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"
else
# TODO: Use date of the commit?
echo "TAG=$(date +'%Y-%m-%d')-${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
fi
- name: Create OCK pre-release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
files:
ock_install.tar.gz
tag_name: nightly-${{ steps.tag.outputs.TAG }}
name: OCK daily ${{ steps.tag.outputs.TAG }}
prerelease: true
body: "Daily build ${{ steps.tag.outputs.TAG }}"
target_commitish: ${{ github.sha }}
Loading

0 comments on commit 558b76c

Please sign in to comment.