Skip to content

Commit

Permalink
Add some fixes relevant to adapters second bump
Browse files Browse the repository at this point in the history
  • Loading branch information
omarahmed1111 committed Nov 15, 2023
1 parent 3aa5d07 commit 28b2b5b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 28 deletions.
14 changes: 7 additions & 7 deletions sycl/doc/design/CommandGraph.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ with the following entry-points:
| `urCommandBufferReleaseExp` | Decrementing reference count of command-buffer. |
| `urCommandBufferFinalizeExp` | No more commands can be appended, makes command-buffer ready to enqueue on a command-queue. |
| `urCommandBufferAppendKernelLaunchExp` | Append a kernel execution command to command-buffer. |
| `urCommandBufferAppendMemcpyUSMExp` | Append a USM memcpy command to the command-buffer. |
| `urCommandBufferAppendMembufferCopyExp` | Append a mem buffer copy command to the command-buffer. |
| `urCommandBufferAppendMembufferWriteExp` | Append a memory write command to a command-buffer object. |
| `urCommandBufferAppendMembufferReadExp` | Append a memory read command to a command-buffer object. |
| `urCommandBufferAppendMembufferCopyRectExp` | Append a rectangular memory copy command to a command-buffer object. |
| `urCommandBufferAppendMembufferWriteRectExp` | Append a rectangular memory write command to a command-buffer object. |
| `urCommandBufferAppendMembufferReadRectExp` | Append a rectangular memory read command to a command-buffer object. |
| `urCommandBufferAppendUSMMemcpyExp` | Append a USM memcpy command to the command-buffer. |
| `urCommandBufferAppendMemBufferCopyExp` | Append a mem buffer copy command to the command-buffer. |
| `urCommandBufferAppendMemBufferWriteExp` | Append a memory write command to a command-buffer object. |
| `urCommandBufferAppendMemBufferReadExp` | Append a memory read command to a command-buffer object. |
| `urCommandBufferAppendMemBufferCopyRectExp` | Append a rectangular memory copy command to a command-buffer object. |
| `urCommandBufferAppendMemBufferWriteRectExp` | Append a rectangular memory write command to a command-buffer object. |
| `urCommandBufferAppendMemBufferReadRectExp` | Append a rectangular memory read command to a command-buffer object. |
| `urCommandBufferEnqueueExp` | Submit command-buffer to a command-queue for execution. |

See the [UR EXP-COMMAND-BUFFER](https://oneapi-src.github.io/unified-runtime/core/EXP-COMMAND-BUFFER.html)
Expand Down
14 changes: 7 additions & 7 deletions sycl/plugins/unified_runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ endif()
if(SYCL_PI_UR_USE_FETCH_CONTENT)
include(FetchContent)

set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
# commit 659d3f469faa99a886fa680a3d6d20449b109578
# Merge: 192e9404 f94550b4
set(UNIFIED_RUNTIME_REPO "https://github.com/omarahmed1111/unified-runtime.git")

# commit be53fb3ba5bf1ac33051456d72c61b6a01d94a72
# Author: Kenneth Benzie (Benie) <[email protected]>
# Date: Tue Nov 14 16:45:24 2023 +0000
# Merge pull request #1059 from martygrant/martin/moveNativeCPUAdapterToUR
# [NATIVECPU] Move Native CPU adapter to UR.
set(UNIFIED_RUNTIME_TAG 659d3f469faa99a886fa680a3d6d20449b109578)
# Date: Tue Oct 31 13:22:52 2023 +0000
# - Merge pull request #932 from Bensuo/cuda-cmd-buffers
# - [CUDA][EXP] CUDA adapter support for command buffers
set(UNIFIED_RUNTIME_TAG dad65343c75c3a98728facb66b2c6d7425990729)

if(SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO)
set(UNIFIED_RUNTIME_REPO "${SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO}")
Expand Down
19 changes: 7 additions & 12 deletions sycl/plugins/unified_runtime/pi2ur.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,10 +787,6 @@ inline pi_result piTearDown(void *PluginParameter) {
});
HANDLE_ERRORS(Ret);

// TODO: Dont check for errors in urTearDown, since
// when using Level Zero plugin, the second urTearDown
// will fail as ur_loader.so has already been unloaded,
urTearDown(nullptr);
return PI_SUCCESS;
}

