Skip to content

Commit 2f15623

Browse files
committed
Merge branch 'main' into user-after-free
2 parents 8c823c5 + a504ead commit 2f15623

File tree

77 files changed

+2071
-489
lines changed

Some content is hidden

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

77 files changed

+2071
-489
lines changed

.github/workflows/cmake.yml

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -115,50 +115,51 @@ jobs:
115115
working-directory: ${{github.workspace}}/build
116116
run: ctest -C ${{matrix.build_type}} --output-on-failure -L "umf|loader|validation|tracing|unit|urtrace"
117117

118-
fuzztest-build:
119-
name: Build and run quick fuzztest scenarios
120-
strategy:
121-
matrix:
122-
build_type: [Debug, Release]
123-
compiler: [{c: clang, cxx: clang++}]
124-
125-
runs-on: 'ubuntu-22.04'
126-
127-
steps:
128-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
129-
130-
- name: Install pip packages
131-
run: pip install -r third_party/requirements.txt
132-
133-
- name: Download DPC++
134-
run: |
135-
sudo apt install libncurses5
136-
wget -O ${{github.workspace}}/dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/sycl-nightly%2F20230626/dpcpp-compiler.tar.gz
137-
tar -xvf ${{github.workspace}}/dpcpp_compiler.tar.gz
138-
139-
- name: Setup DPC++
140-
run: |
141-
source ${{github.workspace}}/dpcpp_compiler/startup.sh
142-
143-
- name: Configure CMake
144-
run: >
145-
cmake
146-
-B${{github.workspace}}/build
147-
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
148-
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
149-
-DUR_ENABLE_TRACING=ON
150-
-DCMAKE_BUILD_TYPE=${{matrix.build_type}}
151-
-DUR_BUILD_TESTS=ON
152-
-DUR_USE_ASAN=ON
153-
-DUR_USE_UBSAN=ON
154-
-DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++
155-
156-
- name: Build
157-
run: cmake --build ${{github.workspace}}/build -j $(nproc)
158-
159-
- name: Fuzz test
160-
working-directory: ${{github.workspace}}/build
161-
run: ctest -C ${{matrix.build_type}} --output-on-failure -L "fuzz-short"
118+
# Disable short fuzz tests until the ubuntu-22.04 runner is fixed
119+
# fuzztest-build:
120+
# name: Build and run quick fuzztest scenarios
121+
# strategy:
122+
# matrix:
123+
# build_type: [Debug, Release]
124+
# compiler: [{c: clang, cxx: clang++}]
125+
126+
# runs-on: 'ubuntu-22.04'
127+
128+
# steps:
129+
# - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
130+
131+
# - name: Install pip packages
132+
# run: pip install -r third_party/requirements.txt
133+
134+
# - name: Download DPC++
135+
# run: |
136+
# sudo apt install libncurses5
137+
# wget -O ${{github.workspace}}/dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/sycl-nightly%2F20230626/dpcpp-compiler.tar.gz
138+
# tar -xvf ${{github.workspace}}/dpcpp_compiler.tar.gz
139+
140+
# - name: Setup DPC++
141+
# run: |
142+
# source ${{github.workspace}}/dpcpp_compiler/startup.sh
143+
144+
# - name: Configure CMake
145+
# run: >
146+
# cmake
147+
# -B${{github.workspace}}/build
148+
# -DCMAKE_C_COMPILER=${{matrix.compiler.c}}
149+
# -DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
150+
# -DUR_ENABLE_TRACING=ON
151+
# -DCMAKE_BUILD_TYPE=${{matrix.build_type}}
152+
# -DUR_BUILD_TESTS=ON
153+
# -DUR_USE_ASAN=ON
154+
# -DUR_USE_UBSAN=ON
155+
# -DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++
156+
157+
# - name: Build
158+
# run: cmake --build ${{github.workspace}}/build -j $(nproc)
159+
160+
# - name: Fuzz test
161+
# working-directory: ${{github.workspace}}/build
162+
# run: ctest -C ${{matrix.build_type}} --output-on-failure -L "fuzz-short"
162163

