Skip to content

Commit b9bd031

Browse files
committed
merge 'origin/sycl' into przemek/interop-map-memory
2 parents c3baef7 + 47ab963 commit b9bd031

File tree

115 files changed

+2063
-1038
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+2063
-1038
lines changed

.github/docker/ubuntu-22.04.Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ ARG BASE_DEPS="\
3232
ARG UR_DEPS="\
3333
doxygen \
3434
python3 \
35-
python3-pip"
35+
python3-pip \
36+
libhwloc-dev"
3637

3738
# Unified Runtime's dependencies (installed via pip)
3839
ARG UR_PYTHON_DEPS="\

.github/scripts/install_hwloc.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (C) 2024 Intel Corporation
4+
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
5+
# See LICENSE.TXT
6+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
8+
# install_hwloc.sh - Script for building and installing HWLOC library from source code
9+
10+
set -e
11+
12+
git clone -b hwloc-2.3.0 https://github.com/open-mpi/hwloc.git
13+
pushd hwloc
14+
./autogen.sh
15+
./configure
16+
make -j$(nproc)
17+
sudo make install -j$(nproc)
18+
popd

.github/workflows/build-hw-reusable.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ on:
1111
required: false
1212
type: string
1313
default: ""
14+
static_loader:
15+
required: false
16+
type: string
17+
default: OFF
1418

1519
permissions:
1620
contents: read
@@ -29,14 +33,19 @@ jobs:
2933
strategy:
3034
matrix:
3135
adapter: [
32-
{name: "${{inputs.name}}", platform: "${{inputs.platform}}"},
36+
{name: "${{inputs.name}}", platform: "${{inputs.platform}}", static_Loader: "${{inputs.static_loader}}"},
3337
]
3438
build_type: [Debug, Release]
3539
compiler: [{c: gcc, cxx: g++}, {c: clang, cxx: clang++}]
3640
# TODO: The latest L0 loader segfaults when built with clang.
3741
exclude:
3842
- adapter: {name: L0, platform: ""}
3943
compiler: {c: clang, cxx: clang++}
44+
# Exclude these configurations to avoid overloading the runners.
45+
- adapter: {static_Loader: ON}
46+
build_type: Release
47+
- adapter: {static_Loader: ON}
48+
compiler: {c: clang, cxx: clang++}
4049

4150
runs-on: ${{matrix.adapter.name}}
4251

@@ -63,6 +72,7 @@ jobs:
6372
-DUR_DEVELOPER_MODE=ON
6473
-DUR_BUILD_TESTS=ON
6574
-DUR_BUILD_ADAPTER_${{matrix.adapter.name}}=ON
75+
-DUR_STATIC_LOADER=${{matrix.adapter.static_Loader}}
6676
-DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++
6777
-DUR_SYCL_LIBRARY_DIR=${{github.workspace}}/dpcpp_compiler/lib
6878
${{ matrix.adapter.name == 'HIP' && '-DUR_CONFORMANCE_AMD_ARCH=gfx1030' || '' }}

.github/workflows/cmake.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ jobs:
4747
sudo apt-get update
4848
sudo apt-get install -y doxygen ${{matrix.compiler.c}}
4949
50+
- name: Install libhwloc
51+
run: .github/scripts/install_hwloc.sh
52+
5053
- name: Install g++-7
5154
if: matrix.compiler.cxx == 'g++-7'
5255
run: |
@@ -121,13 +124,20 @@ jobs:
121124
uses: ./.github/workflows/build-fuzz-reusable.yml
122125
with:
123126
test_label: "fuzz-short"
124-
127+
125128
level-zero:
126129
name: Level Zero
127130
uses: ./.github/workflows/build-hw-reusable.yml
128131
with:
129132
name: L0
130133