Expand All @@ -799,7 +795,6 @@ inline pi_result piTearDown(void *PluginParameter) {
inline pi_result piPlatformsGet(pi_uint32 NumEntries, pi_platform *Platforms,
pi_uint32 *NumPlatforms) {

urInit(0, nullptr);
// We're not going through the UR loader so we're guaranteed to have exactly
// one adapter (whichever is statically linked). The PI plugin for UR has its
// own implementation of piPlatformsGet.
Expand Down Expand Up @@ -4354,7 +4349,7 @@ inline pi_result piextCommandBufferMemcpyUSM(
ur_exp_command_buffer_handle_t UrCommandBuffer =
reinterpret_cast<ur_exp_command_buffer_handle_t>(CommandBuffer);

HANDLE_ERRORS(urCommandBufferAppendMemcpyUSMExp(
HANDLE_ERRORS(urCommandBufferAppendUSMMemcpyExp(
UrCommandBuffer, DstPtr, SrcPtr, Size, NumSyncPointsInWaitList,
SyncPointWaitList, SyncPoint));

Expand All @@ -4372,7 +4367,7 @@ inline pi_result piextCommandBufferMemBufferCopy(
ur_mem_handle_t UrSrcMem = reinterpret_cast<ur_mem_handle_t>(SrcMem);
ur_mem_handle_t UrDstMem = reinterpret_cast<ur_mem_handle_t>(DstMem);

HANDLE_ERRORS(urCommandBufferAppendMembufferCopyExp(
HANDLE_ERRORS(urCommandBufferAppendMemBufferCopyExp(
UrCommandBuffer, UrSrcMem, UrDstMem, SrcOffset, DstOffset, Size,
NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint));

Expand Down Expand Up @@ -4400,7 +4395,7 @@ inline pi_result piextCommandBufferMemBufferCopyRect(
UrRegion.height = Region->height_scalar;
UrRegion.width = Region->width_bytes;

HANDLE_ERRORS(urCommandBufferAppendMembufferCopyRectExp(
HANDLE_ERRORS(urCommandBufferAppendMemBufferCopyRectExp(
UrCommandBuffer, UrSrcMem, UrDstMem, UrSrcOrigin, UrDstOrigin, UrRegion,
SrcRowPitch, SrcSlicePitch, DstRowPitch, DstSlicePitch,
NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint));
Expand Down Expand Up @@ -4430,7 +4425,7 @@ inline pi_result piextCommandBufferMemBufferReadRect(
UrRegion.height = Region->height_scalar;
UrRegion.width = Region->width_bytes;

HANDLE_ERRORS(urCommandBufferAppendMembufferReadRectExp(
HANDLE_ERRORS(urCommandBufferAppendMemBufferReadRectExp(
UrCommandBuffer, UrBuffer, UrBufferOffset, UrHostOffset, UrRegion,
BufferRowPitch, BufferSlicePitch, HostRowPitch, HostSlicePitch, Ptr,
NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint));
Expand All @@ -4448,7 +4443,7 @@ inline pi_result piextCommandBufferMemBufferRead(
reinterpret_cast<ur_exp_command_buffer_handle_t>(CommandBuffer);
ur_mem_handle_t UrBuffer = reinterpret_cast<ur_mem_handle_t>(Src);

HANDLE_ERRORS(urCommandBufferAppendMembufferReadExp(
HANDLE_ERRORS(urCommandBufferAppendMemBufferReadExp(
UrCommandBuffer, UrBuffer, Offset, Size, Dst, NumSyncPointsInWaitList,
SyncPointWaitList, SyncPoint));

Expand Down Expand Up @@ -4477,7 +4472,7 @@ inline pi_result piextCommandBufferMemBufferWriteRect(
UrRegion.height = Region->height_scalar;
UrRegion.width = Region->width_bytes;

HANDLE_ERRORS(urCommandBufferAppendMembufferWriteRectExp(
HANDLE_ERRORS(urCommandBufferAppendMemBufferWriteRectExp(
UrCommandBuffer, UrBuffer, UrBufferOffset, UrHostOffset, UrRegion,
BufferRowPitch, BufferSlicePitch, HostRowPitch, HostSlicePitch,
const_cast<void *>(Ptr), NumSyncPointsInWaitList, SyncPointWaitList,
Expand All @@ -4497,7 +4492,7 @@ inline pi_result piextCommandBufferMemBufferWrite(
reinterpret_cast<ur_exp_command_buffer_handle_t>(CommandBuffer);
ur_mem_handle_t UrBuffer = reinterpret_cast<ur_mem_handle_t>(Buffer);

HANDLE_ERRORS(urCommandBufferAppendMembufferWriteExp(
HANDLE_ERRORS(urCommandBufferAppendMemBufferWriteExp(
UrCommandBuffer, UrBuffer, Offset, Size, const_cast<void *>(Ptr),
NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint));

Expand Down
4 changes: 2 additions & 2 deletions sycl/plugins/unified_runtime/pi_unified_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ static void releaseAdapters(std::vector<ur_adapter_handle_t> &Vec) {
for (auto Adapter : Vec) {
urAdapterRelease(Adapter);
}
urTearDown(nullptr);
urLoaderTearDown();
});
}

Expand Down Expand Up @@ -1302,7 +1302,7 @@ __SYCL_EXPORT pi_result piPluginInit(pi_plugin *PluginInit) {
strncpy(PluginInit->PluginVersion, SupportedVersion, PluginVersionSize);

// Initialize UR and discover adapters
HANDLE_ERRORS(urInit(0, nullptr));
HANDLE_ERRORS(urLoaderInit(0, nullptr));
uint32_t NumAdapters;
HANDLE_ERRORS(urAdapterGet(0, nullptr, &NumAdapters));
if (NumAdapters > 0) {
Expand Down

0 comments on commit 28b2b5b

Please sign in to comment.