Skip to content

Commit 49a57f5

Browse files
committed
Add backward compatibility workflow and tests
1 parent 660f1f4 commit 49a57f5

39 files changed

+819
-148
lines changed

.github/workflows/pr_push.yml

Lines changed: 6 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -16,72 +16,10 @@ permissions:
1616
contents: read
1717

1818
jobs:
19-
CodeChecks:
20-
uses: ./.github/workflows/reusable_checks.yml
21-
DocsBuild:
22-
uses: ./.github/workflows/reusable_docs_build.yml
23-
FastBuild:
24-
name: Fast builds
25-
needs: [CodeChecks, DocsBuild]
26-
uses: ./.github/workflows/reusable_fast.yml
27-
Build:
28-
name: Basic builds
29-
needs: [FastBuild]
30-
uses: ./.github/workflows/reusable_basic.yml
31-
DevDax:
32-
needs: [FastBuild]
33-
uses: ./.github/workflows/reusable_dax.yml
34-
MultiNuma:
35-
needs: [FastBuild]
36-
uses: ./.github/workflows/reusable_multi_numa.yml
37-
L0:
38-
needs: [Build]
39-
uses: ./.github/workflows/reusable_gpu.yml
19+
Compatibility:
20+
uses: ./.github/workflows/reusable_compatibility.yml
21+
strategy:
22+
matrix:
23+
tag: ["v0.10.1"]
4024
with:
41-
name: "LEVEL_ZERO"
42-
shared_lib: "['ON']"
43-
CUDA:
44-
needs: [Build]
45-
uses: ./.github/workflows/reusable_gpu.yml
46-
with:
47-
name: "CUDA"
48-
shared_lib: "['ON']"
49-
Sanitizers:
50-
needs: [FastBuild]
51-
uses: ./.github/workflows/reusable_sanitizers.yml
52-
QEMU:
53-
needs: [FastBuild]
54-
uses: ./.github/workflows/reusable_qemu.yml
55-
with:
56-
short_run: true
57-
ProxyLib:
58-
needs: [Build]
59-
uses: ./.github/workflows/reusable_proxy_lib.yml
60-
Valgrind:
61-
needs: [Build]
62-
uses: ./.github/workflows/reusable_valgrind.yml
63-
Coverage:
64-
# total coverage (on upstream only)
65-
if: github.repository == 'oneapi-src/unified-memory-framework'
66-
needs: [Build, DevDax, L0, CUDA, MultiNuma, QEMU, ProxyLib]
67-
uses: ./.github/workflows/reusable_coverage.yml
68-
secrets: inherit
69-
with:
70-
trigger: "${{github.event_name}}"
71-
Coverage_partial:
72-
# partial coverage (on forks)
73-
if: github.repository != 'oneapi-src/unified-memory-framework'
74-
needs: [Build, QEMU, ProxyLib]
75-
uses: ./.github/workflows/reusable_coverage.yml
76-
CodeQL:
77-
needs: [Build]
78-
permissions:
79-
contents: read
80-
security-events: write
81-
uses: ./.github/workflows/reusable_codeql.yml
82-
Trivy:
83-
needs: [Build]
84-
permissions:
85-
contents: read
86-
security-events: write
87-
uses: ./.github/workflows/reusable_trivy.yml
25+
tag: ${{matrix.tag}}
Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
# Workflow for checkig the backward compatibility of UMF.
2+
# Test the latest UMF shared library with binaries compiled using the older UMF
3+
# shared library.
4+
name: Compatibility
5+
6+
on:
7+
workflow_call:
8+
inputs:
9+
tag:
10+
description: Check backward compatibility with this tag
11+
type: string
12+
default: "v0.10.1"
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
ubuntu-build:
19+
name: Ubuntu
20+
runs-on: 'ubuntu-22.04'
21+
22+
steps:
23+
# NOTE: we need jemalloc for older version of UMF
24+
- name: Install apt packages
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y clang cmake libnuma-dev libjemalloc-dev libtbb-dev
28+
29+
- name: Checkout "tag" UMF version
30+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
31+
with:
32+
fetch-depth: 0
33+
ref: refs/tags/${{inputs.tag}}
34+
path: ${{github.workspace}}/tag_version
35+
36+
- name: Install libhwloc
37+
working-directory: ${{github.workspace}}/tag_version
38+
run: .github/scripts/install_hwloc.sh
39+
40+
- name: Get "tag" UMF version
41+
working-directory: ${{github.workspace}}/tag_version
42+
run: |
43+
VERSION=$(git describe --tags --abbrev=0 | grep -oP '\d+\.\d+\.\d+')
44+
echo "tag version: $VERSION"
45+
46+
- name: Configure "tag" UMF build
47+
working-directory: ${{github.workspace}}/tag_version
48+
run: >
49+
cmake
50+
-B ${{github.workspace}}/tag_version/build
51+
-DCMAKE_INSTALL_PREFIX="${{github.workspace}}/tag_version/build/install"
52+
-DCMAKE_BUILD_TYPE=Debug
53+
-DUMF_BUILD_SHARED_LIBRARY=ON
54+
-DCMAKE_C_COMPILER=gcc
55+
-DCMAKE_CXX_COMPILER=g++
56+
-DUMF_BUILD_TESTS=ON
57+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
58+
-DUMF_BUILD_CUDA_PROVIDER=ON
59+
-DUMF_FORMAT_CODE_STYLE=OFF
60+
-DUMF_DEVELOPER_MODE=ON
61+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
62+
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
63+
-DUMF_TESTS_FAIL_ON_SKIP=ON
64+
65+
- name: Build "tag" UMF
66+
working-directory: ${{github.workspace}}/tag_version
67+
run: |
68+
cmake --build ${{github.workspace}}/tag_version/build -j $(nproc)
69+
70+
# For UMF < 0.11 set ptrace_scope
71+
- name: Set ptrace value for IPC test
72+
if: ${{ startsWith(inputs.tag, 'v0.10.') || startsWith(inputs.tag, 'v0.9.') }}
73+
run: sudo bash -c "echo 0 > /proc/sys/kernel/yama/ptrace_scope"
74+
75+
- name: Run "tag" UMF tests
76+
working-directory: ${{github.workspace}}/tag_version/build
77+
run: |
78+
LD_LIBRARY_PATH=${{github.workspace}}/tag_version/build/lib/ ctest --output-on-failure
79+
80+
- name: Checkout latest UMF version
81+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
82+
with:
83+
fetch-depth: 0
84+
path: ${{github.workspace}}/latest_version
85+
86+
- name: Get latest UMF version
87+
working-directory: ${{github.workspace}}/latest_version
88+
run: |
89+
VERSION=$(git describe --tags --abbrev=0 | grep -oP '\d+\.\d+\.\d+')
90+
echo "checked version: $VERSION"
91+
92+
- name: Configure latest UMF build
93+
working-directory: ${{github.workspace}}/latest_version
94+
run: >
95+
cmake
96+
-B ${{github.workspace}}/latest_version/build
97+
-DCMAKE_INSTALL_PREFIX="${{github.workspace}}/latest_version/build/install"
98+
-DCMAKE_BUILD_TYPE=Debug
99+
-DUMF_BUILD_SHARED_LIBRARY=ON
100+
-DCMAKE_C_COMPILER=gcc
101+
-DCMAKE_CXX_COMPILER=g++
102+
-DUMF_BUILD_TESTS=ON
103+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
104+
-DUMF_BUILD_CUDA_PROVIDER=ON
105+
-DUMF_FORMAT_CODE_STYLE=OFF
106+
-DUMF_DEVELOPER_MODE=ON
107+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
108+
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
109+
-DUMF_TESTS_FAIL_ON_SKIP=ON
110+
111+
- name: Build latest UMF
112+
working-directory: ${{github.workspace}}/latest_version
113+
run: |
114+
cmake --build ${{github.workspace}}/latest_version/build -j $(nproc)
115+
116+
# NOTE: exclude umf-provider_coarse, umf-disjointCoarseMallocPool,
117+
# umf-jemalloc_coarse_file, umf-scalable_coarse_file as they use Coarse
118+
# Provider which is not supported for UMF > 0.10.0
119+
- name: Run "tag" UMF tests with latest UMF libs (warnings enabled)
120+
working-directory: ${{github.workspace}}/tag_version/build
121+
run: >
122+
UMF_LOG="level:warning;flush:debug;output:stderr;pid:no"
123+
LD_LIBRARY_PATH=${{github.workspace}}/latest_version/build/lib/
124+
ctest --output-on-failure -E "umf-provider_coarse|umf-disjointCoarseMallocPool|umf-jemalloc_coarse_file|umf-scalable_coarse_file"
125+
126+
windows-build:
127+
name: Windows
128+
env:
129+
VCPKG_PATH: "${{github.workspace}}/vcpkg/packages/hwloc_x64-windows;${{github.workspace}}/vcpkg/packages/tbb_x64-windows;${{github.workspace}}/vcpkg/packages/jemalloc_x64-windows"
130+
runs-on: "windows-2022"
131+
132+
steps:
133+
- name: Checkout "tag" UMF version
134+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
135+
with:
136+
fetch-depth: 0
137+
ref: refs/tags/${{inputs.tag}}
138+
path: ${{github.workspace}}/tag_version
139+
140+
- name: Initialize vcpkg
141+
uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5
142+
with:
143+
vcpkgGitCommitId: 3dd44b931481d7a8e9ba412621fa810232b66289
144+
vcpkgDirectory: ${{github.workspace}}/vcpkg
145+
vcpkgJsonGlob: '**/vcpkg.json'
146+
147+
- name: Install dependencies
148+
working-directory: ${{github.workspace}}/tag_version
149+
run: vcpkg install
150+
shell: pwsh # Specifies PowerShell as the shell for running the script.
151+
152+
- name: Get "tag" UMF version
153+
working-directory: ${{github.workspace}}/tag_version
154+
run: |
155+
$version = (git describe --tags --abbrev=0 | Select-String -Pattern '\d+\.\d+\.\d+').Matches.Value
156+
echo "tag version: $VERSION"
157+
shell: pwsh
158+
159+
- name: Configure "tag" UMF build
160+
working-directory: ${{github.workspace}}/tag_version
161+
run: >
162+
cmake
163+
-B "${{github.workspace}}/tag_version/build"
164+
-DCMAKE_INSTALL_PREFIX="${{github.workspace}}/tag_version/install"
165+
-DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}"
166+
-DCMAKE_C_COMPILER=cl
167+
-DCMAKE_CXX_COMPILER=cl
168+
-DUMF_BUILD_SHARED_LIBRARY=ON
169+
-DUMF_BUILD_TESTS=ON
170+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
171+
-DUMF_BUILD_CUDA_PROVIDER=ON
172+
-DUMF_FORMAT_CODE_STYLE=OFF
173+
-DUMF_DEVELOPER_MODE=ON
174+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
175+
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
176+
-DUMF_TESTS_FAIL_ON_SKIP=ON
177+
178+
- name: Build "tag" UMF
179+
run: cmake --build "${{github.workspace}}/tag_version/build" --config Debug -j $Env:NUMBER_OF_PROCESSORS
180+
181+
- name: Run "tag" UMF tests
182+
working-directory: "${{github.workspace}}/tag_version/build"
183+
run: ctest -C Debug --output-on-failure --test-dir test
184+
185+
- name: Checkout latest UMF version
186+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
187+
with:
188+
fetch-depth: 0
189+
path: ${{github.workspace}}/latest_version
190+
191+
# NOTE we use vcpkg setup from "tag" version
192+
- name: Get latest UMF version
193+
working-directory: ${{github.workspace}}/latest_version
194+
run: |
195+
$version = (git describe --tags --abbrev=0 | Select-String -Pattern '\d+\.\d+\.\d+').Matches.Value
196+
echo "latest version: $VERSION"
197+
shell: pwsh
198+
199+
- name: Configure latest UMF build
200+
working-directory: ${{github.workspace}}/latest_version
201+
run: >
202+
cmake
203+
-B "${{github.workspace}}/latest_version/build"
204+
-DCMAKE_INSTALL_PREFIX="${{github.workspace}}/latest_version/install"
205+
-DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}"
206+
-DCMAKE_C_COMPILER=cl
207+
-DCMAKE_CXX_COMPILER=cl
208+
-DUMF_BUILD_SHARED_LIBRARY=ON
209+
-DUMF_BUILD_TESTS=ON
210+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
211+
-DUMF_BUILD_CUDA_PROVIDER=ON
212+
-DUMF_FORMAT_CODE_STYLE=OFF
213+
-DUMF_DEVELOPER_MODE=ON
214+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
215+
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
216+
-DUMF_TESTS_FAIL_ON_SKIP=ON
217+
218+
- name: Build latest UMF
219+
run: cmake --build "${{github.workspace}}/latest_version/build" --config Debug -j $Env:NUMBER_OF_PROCESSORS
220+
221+
# NOTE: exclude umf-provider_coarse, umf-disjointCoarseMallocPool,
222+
# umf-jemalloc_coarse_file, umf-scalable_coarse_file as they use Coarse
223+
# NOTE2: on Windows we simply overwrite the umf.dll
224+
# Provider which is not supported for UMF > 0.10.0
225+
- name: Run "tag" UMF tests with latest UMF libs (warnings enabled)
226+
working-directory: ${{github.workspace}}/tag_version/build
227+
run: |
228+
$env:UMF_LOG="level:warning;flush:debug;output:stderr;pid:no"
229+
cp ${{github.workspace}}/latest_version/build/bin/Debug/umf.dll ${{github.workspace}}/tag_version/build/bin/Debug/umf.dll
230+
ctest -C Debug --output-on-failure --test-dir test -E "umf-provider_coarse|umf-disjointCoarseMallocPool|umf-jemalloc_coarse_file|umf-scalable_coarse_file"

