Skip to content

Commit c26d47e

Browse files
committed
[CI] Add "loader" support to conformance testing
This expands our CI to test the loader; the dispatcher that is used when multiple adapters are availabe. Previously, the unit tests forced a specific adapter, via `UR_ADAPTERS_FORCE_LOAD`. Now an extra "loader" target is created for each test suite, which doesn't set that variable and allows the loader to be used. In addition, the test runner's adapter selection logic has been rewritten to support a "--backend" variable, which allows you to select a backend (OpenCL, Level Zero, etc.). The platform selection has also been expanded to support filtering by a backend to match that platform only on that backend (e.g. `UR_CTS_ADAPTER_PLATFORM="opencl:Fictional Corp(R)"`). The old "run on hardware" jobs should behave the same (they have the loader tests disabled), but there is a new `combined-opencl-level-zero` job that tests a build with both OpenCL and Level Zero available.
1 parent 675dd29 commit c26d47e

File tree

76 files changed

+897
-69
lines changed

Some content is hidden

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

76 files changed

+897
-69
lines changed

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

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,21 @@ on:
77
adapter_name:
88
required: true
99
type: string
10+
other_adapter_name:
11+
required: false
12+
type: string
13+
default: ""
1014
runner_name:
1115
required: true
1216
type: string
1317
platform:
1418
required: false
1519
type: string
1620
default: ""
21+
other_platform:
22+
required: false
23+
type: string
24+
default: ""
1725
static_loader:
1826
required: false
1927
type: string
@@ -39,9 +47,14 @@ jobs:
3947
if: github.repository == 'oneapi-src/unified-runtime' # run only on upstream; forks won't have the HW
4048
strategy:
4149
matrix:
42-
adapter: [
43-
{name: "${{inputs.adapter_name}}", platform: "${{inputs.platform}}", static_Loader: "${{inputs.static_loader}}", static_adapter: "${{inputs.static_loader}}"},
44-
]
50+
adapter: [{
51+
name: "${{inputs.adapter_name}}",
52+
other_name: "${{inputs.other_adapter_name}}",
53+
platform: "${{inputs.platform}}",
54+
other_platform: "${{inputs.other_platform}}",
55+
static_Loader: "${{inputs.static_loader}}",
56+
static_adapter: "${{inputs.static_loader}}"
57+
}]
4558
build_type: [Debug, Release]
4659
compiler: [{c: gcc, cxx: g++}, {c: clang, cxx: clang++}]
4760
# TODO: The latest L0 loader segfaults when built with clang.
@@ -83,10 +96,12 @@ jobs:
8396
-DUR_DEVELOPER_MODE=ON
8497
-DUR_BUILD_TESTS=ON
8598
-DUR_BUILD_ADAPTER_${{matrix.adapter.name}}=ON
99+
${{ matrix.adapter.other_name != '' && format('-DUR_BUILD_ADAPTER_{0}=ON', matrix.adapter.other_name) || '' }}
86100
-DUR_STATIC_LOADER=${{matrix.adapter.static_Loader}}
87101
-DUR_STATIC_ADAPTER_${{matrix.adapter.name}}=${{matrix.adapter.static_adapter}}
88102
-DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++
89103
-DUR_SYCL_LIBRARY_DIR=${{github.workspace}}/dpcpp_compiler/lib
104+
-DUR_CONFORMANCE_TEST_LOADER=${{ matrix.adapter.other_name != '' && 'ON' || 'OFF' }}
90105
${{ matrix.adapter.name == 'HIP' && '-DUR_CONFORMANCE_AMD_ARCH=gfx1030' || '' }}
91106
${{ matrix.adapter.name == 'HIP' && '-DUR_HIP_PLATFORM=AMD' || '' }}
92107
@@ -97,10 +112,12 @@ jobs:
97112
- name: Test adapter specific
98113
working-directory: ${{github.workspace}}/build
99114
run: ctest -C ${{matrix.build_type}} --output-on-failure -L "adapter-specific" --timeout 180
115+
# Don't run adapter specific tests when building multiple adapters
116+
if: ${{ matrix.adapter.other_name == '' }}
100117

101118
- name: Test adapters
102119
working-directory: ${{github.workspace}}/build
103-
run: env UR_CTS_ADAPTER_PLATFORM="${{matrix.adapter.platform}}" ctest -C ${{matrix.build_type}} --output-on-failure -L "conformance" --timeout 180
120+
run: env UR_CTS_ADAPTER_PLATFORM="${{matrix.adapter.name}}:${{matrix.adapter.platform}};${{matrix.adapter.other_name}}:${{matrix.adapter.other_platform}}" ctest -C ${{matrix.build_type}} --output-on-failure -L "conformance" --timeout 180
104121

105122
- name: Get information about platform
106123
if: ${{ always() }}

.github/workflows/cmake.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,15 @@ jobs:
186186
adapter_name: NATIVE_CPU
187187
runner_name: NATIVE_CPU
188188

189+
combined-opencl-level-zero:
190+
name: OpenCL + Level Zero
191+
uses: ./.github/workflows/build-hw-reusable.yml
192+
with:
193+
adapter_name: OPENCL
194+
other_adapter_name: L0
195+
runner_name: L0
196+
platform: "Intel(R) OpenCL"
197+
189198
e2e-level-zero:
190199
name: E2E L0
191200
permissions:

.github/workflows/multi_device.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
-DUR_DEVELOPER_MODE=ON
4949
-DUR_BUILD_TESTS=ON
5050
-DUR_BUILD_ADAPTER_${{matrix.adapter.name}}=ON
51+
-DUR_CONFORMANCE_TEST_LOADER=OFF
5152
-DUR_TEST_DEVICES_COUNT=2
5253
5354
- name: Build

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ set(UR_CONFORMANCE_TARGET_TRIPLES "" CACHE STRING
6868
"List of sycl targets to build CTS device binaries for")
6969
set(UR_CONFORMANCE_AMD_ARCH "" CACHE STRING "AMD device target ID to build CTS binaries for")
7070
option(UR_CONFORMANCE_ENABLE_MATCH_FILES "Enable CTS match files" ON)
71+
option(UR_CONFORMANCE_TEST_LOADER "Also test the loader in the conformance tests" ON)
7172
set(UR_ADAPTER_LEVEL_ZERO_SOURCE_DIR "" CACHE PATH
7273
"Path to external 'level_zero' adapter source dir")
7374
set(UR_ADAPTER_OPENCL_SOURCE_DIR "" CACHE PATH

scripts/templates/ldrddi.cpp.mako

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ namespace ur_loader
4040
add_local = False
4141
%>${th.get_initial_null_set(obj)}
4242

43+
// For testing
44+
abort();
45+
4346
[[maybe_unused]] auto context = getContext();
4447
%if re.match(r"\w+AdapterGet$", th.make_func_name(n, tags, obj)):
4548

0 commit comments

Comments
 (0)