Skip to content

Commit

Permalink
Add dpc++ build to github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
coldav committed Nov 29, 2024
1 parent 65036b8 commit 1b893f5
Show file tree
Hide file tree
Showing 7 changed files with 303 additions and 19 deletions.
87 changes: 87 additions & 0 deletions .github/actions/do_build_dpcpp/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: build dpc++
description: build dpc++

inputs:
target:
description: 'target architecture'

runs:
using: "composite"
steps:
- name: calc vars
id: calc_vars
uses: ./.github/actions/calc_vars
with:
target: ${{ inputs.target }}

- name: Install Ninja
uses: llvm/actions/install-ninja@main

- name: Install spirv tools
shell: bash
run:
sudo apt-get install spirv-tools

- name: clone dpc++
uses: actions/checkout@v4
with:
repository: intel/llvm
path: llvm

- name: dpcpp configure
shell: bash
run:
cd llvm; python buildbot/configure.py
-o build
--host-target="X86;AArch64;RISCV"
--native_cpu
--llvm-external-projects=lld
--cmake-opt=-DNATIVECPU_USE_OCK=ON
--cmake-opt=-DLLVM_ENABLE_ZLIB=OFF
--cmake-opt=-DLLVM_ENABLE_ZSTD=OFF
- name: build sycl-headers
shell: bash
run:
cmake --build llvm/build -- sycl-headers

- name: build dpc plus plus
shell: bash
run:
python llvm/buildbot/compile.py -o llvm/build -v -j 8

- name: build extra utilties
# Build various utilities, since those aren't proper dependencies.
# FileCheck and not are needed for tests. The rest are needed for
# cross builds. They are enabled on all targets for consistency.
shell: bash
run:
cmake --build llvm/build -- FileCheck clang-tblgen
libclc-remangler llvm-as llvm-min-tblgen llvm-tblgen not
opt prepare_builtins -j8
- name: copy utilities
shell: bash
run:
cd llvm/build/bin;
cp FileCheck clang-tblgen libclc-remangler llvm-as llvm-min-tblgen
llvm-tblgen not opt prepare_builtins ../install/bin

- name: install config files to pick up libraries for cross compilation.
shell: bash
run: |
echo Installing configuration files
cd llvm/build/bin
# Install configuration files to pick up libraries for cross compilation.
for arch in x86_64 aarch64 riscv64; do
echo "
-L<CFGDIR>/../../../$arch-linux/install/lib
-fsycl-libdevice-path=<CFGDIR>/../../../$arch-linux/install/lib
-fsycl-libspirv-path=<CFGDIR>/../../../$arch-linux/install/lib/clc/remangled-l64-signed_char.libspirv-$arch-unknown-linux-gnu.bc
" >../install/bin/$arch-unknown-linux-gnu.cfg;
done
- name: upload dpcpp artifact
uses: actions/upload-artifact@v4
with:
name: dpcpp_${{inputs.target}}
path: llvm/build/install
retention-days: 1
71 changes: 71 additions & 0 deletions .github/actions/do_build_sycl_cts/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: build sycl cts
description: build sycl cts

inputs:
target:
description: 'target architecture'

runs:
using: "composite"
steps:
- name: calc vars
id: calc_vars
uses: ./.github/actions/calc_vars
with:
target: ${{ inputs.target }}

- name: Install Ninja
uses: llvm/actions/install-ninja@main

- name: download icd artifact
uses: actions/download-artifact@v4
with:
name: icd_${{inputs.target}}
path: install_icd

- name: download headers artifact
uses: actions/download-artifact@v4
with:
name: headers_${{inputs.target}}
path: install_headers

- name: download dpc++ artifact
uses: actions/download-artifact@v4
with:
name: dpcpp_${{inputs.target}}
path: install_dpcpp

- name: checkout sycl cts
uses: actions/checkout@v4
with:
repository: KhronosGroup/SYCL-CTS
path: SYCL-CTS.src