163164
adapter-build-hw:
164165
name: Build - Adapters on HW

.github/workflows/coverage.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Coverage
22

3-
on: [push, pull_request]
3+
# Don't run this workflow on push trigger, because it requires
4+
# a token, which we don't have and can't generate.
5+
# Long term solution is to switch to a different tool, ref. #1465
6+
on: [pull_request]
47

58
permissions:
69
contents: read

.github/workflows/nightly.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
LD_LIBRARY_PATH=${{github.workspace}}/dpcpp_compiler/lib
4949
cmake --build ${{github.workspace}}/build -j $(nproc)
5050
51-
- name: Fuzz long test
52-
working-directory: ${{github.workspace}}/build
53-
run: ctest -C ${{matrix.build_type}} --output-on-failure -L "fuzz-long"
51+
# Disable long fuzz tests until the ubuntu-22.04 runner is fixed
52+
# - name: Fuzz long test
53+
# working-directory: ${{github.workspace}}/build
54+
# run: ctest -C ${{matrix.build_type}} --output-on-failure -L "fuzz-long"

.github/workflows/scorecard.yml

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
# This workflow uses actions that are not certified by GitHub. They are provided
2-
# by a third-party and are governed by separate terms of service, privacy
3-
# policy, and support documentation.
4-
1+
# Scorecard analysis, looking for vulnerabilities and bad practices in the repo.
52
name: Scorecard supply-chain security
63
on:
74
# For Branch-Protection check. Only the default branch is supported. See
85
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
96
branch_protection_rule:
10-
# To guarantee Maintained check is occasionally updated. See
11-
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
127
workflow_dispatch:
138
schedule:
9+
# Runs at 22:45 UTC on Thursday.
1410
- cron: '45 22 * * 4'
1511
push:
1612
branches: [ "main" ]
@@ -27,9 +23,6 @@ jobs:
2723
security-events: write
2824
# Needed to publish results and get a badge (see publish_results below).
2925
id-token: write
30-
# Uncomment the permissions below if installing in a private repository.
31-
# contents: read
32-
# actions: read
3326

3427
steps:
3528
- name: "Checkout code"
@@ -38,36 +31,30 @@ jobs:
3831
persist-credentials: false
3932

4033
- name: "Run analysis"
41-
uses: ossf/scorecard-action@e38b1902ae4f44df626f11ba0734b14fb91f8f86 # v2.1.2
34+
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
4235
with:
43-
results_file: results.sarif
36+
results_file: scorecard_results.sarif
4437
results_format: sarif
4538
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
4639
# - you want to enable the Branch-Protection check on a *public* repository, or
4740
# - you are installing Scorecard on a *private* repository
4841
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
4942
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
5043

51-
# Public repositories:
52-
# - Publish results to OpenSSF REST API for easy access by consumers
53-
# - Allows the repository to include the Scorecard badge.
54-
# - See https://github.com/ossf/scorecard-action#publishing-results.
55-
# For private repositories:
56-
# - `publish_results` will always be set to `false`, regardless
57-
# of the value entered here.
44+
# Publish results to OpenSSF REST API for easy access by consumers
45+
# Allows the repository to include the Scorecard badge.
46+
# See https://github.com/ossf/scorecard-action#publishing-results.
5847
publish_results: true
5948

60-
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
61-
# format to the repository Actions tab.
6249
- name: "Upload artifact"
63-
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
50+
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # 4.3.1
6451
with:
65-
name: SARIF file
66-
path: results.sarif
52+
name: Scorecard results
53+
path: scorecard_results.sarif
6754
retention-days: 5
6855

