Skip to content

Commit 36ccc9d

Browse files
Merge pull request #1087 from bratpiorka/rrudnick_compat_wflow2
Add backward compatibility workflow and tests
2 parents 3ea2809 + 406be0c commit 36ccc9d

32 files changed

+307
-67
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ Before checking all the boxes please mark the PR as draft.
3636
- [ ] All newly added source files have a license
3737
- [ ] All newly added source files are referenced in CMake files
3838
- [ ] Logger (with debug/info/... messages) is used
39+
- [ ] All API changes are reflected in docs and def/map files, and are tested

.github/workflows/pr_push.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,11 @@ jobs:
8585
contents: read
8686
security-events: write
8787
uses: ./.github/workflows/reusable_trivy.yml
88+
Compatibility:
89+
needs: [Build]
90+
uses: ./.github/workflows/reusable_compatibility.yml
91+
strategy:
92+
matrix:
93+
tag: ["v0.11.0-dev1"]
94+
with:
95+
tag: ${{matrix.tag}}
Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
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.11.0-dev1"
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+
- name: Install apt packages
24+
run: |
25+
sudo apt-get update
26+
sudo apt-get install -y clang cmake libnuma-dev libtbb-dev
27+
28+
- name: Checkout "tag" UMF version
29+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
30+
with:
31+
fetch-depth: 0
32+
ref: refs/tags/${{inputs.tag}}
33+
path: ${{github.workspace}}/tag_version
34+
35+
- name: Install libhwloc
36+
working-directory: ${{github.workspace}}/tag_version
37+
run: .github/scripts/install_hwloc.sh
38+
39+
- name: Get "tag" UMF version
40+
working-directory: ${{github.workspace}}/tag_version
41+
run: |
42+
VERSION=$(git describe --tags)
43+
echo "tag version: $VERSION"
44+
45+
- name: Configure "tag" UMF build
46+
working-directory: ${{github.workspace}}/tag_version
47+
run: >
48+
cmake
49+
-B ${{github.workspace}}/tag_version/build
50+
-DCMAKE_BUILD_TYPE=Debug
51+
-DUMF_BUILD_SHARED_LIBRARY=ON
52+
-DCMAKE_C_COMPILER=gcc
53+
-DCMAKE_CXX_COMPILER=g++
54+
-DUMF_BUILD_TESTS=ON
55+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
56+
-DUMF_BUILD_CUDA_PROVIDER=ON
57+
-DUMF_FORMAT_CODE_STYLE=OFF
58+
-DUMF_DEVELOPER_MODE=ON
59+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
60+
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
61+
-DUMF_TESTS_FAIL_ON_SKIP=ON
62+
63+
- name: Build "tag" UMF
64+
working-directory: ${{github.workspace}}/tag_version
65+
run: |
66+
cmake --build ${{github.workspace}}/tag_version/build -j $(nproc)
67+
68+
- name: Run "tag" UMF tests
69+
working-directory: ${{github.workspace}}/tag_version/build
70+
run: |
71+
LD_LIBRARY_PATH=${{github.workspace}}/tag_version/build/lib/ ctest --output-on-failure
72+
73+
- name: Checkout latest UMF version
74+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
75+
with:
76+
fetch-depth: 0
77+
path: ${{github.workspace}}/latest_version
78+
79+
- name: Get latest UMF version
80+
working-directory: ${{github.workspace}}/latest_version
81+
run: |
82+
VERSION=$(git describe --tags)
83+
echo "checked version: $VERSION"
84+
85+
- name: Configure latest UMF build
86+
working-directory: ${{github.workspace}}/latest_version
87+
run: >
88+
cmake
89+
-B ${{github.workspace}}/latest_version/build
90+
-DCMAKE_BUILD_TYPE=Debug
91+
-DUMF_BUILD_SHARED_LIBRARY=ON
92+
-DCMAKE_C_COMPILER=gcc
93+
-DCMAKE_CXX_COMPILER=g++
94+
-DUMF_BUILD_TESTS=OFF
95+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
96+
-DUMF_BUILD_CUDA_PROVIDER=ON
97+
-DUMF_FORMAT_CODE_STYLE=OFF
98+
-DUMF_DEVELOPER_MODE=ON
99+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
100+
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
101+
-DUMF_TESTS_FAIL_ON_SKIP=ON
102+
103+
- name: Build latest UMF
104+
working-directory: ${{github.workspace}}/latest_version
105+
run: |
106+
cmake --build ${{github.workspace}}/latest_version/build -j $(nproc)
107+
108+
- name: Run "tag" UMF tests with latest UMF libs (warnings enabled)
109+
working-directory: ${{github.workspace}}/tag_version/build
110+
run: >
111+
UMF_LOG="level:warning;flush:debug;output:stderr;pid:no"
112+
LD_LIBRARY_PATH=${{github.workspace}}/latest_version/build/lib/
113+
ctest --output-on-failure
114+
115+
windows-build:
116+
name: Windows
117+
env:
118+
VCPKG_PATH: "${{github.workspace}}/vcpkg/packages/hwloc_x64-windows;${{github.workspace}}/vcpkg/packages/tbb_x64-windows;${{github.workspace}}/vcpkg/packages/jemalloc_x64-windows"
119+
runs-on: "windows-2022"
120+
121+
steps:
122+
- name: Checkout "tag" UMF version
123+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
124+
with:
125+
fetch-depth: 0
126+
ref: refs/tags/${{inputs.tag}}
127+
path: ${{github.workspace}}/tag_version
128+
129+
- name: Initialize vcpkg
130+
uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5
131+
with:
132+
vcpkgGitCommitId: 3dd44b931481d7a8e9ba412621fa810232b66289
133+
vcpkgDirectory: ${{github.workspace}}/vcpkg
134+
vcpkgJsonGlob: '**/vcpkg.json'
135+
136+
- name: Install dependencies
137+
working-directory: ${{github.workspace}}/tag_version
138+
run: vcpkg install
139+
shell: pwsh # Specifies PowerShell as the shell for running the script.
140+
141+
- name: Get "tag" UMF version
142+
working-directory: ${{github.workspace}}/tag_version
143+
run: |
144+
$version = (git describe --tags)
145+
echo "tag version: $VERSION"
146+
147+
- name: Configure "tag" UMF build
148+
working-directory: ${{github.workspace}}/tag_version
149+
run: >
150+
cmake
151+
-B "${{github.workspace}}/tag_version/build"
152+
-DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}"
153+
-DCMAKE_C_COMPILER=cl
154+
-DCMAKE_CXX_COMPILER=cl
155+
-DUMF_BUILD_SHARED_LIBRARY=ON
156+
-DUMF_BUILD_TESTS=ON
157+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
158+
-DUMF_BUILD_CUDA_PROVIDER=ON
159+
-DUMF_FORMAT_CODE_STYLE=OFF
160+
-DUMF_DEVELOPER_MODE=ON
161+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
162+
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
163+
-DUMF_TESTS_FAIL_ON_SKIP=ON
164+
165+
- name: Build "tag" UMF
166+
run: cmake --build "${{github.workspace}}/tag_version/build" --config Debug -j $Env:NUMBER_OF_PROCESSORS
167+
168+
- name: Run "tag" UMF tests
169+
working-directory: "${{github.workspace}}/tag_version/build"
170+
run: ctest -C Debug --output-on-failure --test-dir test
171+
172+
- name: Checkout latest UMF version
173+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
174+
with:
175+
fetch-depth: 0
176+
path: ${{github.workspace}}/latest_version
177+
178+
# NOTE we use vcpkg setup from "tag" version
179+
- name: Get latest UMF version
180+
working-directory: ${{github.workspace}}/latest_version
181+
run: |
182+
$version = (git describe --tags)
183+
echo "latest version: $VERSION"
184+
185+
- name: Configure latest UMF build
186+
working-directory: ${{github.workspace}}/latest_version
187+
run: >
188+
cmake
189+
-B "${{github.workspace}}/latest_version/build"
190+
-DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}"
191+
-DCMAKE_C_COMPILER=cl
192+
-DCMAKE_CXX_COMPILER=cl
193+
-DUMF_BUILD_SHARED_LIBRARY=ON
194+
-DUMF_BUILD_TESTS=OFF
195+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
196+
-DUMF_BUILD_CUDA_PROVIDER=ON
197+
-DUMF_FORMAT_CODE_STYLE=OFF
198+
-DUMF_DEVELOPER_MODE=ON
199+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
200+
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
201+
-DUMF_TESTS_FAIL_ON_SKIP=ON
202+
203+
- name: Build latest UMF
204+
run: cmake --build "${{github.workspace}}/latest_version/build" --config Debug -j $Env:NUMBER_OF_PROCESSORS
205+
206+
- name: Run "tag" UMF tests with latest UMF libs (warnings enabled)
207+
working-directory: ${{github.workspace}}/tag_version/build
208+
run: |
209+
$env:UMF_LOG="level:warning;flush:debug;output:stderr;pid:no"
210+
cp ${{github.workspace}}/latest_version/build/bin/Debug/umf.dll ${{github.workspace}}/tag_version/build/bin/Debug/umf.dll
211+
ctest -C Debug --output-on-failure --test-dir test