examples/custom_file_provider/custom_file_provider.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (C) 2024 Intel Corporation
3+
* Copyright (C) 2024-2025 Intel Corporation
44
*
55
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
66
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
@@ -234,7 +234,7 @@ static umf_result_t file_get_min_page_size(void *provider, void *ptr,
234234

235235
// File provider operations
236236
static umf_memory_provider_ops_t file_ops = {
237-
.version = UMF_VERSION_CURRENT,
237+
.version = UMF_PROVIDER_OPS_VERSION_CURRENT,
238238
.initialize = file_init,
239239
.finalize = file_deinit,
240240
.alloc = file_alloc,

include/umf/memory_pool.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#define UMF_MEMORY_POOL_H 1
1212

1313
#include <umf/base.h>
14+
#include <umf/memory_pool_ops.h>
1415
#include <umf/memory_provider.h>
1516

1617
#ifdef __cplusplus
@@ -22,12 +23,6 @@ extern "C" {
2223
/// functions
2324
typedef struct umf_memory_pool_t *umf_memory_pool_handle_t;
2425

25-
/// @brief This structure comprises function pointers used by corresponding umfPool*
26-
/// calls. Each memory pool implementation should initialize all function
27-
/// pointers.
28-
///
29-
typedef struct umf_memory_pool_ops_t umf_memory_pool_ops_t;
30-
3126
/// @brief Supported pool creation flags
3227
typedef enum umf_pool_create_flag_t {
3328
UMF_POOL_CREATE_FLAG_NONE =

include/umf/memory_pool_ops.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,19 @@
1717
extern "C" {
1818
#endif
1919

20+
/// @brief Version of the Memory Pool ops structure.
21+
/// NOTE: This is equal to the latest UMF version, in which the ops structure
22+
/// has been modified.
23+
#define UMF_POOL_OPS_VERSION_CURRENT UMF_MAKE_VERSION(0, 11)
24+
2025
///
2126
/// @brief This structure comprises function pointers used by corresponding umfPool*
2227
/// calls. Each memory pool implementation should initialize all function
2328
/// pointers.
2429
///
25-
typedef struct umf_memory_pool_ops_t {
30+
typedef struct umf_memory_pool_ops_0_11_t {
2631
/// Version of the ops structure.
27-
/// Should be initialized using UMF_VERSION_CURRENT.
32+
/// Should be initialized using UMF_POOL_OPS_VERSION_CURRENT.
2833
uint32_t version;
2934

3035
///
@@ -120,7 +125,8 @@ typedef struct umf_memory_pool_ops_t {
120125
/// The value is undefined if the previous allocation was successful.
121126
///
122127
umf_result_t (*get_last_allocation_error)(void *pool);
123-
} umf_memory_pool_ops_t;
128+
} umf_memory_pool_ops_0_11_t;
129+
typedef umf_memory_pool_ops_0_11_t umf_memory_pool_ops_t;
124130

125131
#ifdef __cplusplus
126132
}

0 commit comments

Comments
 (0)