Skip to content

Commit

Permalink
Merge pull request #2139 from nrspruit/zeHandle_copy_dependencies
Browse files Browse the repository at this point in the history
[L0] Pass and track event dependencies required before executing Memory Copy buffer inits
  • Loading branch information
aarongreig authored Oct 2, 2024
2 parents cc2d590 + 98a67a2 commit 00f958f
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 59 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/multi_device.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ jobs:
- name: Install pip packages
run: pip install -r third_party/requirements.txt

# TODO: enable once test failure are fixed/ignored
# - name: Download DPC++
# run: |
# wget -O ${{github.workspace}}/dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/nightly-2024-09-27/sycl_linux.tar.gz
# mkdir dpcpp_compiler
# tar -xvf ${{github.workspace}}/dpcpp_compiler.tar.gz -C dpcpp_compiler
- name: Download DPC++
run: |
wget -O ${{github.workspace}}/dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/nightly-2024-01-29/sycl_linux.tar.gz
mkdir dpcpp_compiler
tar -xvf ${{github.workspace}}/dpcpp_compiler.tar.gz -C dpcpp_compiler
- name: Configure CMake
shell: bash -el {0}
Expand All @@ -49,6 +48,8 @@ jobs:
-DUR_BUILD_TESTS=ON
-DUR_BUILD_ADAPTER_${{matrix.adapter.name}}=ON
-DUR_TEST_DEVICES_COUNT=2
-DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++
-DUR_SYCL_LIBRARY_DIR=${{github.workspace}}/dpcpp_compiler/lib
- name: Build
run: cmake --build ${{github.workspace}}/build -j $(nproc)
Expand All @@ -60,4 +61,4 @@ jobs:

- name: Test adapters
working-directory: ${{github.workspace}}/build
run: env UR_CTS_ADAPTER_PLATFORM="${{matrix.adapter.platform}}" ctest -C ${{matrix.build_type}} --output-on-failure -L "conformance" --timeout 180
run: env UR_CTS_ADAPTER_PLATFORM="${{matrix.adapter.platform}}" ctest -C ${{matrix.build_type}} --output-on-failure -L "conformance" -E "enqueue|kernel|program|integration|exp_command_buffer|exp_enqueue_native|exp_launch_properties|exp_usm_p2p" --timeout 180
22 changes: 11 additions & 11 deletions source/adapters/level_zero/command_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ setKernelPendingArguments(ur_exp_command_buffer_handle_t CommandBuffer,
char **ZeHandlePtr = nullptr;
if (Arg.Value) {
UR_CALL(Arg.Value->getZeHandlePtr(ZeHandlePtr, Arg.AccessMode,
CommandBuffer->Device));
CommandBuffer->Device, nullptr, 0u));
}
ZE2UR_CALL(zeKernelSetArgumentValue,
(Kernel->ZeKernel, Arg.Index, Arg.Size, ZeHandlePtr));
Expand Down Expand Up @@ -826,10 +826,10 @@ ur_result_t urCommandBufferAppendMemBufferCopyExp(

char *ZeHandleSrc;
UR_CALL(SrcBuffer->getZeHandle(ZeHandleSrc, ur_mem_handle_t_::read_only,
CommandBuffer->Device));
CommandBuffer->Device, nullptr, 0u));
char *ZeHandleDst;
UR_CALL(DstBuffer->getZeHandle(ZeHandleDst, ur_mem_handle_t_::write_only,
CommandBuffer->Device));
CommandBuffer->Device, nullptr, 0u));

bool PreferCopyEngine = (SrcBuffer->OnHost || DstBuffer->OnHost);

Expand Down Expand Up @@ -858,10 +858,10 @@ ur_result_t urCommandBufferAppendMemBufferCopyRectExp(

char *ZeHandleSrc;
UR_CALL(SrcBuffer->getZeHandle(ZeHandleSrc, ur_mem_handle_t_::read_only,
CommandBuffer->Device));
CommandBuffer->Device, nullptr, 0u));
char *ZeHandleDst;
UR_CALL(DstBuffer->getZeHandle(ZeHandleDst, ur_mem_handle_t_::write_only,
CommandBuffer->Device));
CommandBuffer->Device, nullptr, 0u));