RELEASE_STEPS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Do changes for a release:
4040
- Add an entry to ChangeLog, remember to change the day of the week in the release date
4141
- For major and minor (prior 1.0.0) releases mention API and ABI compatibility with the previous release
4242
- For major and minor releases, update `UMF_VERSION_CURRENT` in `include/umf/base.h` (the API version)
43+
- For changes in ops structures, update corresponding UMF_*_OPS_VERSION_CURRENT
4344
- For major and minor (prior 1.0.0) releases update ABI version in `.map` and `.def` files
4445
- These files are defined for all public libraries (`libumf` and `proxy_lib`, at the moment)
4546
- Commit these changes and tag the release:

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: 6 additions & 1 deletion
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
///
2530
typedef struct umf_memory_pool_ops_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
///

include/umf/memory_provider_ops.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (C) 2023-2024 Intel Corporation
3+
* Copyright (C) 2023-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
@@ -16,6 +16,11 @@
1616
extern "C" {
1717
#endif
1818

19+
/// @brief Version of the Memory Provider ops structure.
20+
/// NOTE: This is equal to the latest UMF version, in which the ops structure
21+
/// has been modified.
22+
#define UMF_PROVIDER_OPS_VERSION_CURRENT UMF_MAKE_VERSION(0, 11)
23+
1924
///
2025
/// @brief This structure comprises optional function pointers used
2126
/// by corresponding umfMemoryProvider* calls. A memory provider implementation
@@ -143,7 +148,7 @@ typedef struct umf_memory_provider_ipc_ops_t {
143148
///
144149
typedef struct umf_memory_provider_ops_t {
145150
/// Version of the ops structure.
146-
/// Should be initialized using UMF_VERSION_CURRENT.
151+
/// Should be initialized using UMF_PROVIDER_OPS_VERSION_CURRENT.
147152
uint32_t version;
148153

149154
///

src/cpp_helpers.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (C) 2023-2024 Intel Corporation
3+
* Copyright (C) 2023-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
@@ -67,7 +67,7 @@ umf_result_t initialize(T *obj, ArgsTuple &&args) {
6767

6868
template <typename T> umf_memory_pool_ops_t poolOpsBase() {
6969
umf_memory_pool_ops_t ops{};
70-
ops.version = UMF_VERSION_CURRENT;
70+
ops.version = UMF_POOL_OPS_VERSION_CURRENT;
7171
ops.finalize = [](void *obj) { delete reinterpret_cast<T *>(obj); };
7272
UMF_ASSIGN_OP(ops, T, malloc, ((void *)nullptr));
7373
UMF_ASSIGN_OP(ops, T, calloc, ((void *)nullptr));
@@ -81,7 +81,7 @@ template <typename T> umf_memory_pool_ops_t poolOpsBase() {
8181

8282
template <typename T> constexpr umf_memory_provider_ops_t providerOpsBase() {
8383
umf_memory_provider_ops_t ops{};
84-
ops.version = UMF_VERSION_CURRENT;
84+
ops.version = UMF_PROVIDER_OPS_VERSION_CURRENT;
8585
ops.finalize = [](void *obj) { delete reinterpret_cast<T *>(obj); };
8686
UMF_ASSIGN_OP(ops, T, alloc, UMF_RESULT_ERROR_UNKNOWN);
8787
UMF_ASSIGN_OP(ops, T, free, UMF_RESULT_ERROR_UNKNOWN);

src/ipc.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (C) 2023-2024 Intel Corporation
3+
* Copyright (C) 2023-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
@@ -15,6 +15,7 @@
1515
#include "base_alloc_global.h"
1616
#include "ipc_internal.h"
1717
#include "memory_pool_internal.h"
18+
#include "memory_provider_internal.h"
1819
#include "provider/provider_tracking.h"
1920
#include "utils_common.h"
2021
#include "utils_log.h"
@@ -123,14 +124,14 @@ umf_result_t umfOpenIPCHandle(umf_ipc_handler_handle_t hIPCHandler,
123124
umf_ipc_handle_t umfIPCHandle, void **ptr) {
124125

125126
// IPC handler is an instance of tracking memory provider
126-
if (*(uint32_t *)hIPCHandler != UMF_VERSION_CURRENT) {
127+
umf_memory_provider_handle_t hProvider = hIPCHandler;
128+
if (hProvider->ops.version != UMF_PROVIDER_OPS_VERSION_CURRENT) {
127129
// It is a temporary hack to verify that user passes correct IPC handler,
128130
// not a pool handle, as it was required in previous version.
129131
LOG_ERR("Invalid IPC handler.");
130132
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
131133
}
132134

133-
umf_memory_provider_handle_t hProvider = hIPCHandler;
134135
void *base = NULL;
135136

136137
umf_result_t ret = umfMemoryProviderOpenIPCHandle(

0 commit comments

Comments
 (0)