Skip to content

Commit

Permalink
[CI] Add "loader" support to conformance testing
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
RossBrunton committed Oct 2, 2024
1 parent 675dd29 commit c26d47e
Show file tree
Hide file tree
Showing 76 changed files with 897 additions and 69 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/build-hw-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@ on:
adapter_name:
required: true
type: string
other_adapter_name:
required: false
type: string
default: ""
runner_name:
required: true
type: string
platform:
required: false
type: string
default: ""
other_platform:
required: false
type: string
default: ""
static_loader:
required: false
type: string
Expand All @@ -39,9 +47,14 @@ jobs:
if: github.repository == 'oneapi-src/unified-runtime' # run only on upstream; forks won't have the HW
strategy:
matrix:
adapter: [
{name: "${{inputs.adapter_name}}", platform: "${{inputs.platform}}", static_Loader: "${{inputs.static_loader}}", static_adapter: "${{inputs.static_loader}}"},
]
adapter: [{
name: "${{inputs.adapter_name}}",
other_name: "${{inputs.other_adapter_name}}",
platform: "${{inputs.platform}}",
other_platform: "${{inputs.other_platform}}",
static_Loader: "${{inputs.static_loader}}",
static_adapter: "${{inputs.static_loader}}"
}]
build_type: [Debug, Release]
compiler: [{c: gcc, cxx: g++}, {c: clang, cxx: clang++}]
# TODO: The latest L0 loader segfaults when built with clang.
Expand Down Expand Up @@ -83,10 +96,12 @@ jobs:
-DUR_DEVELOPER_MODE=ON
-DUR_BUILD_TESTS=ON
-DUR_BUILD_ADAPTER_${{matrix.adapter.name}}=ON
${{ matrix.adapter.other_name != '' && format('-DUR_BUILD_ADAPTER_{0}=ON', matrix.adapter.other_name) || '' }}
-DUR_STATIC_LOADER=${{matrix.adapter.static_Loader}}
-DUR_STATIC_ADAPTER_${{matrix.adapter.name}}=${{matrix.adapter.static_adapter}}
-DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++
-DUR_SYCL_LIBRARY_DIR=${{github.workspace}}/dpcpp_compiler/lib
-DUR_CONFORMANCE_TEST_LOADER=${{ matrix.adapter.other_name != '' && 'ON' || 'OFF' }}
${{ matrix.adapter.name == 'HIP' && '-DUR_CONFORMANCE_AMD_ARCH=gfx1030' || '' }}
${{ matrix.adapter.name == 'HIP' && '-DUR_HIP_PLATFORM=AMD' || '' }}
Expand All @@ -97,10 +112,12 @@ jobs:
- name: Test adapter specific
working-directory: ${{github.workspace}}/build
run: ctest -C ${{matrix.build_type}} --output-on-failure -L "adapter-specific" --timeout 180
# Don't run adapter specific tests when building multiple adapters
if: ${{ matrix.adapter.other_name == '' }}

- name: Test adapters
working-directory: ${{github.workspace}}/build
run: env UR_CTS_ADAPTER_PLATFORM="${{matrix.adapter.platform}}" ctest -C ${{matrix.build_type}} --output-on-failure -L "conformance" --timeout 180
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

- name: Get information about platform
if: ${{ always() }}
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,15 @@ jobs:
adapter_name: NATIVE_CPU
runner_name: NATIVE_CPU

combined-opencl-level-zero:
name: OpenCL + Level Zero
uses: ./.github/workflows/build-hw-reusable.yml
with:
adapter_name: OPENCL
other_adapter_name: L0
runner_name: L0
platform: "Intel(R) OpenCL"

e2e-level-zero:
name: E2E L0
permissions:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/multi_device.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
-DUR_DEVELOPER_MODE=ON
-DUR_BUILD_TESTS=ON
-DUR_BUILD_ADAPTER_${{matrix.adapter.name}}=ON
-DUR_CONFORMANCE_TEST_LOADER=OFF
-DUR_TEST_DEVICES_COUNT=2
- name: Build
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ set(UR_CONFORMANCE_TARGET_TRIPLES "" CACHE STRING
"List of sycl targets to build CTS device binaries for")
set(UR_CONFORMANCE_AMD_ARCH "" CACHE STRING "AMD device target ID to build CTS binaries for")
option(UR_CONFORMANCE_ENABLE_MATCH_FILES "Enable CTS match files" ON)
option(UR_CONFORMANCE_TEST_LOADER "Also test the loader in the conformance tests" ON)
set(UR_ADAPTER_LEVEL_ZERO_SOURCE_DIR "" CACHE PATH
"Path to external 'level_zero' adapter source dir")
set(UR_ADAPTER_OPENCL_SOURCE_DIR "" CACHE PATH
Expand Down
3 changes: 3 additions & 0 deletions scripts/templates/ldrddi.cpp.mako
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ namespace ur_loader
add_local = False
%>${th.get_initial_null_set(obj)}

// For testing
abort();

[[maybe_unused]] auto context = getContext();
%if re.match(r"\w+AdapterGet$", th.make_func_name(n, tags, obj)):

Expand Down
Loading

0 comments on commit c26d47e

Please sign in to comment.