6956
# Upload the results to GitHub's code scanning dashboard.
7057
- name: "Upload to code-scanning"
71-
uses: github/codeql-action/upload-sarif@b7bf0a3ed3ecfa44160715d7c442788f65f0f923 # v3.23.2
58+
uses: github/codeql-action/upload-sarif@05963f47d870e2cb19a537396c1f668a348c7d8f # v3.24.8
7259
with:
73-
sarif_file: results.sarif
60+
sarif_file: scorecard_results.sarif

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ set(UR_SYCL_LIBRARY_DIR "" CACHE PATH
5252
set(UR_CONFORMANCE_TARGET_TRIPLES "" CACHE STRING
5353
"List of sycl targets to build CTS device binaries for")
5454
set(UR_CONFORMANCE_AMD_ARCH "" CACHE STRING "AMD device target ID to build CTS binaries for")
55+
set(UR_ADAPTER_LEVEL_ZERO_SOURCE_DIR "" CACHE PATH
56+
"Path to external 'level_zero' adapter source dir")
57+
set(UR_ADAPTER_OPENCL_SOURCE_DIR "" CACHE PATH
58+
"Path to external 'opencl' adapter source dir")
59+
set(UR_ADAPTER_CUDA_SOURCE_DIR "" CACHE PATH
60+
"Path to external 'cuda' adapter source dir")
61+
set(UR_ADAPTER_HIP_SOURCE_DIR "" CACHE PATH
62+
"Path to external 'hip' adapter source dir")
63+
set(UR_ADAPTER_NATIVE_CPU_SOURCE_DIR "" CACHE PATH
64+
"Path to external 'native_cpu' adapter source dir")
5565

5666
# There's little reason not to generate the compile_commands.json
5767
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

include/ur_api.h

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ typedef enum ur_function_t {
196196
UR_FUNCTION_ADAPTER_RETAIN = 179, ///< Enumerator for ::urAdapterRetain
197197
UR_FUNCTION_ADAPTER_GET_LAST_ERROR = 180, ///< Enumerator for ::urAdapterGetLastError
198198
UR_FUNCTION_ADAPTER_GET_INFO = 181, ///< Enumerator for ::urAdapterGetInfo
199-
UR_FUNCTION_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_EXP = 182, ///< Enumerator for ::urCommandBufferUpdateKernelLaunchExp
200199
UR_FUNCTION_PROGRAM_BUILD_EXP = 197, ///< Enumerator for ::urProgramBuildExp
201200
UR_FUNCTION_PROGRAM_COMPILE_EXP = 198, ///< Enumerator for ::urProgramCompileExp
202201
UR_FUNCTION_PROGRAM_LINK_EXP = 199, ///< Enumerator for ::urProgramLinkExp
@@ -216,11 +215,13 @@ typedef enum ur_function_t {
216215
UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP = 213, ///< Enumerator for ::urCommandBufferAppendUSMAdviseExp
217216
UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP = 214, ///< Enumerator for ::urEnqueueCooperativeKernelLaunchExp
218217
UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP = 215, ///< Enumerator for ::urKernelSuggestMaxCooperativeGroupCountExp
219-
UR_FUNCTION_COMMAND_BUFFER_RETAIN_COMMAND_EXP = 216, ///< Enumerator for ::urCommandBufferRetainCommandExp
220-
UR_FUNCTION_COMMAND_BUFFER_RELEASE_COMMAND_EXP = 217, ///< Enumerator for ::urCommandBufferReleaseCommandExp
221-
UR_FUNCTION_COMMAND_BUFFER_GET_INFO_EXP = 218, ///< Enumerator for ::urCommandBufferGetInfoExp
222-
UR_FUNCTION_COMMAND_BUFFER_COMMAND_GET_INFO_EXP = 219, ///< Enumerator for ::urCommandBufferCommandGetInfoExp
223-
UR_FUNCTION_DEVICE_GET_SELECTED = 220, ///< Enumerator for ::urDeviceGetSelected
218+
UR_FUNCTION_PROGRAM_GET_GLOBAL_VARIABLE_POINTER = 216, ///< Enumerator for ::urProgramGetGlobalVariablePointer
219+
UR_FUNCTION_DEVICE_GET_SELECTED = 217, ///< Enumerator for ::urDeviceGetSelected
220+
UR_FUNCTION_COMMAND_BUFFER_RETAIN_COMMAND_EXP = 218, ///< Enumerator for ::urCommandBufferRetainCommandExp
221+
UR_FUNCTION_COMMAND_BUFFER_RELEASE_COMMAND_EXP = 219, ///< Enumerator for ::urCommandBufferReleaseCommandExp
222+
UR_FUNCTION_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_EXP = 220, ///< Enumerator for ::urCommandBufferUpdateKernelLaunchExp
223+
UR_FUNCTION_COMMAND_BUFFER_GET_INFO_EXP = 221, ///< Enumerator for ::urCommandBufferGetInfoExp
224+
UR_FUNCTION_COMMAND_BUFFER_COMMAND_GET_INFO_EXP = 222, ///< Enumerator for ::urCommandBufferCommandGetInfoExp
224225
/// @cond
225226
UR_FUNCTION_FORCE_UINT32 = 0x7fffffff
226227
/// @endcond
@@ -4327,6 +4328,42 @@ urProgramGetFunctionPointer(
43274328
void **ppFunctionPointer ///< [out] Returns the pointer to the function if it is found in the program.
43284329
);
43294330

4331+
///////////////////////////////////////////////////////////////////////////////
4332+
/// @brief Retrieves a pointer to a device global variable.
4333+
///
4334+
/// @details
4335+
/// - Retrieves a pointer to a device global variable.
4336+
/// - The application may call this function from simultaneous threads for
4337+
/// the same device.
4338+
/// - The implementation of this function should be thread-safe.
4339+
///
4340+
/// @remarks
4341+
/// _Analogues_
4342+
/// - **clGetDeviceGlobalVariablePointerINTEL**
4343+
///
4344+
/// @returns
4345+
/// - ::UR_RESULT_SUCCESS
4346+
/// - ::UR_RESULT_ERROR_UNINITIALIZED
4347+
/// - ::UR_RESULT_ERROR_DEVICE_LOST
4348+
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
4349+
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
4350+
/// + `NULL == hDevice`
4351+
/// + `NULL == hProgram`
4352+
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
4353+
/// + `NULL == pGlobalVariableName`
4354+
/// + `NULL == ppGlobalVariablePointerRet`
4355+
/// - ::UR_RESULT_ERROR_INVALID_VALUE
4356+
/// + `name` is not a valid variable in the program.
4357+
UR_APIEXPORT ur_result_t UR_APICALL
4358+
urProgramGetGlobalVariablePointer(
4359+
ur_device_handle_t hDevice, ///< [in] handle of the device to retrieve the pointer for.
4360+
ur_program_handle_t hProgram, ///< [in] handle of the program where the global variable is.
4361+
const char *pGlobalVariableName, ///< [in] mangled name of the global variable to retrieve the pointer for.
4362+
size_t *pGlobalVariableSizeRet, ///< [out][optional] Returns the size of the global variable if it is found
4363+
///< in the program.
4364+
void **ppGlobalVariablePointerRet ///< [out] Returns the pointer to the global variable if it is found in the program.
4365+
);
4366+
43304367
///////////////////////////////////////////////////////////////////////////////
43314368
/// @brief Get Program object information
43324369
typedef enum ur_program_info_t {
@@ -8927,6 +8964,13 @@ urUSMReleaseExp(
89278964
#if !defined(__GNUC__)
89288965
#pragma region usm p2p(experimental)
89298966
#endif
8967+
///////////////////////////////////////////////////////////////////////////////
8968+
#ifndef UR_USM_P2P_EXTENSION_STRING_EXP
8969+
/// @brief The extension string that defines support for USM P2P which is
8970+
/// returned when querying device extensions.
8971+
#define UR_USM_P2P_EXTENSION_STRING_EXP "ur_exp_usm_p2p"
8972+
#endif // UR_USM_P2P_EXTENSION_STRING_EXP
8973+
89308974
///////////////////////////////////////////////////////////////////////////////
89318975
/// @brief Supported peer info
89328976
typedef enum ur_exp_peer_info_t {
@@ -9463,6 +9507,18 @@ typedef struct ur_program_get_function_pointer_params_t {
94639507
void ***pppFunctionPointer;
94649508
} ur_program_get_function_pointer_params_t;
94659509

9510+
///////////////////////////////////////////////////////////////////////////////
9511+
/// @brief Function parameters for urProgramGetGlobalVariablePointer
9512+
/// @details Each entry is a pointer to the parameter passed to the function;
9513+
/// allowing the callback the ability to modify the parameter's value
9514+
typedef struct ur_program_get_global_variable_pointer_params_t {
9515+
ur_device_handle_t *phDevice;
9516+
ur_program_handle_t *phProgram;
9517+
const char **ppGlobalVariableName;
9518+
size_t **ppGlobalVariableSizeRet;
9519+
void ***pppGlobalVariablePointerRet;
9520+
} ur_program_get_global_variable_pointer_params_t;
9521+
94669522
///////////////////////////////////////////////////////////////////////////////
94679523
/// @brief Function parameters for urProgramGetInfo
94689524
/// @details Each entry is a pointer to the parameter passed to the function;

include/ur_ddi.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,15 @@ typedef ur_result_t(UR_APICALL *ur_pfnProgramGetFunctionPointer_t)(
329329
const char *,
330330
void **);
331331

332+
///////////////////////////////////////////////////////////////////////////////
333+
/// @brief Function-pointer for urProgramGetGlobalVariablePointer
334+
typedef ur_result_t(UR_APICALL *ur_pfnProgramGetGlobalVariablePointer_t)(
335+
ur_device_handle_t,
336+
ur_program_handle_t,
337+
const char *,
338+
size_t *,
339+
void **);
340+
332341
///////////////////////////////////////////////////////////////////////////////
333342
/// @brief Function-pointer for urProgramGetInfo
334343
typedef ur_result_t(UR_APICALL *ur_pfnProgramGetInfo_t)(
@@ -380,6 +389,7 @@ typedef struct ur_program_dditable_t {
380389
ur_pfnProgramRetain_t pfnRetain;
381390
ur_pfnProgramRelease_t pfnRelease;
382391
ur_pfnProgramGetFunctionPointer_t pfnGetFunctionPointer;
392+
ur_pfnProgramGetGlobalVariablePointer_t pfnGetGlobalVariablePointer;
383393
ur_pfnProgramGetInfo_t pfnGetInfo;
384394
ur_pfnProgramGetBuildInfo_t pfnGetBuildInfo;
385395
ur_pfnProgramSetSpecializationConstants_t pfnSetSpecializationConstants;

include/ur_print.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urPrintProgramReleaseParams(const struct ur_
13061306
/// - `buff_size < out_size`
13071307
UR_APIEXPORT ur_result_t UR_APICALL urPrintProgramGetFunctionPointerParams(const struct ur_program_get_function_pointer_params_t *params, char *buffer, const size_t buff_size, size_t *out_size);
13081308

1309+
///////////////////////////////////////////////////////////////////////////////
1310+
/// @brief Print ur_program_get_global_variable_pointer_params_t struct
1311+
/// @returns
1312+
/// - ::UR_RESULT_SUCCESS
1313+
/// - ::UR_RESULT_ERROR_INVALID_SIZE
1314+
/// - `buff_size < out_size`
1315+
UR_APIEXPORT ur_result_t UR_APICALL urPrintProgramGetGlobalVariablePointerParams(const struct ur_program_get_global_variable_pointer_params_t *params, char *buffer, const size_t buff_size, size_t *out_size);
1316+
13091317
///////////////////////////////////////////////////////////////////////////////
13101318
/// @brief Print ur_program_get_info_params_t struct
13111319
/// @returns

0 commit comments

Comments
 (0)