Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYCL][UR] Combined CTS fixes for CL adapter. #11794

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions sycl/plugins/unified_runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ if(SYCL_PI_UR_USE_FETCH_CONTENT)
include(FetchContent)

set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
# commit ec7982bac6cb3a6b9ed610cd6b7cb41fcbc780dc
# Merge: 62e6d2f9 5fb82924
# commit 192e9404392c38ac43d09116d6c97e153c66f46b
# Merge: 2f44433c f65473d9
# Author: Kenneth Benzie (Benie) <k.benzie@codeplay.com>
# Date: Wed Nov 8 13:32:46 2023 +0000
# Merge pull request #1022 from 0x12CC/l0_usm_error_checking_2
# [UR][L0] Propagate OOM errors from `USMAllocationMakeResident`
set(UNIFIED_RUNTIME_TAG ec7982bac6cb3a6b9ed610cd6b7cb41fcbc780dc)
# Date: Fri Nov 10 13:25:42 2023 +0000
# Merge pull request #1044 from aarongreig/aaron/clCTSFixMegaBranch
# [OpenCL] Combined CTS fixes
set(UNIFIED_RUNTIME_TAG 192e9404392c38ac43d09116d6c97e153c66f46b)

if(SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO)
set(UNIFIED_RUNTIME_REPO "${SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO}")
Expand Down
14 changes: 12 additions & 2 deletions sycl/plugins/unified_runtime/pi2ur.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2336,8 +2336,18 @@ inline pi_result piKernelGetInfo(pi_kernel Kernel, pi_kernel_info ParamName,
break;
}
case PI_KERNEL_INFO_NUM_ARGS: {
UrParamName = UR_KERNEL_INFO_NUM_ARGS;
break;
size_t NumArgs = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do use use different types for different Num*?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turned out this particular query has always been size_t in UR, one of the fixes we're pulling in causes that to be properly validated now so we need to do this bit of translation. We do plan to fix this for the next release cycle oneapi-src/unified-runtime#1038

HANDLE_ERRORS(urKernelGetInfo(UrKernel, UR_KERNEL_INFO_NUM_ARGS,
sizeof(NumArgs), &NumArgs, nullptr));
if (ParamValueSizeRet) {
*ParamValueSizeRet = sizeof(uint32_t);
}
if (ParamValue) {
if (ParamValueSize != sizeof(uint32_t))
return PI_ERROR_INVALID_BUFFER_SIZE;
*static_cast<uint32_t *>(ParamValue) = static_cast<uint32_t>(NumArgs);
}
return PI_SUCCESS;
}
case PI_KERNEL_INFO_REFERENCE_COUNT: {
UrParamName = UR_KERNEL_INFO_REFERENCE_COUNT;
Expand Down
4 changes: 2 additions & 2 deletions sycl/source/backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ make_kernel_bundle(pi_native_handle NativeHandle, const context &TargetContext,
Plugin->call<PiApiKind::piProgramRetain>(PiProgram);

std::vector<pi::PiDevice> ProgramDevices;
size_t NumDevices = 0;
uint32_t NumDevices = 0;

Plugin->call<PiApiKind::piProgramGetInfo>(
PiProgram, PI_PROGRAM_INFO_NUM_DEVICES, sizeof(size_t), &NumDevices,
PiProgram, PI_PROGRAM_INFO_NUM_DEVICES, sizeof(NumDevices), &NumDevices,
nullptr);
ProgramDevices.resize(NumDevices);
Plugin->call<PiApiKind::piProgramGetInfo>(PiProgram, PI_PROGRAM_INFO_DEVICES,
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/context_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ context_impl::context_impl(sycl::detail::pi::PiContext PiContext,
MSupportBufferLocationByDevices(NotChecked) {

std::vector<sycl::detail::pi::PiDevice> DeviceIds;
size_t DevicesNum = 0;
uint32_t DevicesNum = 0;
// TODO catch an exception and put it to list of asynchronous exceptions
Plugin->call<PiApiKind::piContextGetInfo>(
MContext, PI_CONTEXT_INFO_NUM_DEVICES, sizeof(DevicesNum), &DevicesNum,
Expand Down