-name: build SYCL CTS
shell: bash
run: |
# Todo: as we extend into cross etc, we may want to expand on the cxx flags
# We build SYCL-CTS without installing it, so build directly in the top level.
cd SYCL-CTS.src
git -C SYCL-CTS.src log -1
# git -C SYCL-CTS.src apply $CI_PROJECT_DIR/patches/SYCL-CTS-0002-Permit-building-for-unknown-architectures.patch
cd ..
cmake -S SYCL-CTS.src \
-GNinja \
-B SYCL-CTS \
-DSYCL_IMPLEMENTATION=DPCPP \
-DDPCPP_INSTALL_DIR=$GITHUB_WORKSPACE/install_dpcpp \
-DOpenCL_LIBRARY=$GITHUB_WORKSPACE/install_icd/lib/libOpenCL.so \
-DOpenCL_INCLUDE_DIR=$GITHUB_WORKSPACE/install_headers/include \
-DCMAKE_CXX_COMPILER="$GITHUB_WORKSPACE/install_dpcpp/bin/clang++" \
-DCMAKE_CXX_FLAGS="--target=${{steps.calc_vars.outputs.arch}}-linux-gnu" \
-DCMAKE_CXX_LINK_FLAGS="-fuse-ld=lld"
ninja -C SYCL-CTS -v -j8 -k 0 || :
- name: upload artefact
uses: actions/upload-artifact@v4
with:
name: sycl_cts_${{inputs.target}}
path: SYCL-CTS/bin/**
retention-days: 1

63 changes: 63 additions & 0 deletions .github/actions/run_sycl_cts/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: run sycl cts
description: run sycl cts

inputs:
target:
description: 'target architecture'

runs:
using: "composite"
steps:
- name: calc vars
id: calc_vars
uses: ./.github/actions/calc_vars
with:
target: ${{ inputs.target }}

- name: Install Ninja
uses: llvm/actions/install-ninja@main

- name: download ock artifact
uses: actions/download-artifact@v4
with:
name: ock_${{inputs.target}}
path: install_ock

- name: download headers artifact
uses: actions/download-artifact@v4
with:
name: headers_${{inputs.target}}
path: install_headers

- name: download dpc++ artifact
uses: actions/download-artifact@v4
with:
name: dpcpp_${{inputs.target}}
path: install_dpcpp

- name: run sycl cts
shell: bash
run: |
# TODO: have qemu as input and set up this
export PREPEND_PATH=
echo running sycl cts
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/install_dpcpp/lib:$GITHUB_WORKSPACE/install_ock/lib
export ONEAPI_DEVICE_SELECTOR=opencl:0
python $GITHUB_WORKSPACE/scripts/testing/run_cities.py \
--color=always \
--timeout $SYCL_CTS_TIMEOUT \
$PREPEND_PATH \
-p sycl_cts \
-b SYCL-CTS/bin \
-L SYCL-CTS/lib \
-e OCL_ICD_FILENAMES=$GITHUB_WORKSPACE/install_ock/lib/libCL.so \
-s "$GITHUB_WORKSPACE/.github/scripts/sycl-cts.csv" \
-l SYCL-CTS/cts.log -f SYCL-CTS/cts.fail \
-r SYCL-CTS/cts.xml \
-v \
$SYCL_CTS_FILTER || exitcode=$?
export OCL_ICD_FILENAMES=$CA_INSTALL_DIR/lib/libCL.so
#$GITHUB_WORKSPACE/scripts/create_sycl_cts_test_lists.sh $[[ inputs.prepend_path ]] SYCL-CTS "$CTS_CSV_FILE" csv.txt cts_all.txt
# output a diff of the generated list csv.txt and cts_all.txt
# - diff csv.txt cts_all.txt || echo "WARNING - Missing some tests from sycl cts file based on test_all --list-tests - see > above"
exit $exitcode
28 changes: 14 additions & 14 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ on:
push:
branches:
- main
pull_request:
branches:
- main
paths:
- 'source/**'
- 'clik/**'
- 'modules/**'
- 'examples/**'
- 'cmake/**'
- 'hal/**'
- '.github/actions/do_build_ock/**'
- '.github/actions/setup_build/**'
- '.github/workflows/codeql.yml'
- 'CMakeLists.txt'
# pull_request:
# branches:
# - main
# paths:
# - 'source/**'
# - 'clik/**'
# - 'modules/**'
# - 'examples/**'
# - 'cmake/**'
# - 'hal/**'
# - '.github/actions/do_build_ock/**'
# - '.github/actions/setup_build/**'
# - '.github/workflows/codeql.yml'
# - 'CMakeLists.txt'
schedule:
- cron: '19 9 * * 3'

Expand Down
62 changes: 60 additions & 2 deletions .github/workflows/planned_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ on:
test_tornado:
required: false
type: boolean
default: true
default: true
test_sycl_cts:
required: false
type: boolean
default: true
target_list:
required: false
type: string
Expand Down Expand Up @@ -66,7 +70,7 @@ jobs:

build_icd:
# Will also be required for opencl
if: inputs.test_tornado
if: inputs.test_tornado || inputs.test_sycl_cts
needs: [workflow_vars]
strategy:
matrix:
Expand Down Expand Up @@ -114,3 +118,57 @@ jobs:
uses: ./.github/actions/run_tornado
with:
target: ${{ matrix.target }}

build_dpcpp_native_host:
needs: [workflow_vars]
strategy:
matrix:
target: ${{ fromJson(inputs.target_list) }}
exclude: ${{ fromJson(needs.workflow_vars.outputs.matrix_only_linux_x86_64) }}

runs-on: ${{ contains(matrix.target, 'windows') && 'windows-2019' || 'ubuntu-22.04' }}
if : inputs.test_sycl_cts
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: build dpc++ artefact
uses: ./.github/actions/do_build_dpcpp
with:
target: ${{ matrix.target }}
llvm_version: ${{ inputs.llvm_version }}

build_sycl_cts:
needs: [workflow_vars, build_icd, build_dpcpp_native_host]
strategy:
matrix:
target: ${{ fromJson(inputs.target_list) }}
# For now just linux x86_64
exclude: ${{ fromJson(needs.workflow_vars.outputs.matrix_only_linux_x86_64) }}

runs-on: 'ubuntu-22.04'
if : inputs.test_sycl_cts
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: build dpc++ artefact
uses: ./.github/actions/do_build_sycl_cts
with:
target: ${{ matrix.target }}

run_sycl_cts:
needs: [workflow_vars, build_ock, build_dpcpp_native_host, build_sycl_cts_native_host]
strategy:
matrix:
target: ${{ fromJson(inputs.target_list) }}
# For now just linux x86_64
exclude: ${{ fromJson(needs.workflow_vars.outputs.matrix_only_linux_x86_64) }}

runs-on: 'ubuntu-22.04'
if : inputs.test_sycl_cts
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: build dpc++ artefact
uses: ./.github/actions/run_sycl_cts
with:
target: ${{ matrix.target }}
8 changes: 6 additions & 2 deletions .github/workflows/planned_testing_caller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ jobs:
if: github.repository == 'uxlfoundation/oneapi-construction-kit' || github.event_name != 'schedule'
uses: ./.github/workflows/planned_testing.yml
with:
target_list: '["host_x86_64_linux", "host_aarch64_linux", "host_riscv64_linux", "host_i686_linux", "host_refsi_linux", "host_x86_64_windows" ]'
test_tornado: true
# target_list: '["host_x86_64_linux", "host_aarch64_linux", "host_riscv64_linux", "host_i686_linux", "host_refsi_linux", "host_x86_64_windows" ]'
target_list: '["host_x86_64_linux"]'
ock: true
test_tornado: false
test_sycl_cts: true
# true
# Have a pull request setting which can be used to test the flow as best as possible
# in a reasonable time
pull_request: ${{ github.event_name == 'pull_request' }}
3 changes: 2 additions & 1 deletion .github/workflows/run_pr_tests_caller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ concurrency:
jobs:
run-with-pull:
name: Call PR testing on pull request
if: ${{ github.event_name == 'pull_request' }}
if: false
# ${{ github.event_name == 'pull_request' }}
uses: ./.github/workflows/run_pr_tests.yml
with:
update_cache: false
Expand Down

0 comments on commit 1b893f5

Please sign in to comment.