134+
level-zero-static:
135+
name: Level Zero static
136+
uses: ./.github/workflows/build-hw-reusable.yml
137+
with:
138+
name: L0
139+
static_loader: ON
140+
131141
opencl:
132142
name: OpenCL
133143
uses: ./.github/workflows/build-hw-reusable.yml
@@ -217,11 +227,17 @@ jobs:
217227
Expand-Archive -Path "$WorkingDir\doxygen.zip"
218228
Add-Content $env:GITHUB_PATH "$WorkingDir\doxygen"
219229
230+
- name: Install hwloc
231+
run: vcpkg install hwloc:x64-windows
232+
220233
- name: Configure CMake
234+
env:
235+
VCPKG_PATH: "C:/vcpkg/packages/hwloc_x64-windows"
221236
run: >
222237
cmake
223238
-B${{github.workspace}}/build
224239
${{matrix.toolset}}
240+
-DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}"
225241
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
226242
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
227243
-DCMAKE_POLICY_DEFAULT_CMP0094=NEW
@@ -260,6 +276,9 @@ jobs:
260276
- name: Install prerequisites
261277
run: python3 -m pip install -r third_party/requirements.txt
262278

279+
- name: Install hwloc
280+
run: brew install hwloc
281+
263282
- name: Configure CMake
264283
run: >
265284
cmake

.github/workflows/codeql.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ jobs:
3131
- name: Install pip packages
3232
run: pip install -r third_party/requirements.txt
3333

34+
- name: Install apt packages
35+
run: |
36+
sudo apt-get update
37+
sudo apt-get install -y libhwloc-dev
38+
3439
- name: Configure CMake
3540
run: cmake -B ${{github.workspace}}/build -DUR_DEVELOPER_MODE=ON -DUR_BUILD_TESTS=ON -DUR_ENABLE_TRACING=ON -DUR_BUILD_TOOLS=ON -DUMF_ENABLE_POOL_TRACKING=ON
3641

@@ -61,8 +66,13 @@ jobs:
6166
- name: Install pip packages
6267
run: python3 -m pip install -r third_party/requirements.txt
6368

69+
- name: Install hwloc
70+
run: vcpkg install hwloc:x64-windows
71+
6472
- name: Configure CMake
65-
run: cmake -B ${{github.workspace}}/build -DCMAKE_POLICY_DEFAULT_CMP0094=NEW -DUR_DEVELOPER_MODE=ON -DUR_BUILD_TESTS=ON -DUR_ENABLE_TRACING=ON -DUR_BUILD_TOOLS=ON -DUMF_ENABLE_POOL_TRACKING=ON
73+
env:
74+
VCPKG_PATH: "C:/vcpkg/packages/hwloc_x64-windows"
75+
run: cmake -B ${{github.workspace}}/build -DCMAKE_POLICY_DEFAULT_CMP0094=NEW -DUR_DEVELOPER_MODE=ON -DUR_BUILD_TESTS=ON -DUR_ENABLE_TRACING=ON -DUR_BUILD_TOOLS=ON -DUMF_ENABLE_POOL_TRACKING=ON -DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}"
6676

6777
- name: Build
6878
run: cmake --build ${{github.workspace}}/build -j $(nproc) --config Release

.github/workflows/coverity.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ jobs:
3838
- name: Install pip packages
3939
run: pip install -r third_party/requirements.txt
4040

41+
- name: Install apt packages
42+
run: |
43+
sudo apt-get update
44+
sudo apt-get install -y libhwloc-dev
45+
4146
- name: Configure CMake
4247
run: >
4348
cmake