bool PreferCopyEngine = (SrcBuffer->OnHost || DstBuffer->OnHost);

Expand All @@ -884,7 +884,7 @@ ur_result_t urCommandBufferAppendMemBufferWriteExp(

char *ZeHandleDst = nullptr;
UR_CALL(Buffer->getZeHandle(ZeHandleDst, ur_mem_handle_t_::write_only,
CommandBuffer->Device));
CommandBuffer->Device, nullptr, 0u));
// Always prefer copy engine for writes
bool PreferCopyEngine = true;

Expand All @@ -908,7 +908,7 @@ ur_result_t urCommandBufferAppendMemBufferWriteRectExp(

char *ZeHandleDst = nullptr;
UR_CALL(Buffer->getZeHandle(ZeHandleDst, ur_mem_handle_t_::write_only,
CommandBuffer->Device));
CommandBuffer->Device, nullptr, 0u));

// Always prefer copy engine for writes
bool PreferCopyEngine = true;
Expand All @@ -930,7 +930,7 @@ ur_result_t urCommandBufferAppendMemBufferReadExp(

char *ZeHandleSrc = nullptr;
UR_CALL(Buffer->getZeHandle(ZeHandleSrc, ur_mem_handle_t_::read_only,
CommandBuffer->Device));
CommandBuffer->Device, nullptr, 0u));

// Always prefer copy engine for reads
bool PreferCopyEngine = true;
Expand All @@ -953,7 +953,7 @@ ur_result_t urCommandBufferAppendMemBufferReadRectExp(

char *ZeHandleSrc;
UR_CALL(Buffer->getZeHandle(ZeHandleSrc, ur_mem_handle_t_::read_only,
CommandBuffer->Device));
CommandBuffer->Device, nullptr, 0u));

// Always prefer copy engine for reads
bool PreferCopyEngine = true;
Expand Down Expand Up @@ -1078,7 +1078,7 @@ ur_result_t urCommandBufferAppendMemBufferFillExp(
char *ZeHandleDst = nullptr;
_ur_buffer *UrBuffer = reinterpret_cast<_ur_buffer *>(Buffer);
UR_CALL(UrBuffer->getZeHandle(ZeHandleDst, ur_mem_handle_t_::write_only,
CommandBuffer->Device));
CommandBuffer->Device, nullptr, 0u));

return enqueueCommandBufferFillHelper(
UR_COMMAND_MEM_BUFFER_FILL, CommandBuffer, ZeHandleDst + Offset,
Expand Down Expand Up @@ -1512,7 +1512,7 @@ ur_result_t updateKernelCommand(
char **ZeHandlePtr = nullptr;
if (NewMemObjArg) {
UR_CALL(NewMemObjArg->getZeHandlePtr(ZeHandlePtr, UrAccessMode,
CommandBuffer->Device));
CommandBuffer->Device, nullptr, 0u));
}

auto ZeMutableArgDesc =
Expand Down
6 changes: 4 additions & 2 deletions source/adapters/level_zero/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ ur_result_t urEnqueueKernelLaunch(
char **ZeHandlePtr = nullptr;
if (Arg.Value) {
UR_CALL(Arg.Value->getZeHandlePtr(ZeHandlePtr, Arg.AccessMode,
Queue->Device));
Queue->Device, EventWaitList,
NumEventsInWaitList));
}
ZE2UR_CALL(zeKernelSetArgumentValue,
(ZeKernel, Arg.Index, Arg.Size, ZeHandlePtr));
Expand Down Expand Up @@ -273,7 +274,8 @@ ur_result_t urEnqueueCooperativeKernelLaunchExp(
char **ZeHandlePtr = nullptr;
if (Arg.Value) {
UR_CALL(Arg.Value->getZeHandlePtr(ZeHandlePtr, Arg.AccessMode,
Queue->Device));
Queue->Device, EventWaitList,
NumEventsInWaitList));
}
ZE2UR_CALL(zeKernelSetArgumentValue,
(ZeKernel, Arg.Index, Arg.Size, ZeHandlePtr));
Expand Down
Loading

0 comments on commit 00f958f

Please sign in to comment.