Skip to content

Commit 885c439

Browse files
authored
[UR] Move conformance tests over to lit (#17998)
Conformance tests are now ran by LLVM's lit framework rather than ctest. A new `check-unified-runtime-conformance` target is available, which builds and runs all conformance tests. The `test` target will still run them. Some additional housekeeping was done: * `add_conformance_test_with_x_environment` was renamed to `add_conformance_x_test`. * Conformance tests now explicitly respect `ONEAPI_DEVICE_SELECTOR`. * If unspecified, `ONEAPI_DEVICE_SELECTOR` will now be populated with the list of built targets. Notably, this will exclude adapters which exist in the build directory but were not specified using a `BUILD_ADAPTER` cmake option (e.g, from a previous build before a reconfigure). * References to `UR_CTS_ADAPTER_PLATFORM` and `UR_CTS_BACKEND` are removed (they never did anything anyway). * Github build jobs have been updated. * The generated gtest binaries have been moved from `build/bin` to `build/test/conformance` * `requirements_testing.txt` now imports psutil for using timeouts. * Output format has been changed to show a progress bar and print the test output in real time. * Testing now respects the "device" filters from `ONEAPI_DEVICE_SELECTOR` (previously, the filter was only used to select the platform. `opencl:cpu` now works as expected. * Some CUDA tests are marked as failing since they are failing after this change. As a resut of these changes, a build with both the v1 and v2 versions of the level zero adapter will only run the v2 adapter. Building with only one version of the level zero adapter (as the Github CI currently does) works as expected and only runs that version.
1 parent 1e5d85d commit 885c439

38 files changed

+175
-540
lines changed

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

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ on:
1313
runner_name:
1414
required: true
1515
type: string
16-
platform:
17-
description: "Platform string, `UR_CTS_ADAPTER_PLATFORM` will be set to this."
18-
required: false
19-
type: string
20-
default: ""
2116
static_loader:
2217
required: false
2318
type: string
@@ -46,11 +41,6 @@ on:
4641
runner_name:
4742
required: true
4843
type: string
49-
platform:
50-
description: "Platform string, `UR_CTS_ADAPTER_PLATFORM` will be set to this."
51-
required: false
52-
type: string
53-
default: ""
5444
static_loader:
5545
required: false
5646
type: string
@@ -89,7 +79,6 @@ jobs:
8979
{
9080
name: "${{inputs.adapter_name}}",
9181
other_name: "${{inputs.other_adapter_name}}",
92-
platform: "${{inputs.platform}}",
9382
static_Loader: "${{inputs.static_loader}}",
9483
static_adapter: "${{inputs.static_loader}}"
9584
}
@@ -105,7 +94,6 @@ jobs:
10594
steps:
10695
# TODO:
10796
# - investigate if DUR_CONFORMANCE_AMD_ARCH could be removed
108-
# - find better way to handle platform param (e.g. "Intel(R) OpenCL" -> "opencl")
10997
# - switch to Ninja generator in CMake
11098
# - downloading DPC++ should be integrated somehow; most likely use nightly release.
11199
#
@@ -156,7 +144,6 @@ jobs:
156144
-DUR_DEVELOPER_MODE=ON
157145
-DUR_BUILD_TESTS=ON
158146
-DUR_BUILD_ADAPTER_${{matrix.adapter.name}}=ON
159-
-DUR_CONFORMANCE_TEST_LOADER=${{ matrix.adapter.other_name != '' && 'ON' || 'OFF' }}
160147
${{ matrix.adapter.other_name != '' && format('-DUR_BUILD_ADAPTER_{0}=ON', matrix.adapter.other_name) || '' }}
161148
-DUR_STATIC_LOADER=${{matrix.adapter.static_Loader}}
162149
-DUR_STATIC_ADAPTER_${{matrix.adapter.name}}=${{matrix.adapter.static_adapter}}
@@ -184,7 +171,8 @@ jobs:
184171
- name: Test adapters
185172
env:
186173
ZE_ENABLE_LOADER_DEBUG_TRACE: 1
187-
run: env UR_CTS_ADAPTER_PLATFORM="${{matrix.adapter.platform}}" ctest -C ${{matrix.build_type}} --test-dir build --output-on-failure -L "conformance" --timeout 600 -VV
174+
LIT_OPTS: " --timeout 120"
175+
run: cmake --build build -j $(nproc) -- check-unified-runtime-conformance
188176

189177
- name: Get information about platform
190178
if: ${{ always() }}

.github/workflows/ur-precommit.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,10 @@ jobs:
7777
image_options: -u 1001 --privileged --cap-add SYS_ADMIN --gpus all
7878
- name: OPENCL
7979
runner: UR_OPENCL
80-
platform: "Intel(R) OpenCL"
8180
docker_image: "ghcr.io/intel/llvm/ubuntu2204_build:latest"
8281
image_options: -u 1001 --device=/dev/dri --device=/dev/kfd --privileged --cap-add SYS_ADMIN
8382
- name: OPENCL
8483
runner: UR_OPENCL
85-
platform: "OPENCL:Intel(R) OpenCL"
8684
other_adapter: NATIVE_CPU
8785
docker_image: "ghcr.io/intel/llvm/ubuntu2204_build:latest"
8886
image_options: -u 1001 --device=/dev/dri --device=/dev/kfd --privileged --cap-add SYS_ADMIN

unified-runtime/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ set(UR_SYCL_LIBRARY_DIR "" CACHE PATH
6565
set(UR_CONFORMANCE_TARGET_TRIPLES "" CACHE STRING
6666
"List of sycl targets to build CTS device binaries for")
6767
set(UR_CONFORMANCE_AMD_ARCH "" CACHE STRING "AMD device target ID to build CTS binaries for")
68-
option(UR_CONFORMANCE_ENABLE_MATCH_FILES "Enable CTS match files" ON)
69-
option(UR_CONFORMANCE_TEST_LOADER "Also test the loader in the conformance tests" OFF)
68+
set(UR_CONFORMANCE_SELECTOR "" CACHE STRING "If nonempty, the device selector for conformance tests")
7069
option(UR_USE_DEBUG_POSTFIX "Enable debug postfix 'd' for libraries" OFF)
7170
set(UR_ADAPTER_LEVEL_ZERO_SOURCE_DIR "" CACHE PATH
7271
"Path to external 'level_zero' adapter source dir")

unified-runtime/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,7 @@ List of options provided by CMake:
128128
| UR_ENABLE_SANITIZER | Enable device sanitizer layer | ON/OFF | ON |
129129
| UR_CONFORMANCE_TARGET_TRIPLES | SYCL triples to build CTS device binaries for | Comma-separated list | spir64 |
130130
| UR_CONFORMANCE_AMD_ARCH | AMD device target ID to build CTS binaries for | string | `""` |
131-
| UR_CONFORMANCE_ENABLE_MATCH_FILES | Enable CTS match files | ON/OFF | ON |
132-
| UR_CONFORMANCE_TEST_LOADER | Additionally build and run "loader" tests for the CTS | ON/OFF | OFF |
131+
| UR_CONFORMANCE_SELECTOR | `ONEAPI_DEVICE_SELECTOR` for conformance testing | string | All enabled adapters |
133132
| UR_BUILD_ADAPTER_L0 | Build the Level-Zero adapter | ON/OFF | OFF |
134133
| UR_BUILD_ADAPTER_OPENCL | Build the OpenCL adapter | ON/OFF | OFF |
135134
| UR_BUILD_ADAPTER_CUDA | Build the CUDA adapter | ON/OFF | OFF |

unified-runtime/scripts/core/CONTRIB.rst

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,14 +272,21 @@ Conformance tests *must* not make assumptions about the adapter under test.
272272
Tests fixtures or cases *must* query for support of optional features and skip
273273
testing if unsupported by the adapter.
274274

275-
All tests in the Unified Runtime project are configured to use CTest to run.
276-
All conformance tests have the ``conformance`` label attached to them which
277-
allows them to be run independently. To run all the conformance tests, execute
278-
the following command from the build directory.
275+
Conformance tests are ran as part of the main ``test`` target, but can also be
276+
executed using the `check-unified-runtime-conformance` target as follows:
279277

280278
.. code-block:: console
281279
282-
ctest -L "conformance"
280+
cmake --build build --target check-unified-runtime-conformance
281+
282+
A specific device/adapter can be specified by using ``ONEAPI_DEVICE_SELECTOR``
283+
in the same way as in the `DPC++ compiler
284+
<https://github.com/intel/llvm/blob/sycl/sycl/doc/EnvironmentVariables.md#oneapi_device_selector>`_.
285+
286+
A number of tests are skipped on certain adapters due to being known failures.
287+
To force all tests to run, including known failures,
288+
``UR_CTS_ALSO_RUN_KNOWN_FAILURES`` may be set to ``1`` as an environment
289+
variable.
283290

284291
Experimental Features
285292
=====================

unified-runtime/scripts/core/INTRO.rst

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -417,26 +417,12 @@ CTS Environment Variables
417417

418418
The following environment variables are used by the CTS runner and can be used to specify the platform that the test
419419
framework should run on. This can be used during development and testing to run CTS tests in case multiple platforms
420-
are available. If both filters are specified, then they both must match a platform for it to be selected. If there are
421-
no valid platforms, then the tests will fail. Command line arguments take priority over these variables.
420+
are available. Conformance tests will be skipped if there are no valid platforms.
422421

423-
.. envvar:: UR_CTS_ADAPTER_PLATFORM
422+
.. envvar:: ONEAPI_DEVICE_SELECTOR
424423

425-
A specifier list in the form of `[(backend):](platform name)[;[(backend)]:(platform name)]...`. If a backend
426-
specific specifier is present in the list and the test is running for that backend, the device with the given name
427-
is chosen. Otherwise, it must match the name of the specifier from the list with no backend. Backend names are case-
428-
insensitive, however platform names must match exactly.
429-
430-
For example, if the test device has multiple platforms and you want to run tests on the "ABC Corp" backend when
431-
testing OpenCL and "XYZ Org" when testing level zero, you'd use `OPENCL:ABC Corp;LEVEL_ZERO:XYZ Org`. This form is
432-
useful when running the `build` target with a build with multiple backends.
433-
434-
For testing only one platform, the backend can be omitted. For example, just `ABC Corp` is sufficient if the tests
435-
are only going to be testing OpenCL.
436-
437-
.. envvar:: UR_CTS_BACKEND
438-
439-
A (case insensitive) backend to force the test to use. For example, `opencl`, `level_zero`, `hip` and so on.
424+
If ``ONEAPI_DEVICE_SELECTOR`` is set in the environment, only devices
425+
matched by the selector will be tested.
440426

441427
.. envvar:: UR_CTS_ALSO_RUN_KNOWN_FAILURES
442428

unified-runtime/scripts/ctest_parser.py

Lines changed: 0 additions & 175 deletions
This file was deleted.

unified-runtime/test/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ configure_file(lit.site.cfg.py.in lit.site.cfg.py)
3131
add_custom_target(deps_check-unified-runtime)
3232
if(UR_STANDALONE_BUILD)
3333
add_custom_target(check-unified-runtime
34-
COMMAND "${URLIT_LIT_BINARY}" "${CMAKE_CURRENT_BINARY_DIR}" -v
34+
COMMAND "${URLIT_LIT_BINARY}" "${CMAKE_CURRENT_BINARY_DIR}" -sv
3535
DEPENDS deps_check-unified-runtime
36+
USES_TERMINAL
3637
)
3738
else()
3839
# Use the LLVM method to add the test suite - this also registers it under `check-all`
@@ -60,7 +61,8 @@ function(add_ur_lit_testsuite suite)
6061

6162
if(UR_STANDALONE_BUILD)
6263
add_custom_target(${TARGET}
63-
COMMAND "${URLIT_LIT_BINARY}" "${CMAKE_CURRENT_BINARY_DIR}" -v
64+
COMMAND "${URLIT_LIT_BINARY}" "${CMAKE_CURRENT_BINARY_DIR}" -sv
65+
USES_TERMINAL
6466
)
6567
else()
6668
add_lit_testsuite(${TARGET} "Running Unified Runtime ${suite} tests"

0 commit comments

Comments
 (0)