Skip to content

Commit 695f3ae

Browse files
committed
[UR] Move non-conformance/adapter tests to lit
This adds support for lit to unified-runtime, in the form of a new target `check-unified-runtime`. This target is available when UR is built standalone and when built as part of dpcpp. In addition, there are targets like `check-unified-runtime-unit` which run a subset of the lit tests. When built standalone, `lit` and `filecheck` must be avilable in the path. A `requirements_testing.txt` file is available to install test dependencies. When built as part of dpcpp, a new cmake variable is available; `SYCL_UR_BUILD_TESTS` which is off by default. When enabled, `check-unified-runtime` will be available as a target and will also run as part of `check-all`. All tests have been ported with the exception of: * Adapter tests * Conformance tests The Python version for macos was also bumped to 3.10 to enable use of a newer filecheck version.
1 parent 0886791 commit 695f3ae

File tree

110 files changed

+995
-1600
lines changed

Some content is hidden

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

110 files changed

+995
-1600
lines changed

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

+1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ jobs:
102102
. .venv/bin/activate
103103
echo "$PATH" >> $GITHUB_PATH
104104
pip install -r third_party/requirements.txt
105+
pip install -r third_party/requirements_testing.txt
105106
106107
- name: Download DPC++
107108
run: |

.github/workflows/ur-precommit.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,13 @@ jobs:
8989

9090
- uses: actions/setup-python@6ca8e8598faa206f7140a65ba31b899bebe16f58 # v5.0.0
9191
with:
92-
python-version: 3.9
92+
python-version: "3.10"
9393

9494
- name: Install prerequisites
9595
working-directory: ${{github.workspace}}/unified-runtime
96-
run: python3 -m pip install -r third_party/requirements.txt
96+
run: |
97+
python3 -m pip install -r third_party/requirements.txt
98+
python3 -m pip install -r third_party/requirements_testing.txt
9799
98100
- name: Install hwloc
99101
run: brew install hwloc

sycl/cmake/modules/FetchUnifiedRuntime.cmake

+6-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ option(SYCL_UR_USE_FETCH_CONTENT
2323
set(SYCL_UR_SOURCE_DIR
2424
"" CACHE PATH "Path to root of Unified Runtime repository")
2525

26-
# Here we override the defaults to disable building tests from unified-runtime
27-
set(UR_BUILD_EXAMPLES OFF CACHE BOOL "Build example applications." FORCE)
28-
set(UR_BUILD_TESTS OFF CACHE BOOL "Build unit tests." FORCE)
26+
option(SYCL_UR_BUILD_TESTS "Build tests for UR" OFF)
27+
set(UR_BUILD_TESTS "${SYCL_UR_BUILD_TESTS}" CACHE BOOL "" FORCE)
28+
# UR tests require the examples to be built
29+
set(UR_BUILD_EXAMPLES "${SYCL_UR_BUILD_TESTS}" CACHE BOOL "" FORCE)
30+
31+
# Here we override the defaults to unified-runtime
2932
set(UR_BUILD_XPTI_LIBS OFF)
3033
set(UR_ENABLE_SYMBOLIZER ON CACHE BOOL "Enable symbolizer for sanitizer layer.")
3134
set(UR_ENABLE_TRACING ON)

unified-runtime/README.md

+16-2
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,29 @@ List of options provided by CMake:
149149
| UR_HIP_HSA_INCLUDE_DIRS | Path of the ROCm HSA include directory | Directory path | `${UR_HIP_ROCM_DIR}/hsa/include;${UR_HIP_ROCM_DIR}/include` |
150150
| UR_HIP_LIB_DIR | Path of the ROCm HIP library directory | Directory path | `${UR_HIP_ROCM_DIR}/lib` |
151151

152-
### Additional make targets
152+
### Testing
153153

154-
To run tests, do the following:
154+
Unified Runtime uses `lit` and `FileCheck` as part of its test suite. When built as
155+
part of an LLVM build, the binaries provided by LLVM will be used. When built standalone,
156+
both `lit` and `FileCheck` (or `filecheck`) must be visible on `$PATH`. The easiest way
157+
to do this is to install the Python packages for `lit` and `filecheck`.
158+
159+
```bash
160+
$ source .venv/bin/activate
161+
$ pip install -r third_party/requirements_testing.txt
162+
```
163+
164+
> Note: `filecheck` requires Python >= 3.10; if you get errors claiming that `filecheck` is not available, update your Python version or disable testing.
165+
166+
Once installed, tests can be executed using:
155167

156168
```bash
157169
$ make
158170
$ make test
159171
```
160172

173+
### Additional make targets
174+
161175
To run automated code formatting, configure CMake with `UR_FORMAT_CPP_STYLE` option
162176
and then run a custom `cppformat` target:
163177

unified-runtime/cmake/FindLit.cmake

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright (C) 2025 Intel Corporation
2+
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
3+
# See LICENSE.TXT
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
6+
7+
# There are two modes to finding lit and filecheck
8+
# If we are a standalone build, use the python packages
9+
# If we are not a standalone build, use the one provided by LLVM
10+
# Note that the python filecheck re-implementation isn't 100% compatible, but hopefully for simple tests it should be
11+
# good enough
12+
13+
if(UR_STANDALONE_BUILD)
14+
# Standalone build
15+
find_program(URLIT_LIT_BINARY "lit")
16+
if(NOT URLIT_LIT_BINARY)
17+
message(FATAL_ERROR "No `lit` binary was found in path. Consider installing the python Package `lit`")
18+
endif()
19+
20+
find_program(URLIT_FILECHECK_BINARY NAMES "filecheck" "FileCheck")
21+
if(NOT URLIT_FILECHECK_BINARY)
22+
message(FATAL_ERROR "No `filecheck` or `FileCheck` binary was found in path. Consider installing the python Package `filecheck`")
23+
endif()
24+
else()
25+
# In source build
26+
27+
# This will be in the $PATH
28+
set(URLIT_FILECHECK_BINARY "FileCheck")
29+
endif()

unified-runtime/cmake/match.cmake

-77
This file was deleted.

0 commit comments

Comments
 (0)