.github/workflows/e2e_core.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ jobs:
6565
with:
6666
files: |
6767
source/adapters/${{inputs.str_name}}/**
68+
source/loader/**
6869
6970
e2e-build-hw:
7071
# We want to run the job only if there are changes in the specific adapter

.github/workflows/e2e_level_zero.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ jobs:
2121
config: ""
2222
unit: "gpu"
2323
# Failing tests
24-
xfail: "ESIMD/regression/minmax.cpp;ESIMD/preemption.cpp;Matrix/SG32/element_wise_all_ops.cpp;Matrix/SG32/get_coord_int8_matB.cpp;Matrix/element_wise_all_ops.cpp;Matrix/element_wise_all_ops_1d.cpp;Matrix/element_wise_all_ops_1d_cont.cpp;Matrix/element_wise_all_ops_scalar.cpp;Matrix/element_wise_ops.cpp;Matrix/get_coord_int8_matB.cpp;Matrix/joint_matrix_apply_bf16.cpp;Matrix/joint_matrix_apply_two_matrices.cpp;Matrix/joint_matrix_bfloat16.cpp;Matrix/joint_matrix_bfloat16_array.cpp;Matrix/joint_matrix_rowmajorA_rowmajorB.cpp;ProgramManager/uneven_kernel_split.cpp"
24+
xfail: "Matrix/SG32/get_coord_int8_matB.cpp;Matrix/element_wise_all_ops_1d.cpp;Matrix/element_wise_all_ops_1d_cont.cpp;Matrix/element_wise_all_ops_scalar.cpp;Matrix/get_coord_int8_matB.cpp;Matrix/joint_matrix_rowmajorA_rowmajorB.cpp;Plugin/level_zero_barrier_optimization.cpp"
2525
# Flaky tests
2626
filter_out: "UserDefinedReductions/user_defined_reductions.cpp"
2727
# These runners by default spawn upwards of 260 workers.
2828
# We also add a time out just in case some test hangs
29-
extra_lit_flags: "-sv -j 100 --max-time 600"
29+
extra_lit_flags: "--param gpu-intel-pvc=True -sv -j 100 --max-time 600"

.github/workflows/multi_device.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
name: Multi Device testing
3+
4+
on: [push, pull_request]
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
8+
cancel-in-progress: true
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
examples:
15+
name: Multi Device testing
16+
if: github.repository == 'oneapi-src/unified-runtime' # run only on upstream; forks won't have the HW
17+
strategy:
18+
matrix:
19+
adapter: [
20+
{name: L0}
21+
]
22+
build_type: [Debug, Release]
23+
compiler: [{c: gcc, cxx: g++}] # TODO: investigate why memory-adapter-level_zero hangs with clang
24+
25+
runs-on: "${{matrix.adapter.name}}_2T"
26+
27+
steps:
28+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
29+
30+
- name: Install pip packages
31+
run: pip install -r third_party/requirements.txt
32+
33+
# TODO: enable once test failure are fixed/ignored
34+
# - name: Download DPC++
35+
# run: |
36+
# wget -O ${{github.workspace}}/dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/nightly-2024-01-29/sycl_linux.tar.gz
37+
# mkdir dpcpp_compiler
38+
# tar -xvf ${{github.workspace}}/dpcpp_compiler.tar.gz -C dpcpp_compiler
39+
40+
- name: Configure CMake
41+
shell: bash -el {0}
42+
run: >
43+
cmake
44+
-B${{github.workspace}}/build
45+
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
46+
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
47+
-DCMAKE_BUILD_TYPE=${{matrix.build_type}}
48+
-DUR_DEVELOPER_MODE=ON
49+
-DUR_BUILD_TESTS=ON
50+
-DUR_BUILD_ADAPTER_${{matrix.adapter.name}}=ON
51+
-DUR_TEST_DEVICES_COUNT=2
52+
53+
- name: Build
54+
run: cmake --build ${{github.workspace}}/build -j $(nproc)
55+
56+
- name: Test adapter specific
57+
working-directory: ${{github.workspace}}/build
58+
run: ctest -C ${{matrix.build_type}} --output-on-failure -L "adapter-specific" -E "test-adapter-level_zero_multi_queue" --timeout 180
59+
# TODO: investigate why test-adapter-level_zero_multi_queue fails on newer driver
60+
61+
- name: Test adapters
62+
working-directory: ${{github.workspace}}/build
63+
run: env UR_CTS_ADAPTER_PLATFORM="${{matrix.adapter.platform}}" ctest -C ${{matrix.build_type}} --output-on-failure -L "conformance" --timeout 180

CMakeLists.txt

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
cmake_minimum_required(VERSION 3.20.0 FATAL_ERROR)
77
project(unified-runtime VERSION 0.10.0)
88

9+
# Check if unified runtime is built as a standalone project.
10+
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR UR_STANDALONE_BUILD)
11+
set(UR_STANDALONE_BUILD TRUE)
12+
endif()
13+
914
include(GNUInstallDirs)
1015
include(CheckCXXSourceCompiles)
1116
include(CMakePackageConfigHelpers)
@@ -37,7 +42,8 @@ option(UR_USE_MSAN "enable MemorySanitizer" OFF)
3742
option(UR_USE_TSAN "enable ThreadSanitizer" OFF)
3843
option(UR_ENABLE_TRACING "enable api tracing through xpti" OFF)
3944
option(UR_ENABLE_SANITIZER "enable device sanitizer" ON)
40-
option(UMF_BUILD_SHARED_LIBRARY "Build UMF as shared library" OFF)
45+
option(UR_ENABLE_SYMBOLIZER "enable symoblizer for sanitizer" OFF)
46+
option(UMF_BUILD_SHARED_LIBRARY "Build UMF as shared library" ON)
4147
option(UMF_ENABLE_POOL_TRACKING "Build UMF with pool tracking" ON)
4248
option(UR_BUILD_ADAPTER_L0 "Build the Level-Zero adapter" OFF)
4349
option(UR_BUILD_ADAPTER_OPENCL "Build the OpenCL adapter" OFF)
@@ -49,6 +55,7 @@ option(UR_BUILD_EXAMPLE_CODEGEN "Build the codegen example." OFF)
4955
option(VAL_USE_LIBBACKTRACE_BACKTRACE "enable libbacktrace validation backtrace for linux" OFF)
5056
option(UR_ENABLE_ASSERTIONS "Enable assertions for all build types" OFF)
5157
option(UR_BUILD_XPTI_LIBS "Build the XPTI libraries when tracing is enabled" ON)
58+
option(UR_STATIC_LOADER "Build loader as a static library" OFF)
5259
set(UR_DPCXX "" CACHE FILEPATH "Path of the DPC++ compiler executable")
5360
set(UR_DPCXX_BUILD_FLAGS "" CACHE STRING "Build flags to pass to DPC++ when compiling device programs")
5461
set(UR_SYCL_LIBRARY_DIR "" CACHE PATH
@@ -134,6 +141,15 @@ if(UR_ENABLE_TRACING)
134141
set_target_properties(xptifw PROPERTIES
135142
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
136143
)
144+
145+
if (UR_STATIC_LOADER)
146+
install(TARGETS xpti xptifw
147+
EXPORT ${PROJECT_NAME}-targets
148+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
149+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
150+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
151+
)
152+
endif()
137153
endif()
138154

139155
if (MSVC)
@@ -153,6 +169,14 @@ if(UR_ENABLE_SANITIZER)
153169
else()
154170
add_compile_definitions(UR_ENABLE_SANITIZER)
155171
endif()
172+
173+
if(UR_ENABLE_SYMBOLIZER AND UR_STANDALONE_BUILD)
174+
find_package(LLVM REQUIRED)
175+
endif()
176+
else()
177+
if(UR_ENABLE_SYMBOLIZER)
178+
message(FATAL_ERROR "Symbolizer must be enabled with Sanitizer layer")
179+
endif()
156180
endif()
157181

158182
if(UR_USE_ASAN)
@@ -179,7 +203,7 @@ endif()
179203
if(UR_FORMAT_CPP_STYLE)
180204
find_program(CLANG_FORMAT NAMES clang-format-15 clang-format-15.0 clang-format)
181205

182-
if(CLANG_FORMAT)
206+
if(CLANG_FORMAT)
183207
get_program_version_major_minor(${CLANG_FORMAT} CLANG_FORMAT_VERSION)
184208
message(STATUS "Found clang-format: ${CLANG_FORMAT} (version: ${CLANG_FORMAT_VERSION})")
185209

0 commit comments

Comments
 (0)