Skip to content

[Offload] Rename olWaitEvent/Queue to olSyncEvent/Queue #150023

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

Merged
merged 1 commit into from
Jul 23, 2025
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
4 changes: 2 additions & 2 deletions offload/liboffload/API/Event.td
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def : Function {
}

def : Function {
let name = "olWaitEvent";
let desc = "Wait for the event to be complete.";
let name = "olSyncEvent";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would having it spelled out in full as olSynchronizeEvent be preferred?

Copy link
Contributor

Choose a reason for hiding this comment

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

CUDA calls it StreamSynchronize but I don't think we need to be that verbose unless the other functions are all spelled out.

let desc = "Block the calling thread until the event is complete.";
let details = [];
let params = [
Param<"ol_event_handle_t", "Event", "handle of the event", PARAM_IN>
Expand Down
4 changes: 2 additions & 2 deletions offload/liboffload/API/Queue.td
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def : Function {
}

def : Function {
let name = "olWaitQueue";
let desc = "Wait for the enqueued work on a queue to complete.";
let name = "olSyncQueue";
let desc = "Block the calling thread until the enqueued work on a queue is complete.";
let details = [];
let params = [
Param<"ol_queue_handle_t", "Queue", "handle of the queue", PARAM_IN>
Expand Down
4 changes: 2 additions & 2 deletions offload/liboffload/src/OffloadImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ Error olCreateQueue_impl(ol_device_handle_t Device, ol_queue_handle_t *Queue) {

Error olDestroyQueue_impl(ol_queue_handle_t Queue) { return olDestroy(Queue); }

Error olWaitQueue_impl(ol_queue_handle_t Queue) {
Error olSyncQueue_impl(ol_queue_handle_t Queue) {
// Host plugin doesn't have a queue set so it's not safe to call synchronize
// on it, but we have nothing to synchronize in that situation anyway.
if (Queue->AsyncInfo->Queue) {
Expand Down Expand Up @@ -527,7 +527,7 @@ Error olGetQueueInfoSize_impl(ol_queue_handle_t Queue, ol_queue_info_t PropName,
return olGetQueueInfoImplDetail(Queue, PropName, 0, nullptr, PropSizeRet);
}

Error olWaitEvent_impl(ol_event_handle_t Event) {
Error olSyncEvent_impl(ol_event_handle_t Event) {
if (auto Res = Event->Queue->Device->Device->syncEvent(Event->EventInfo))
return Res;

Expand Down
4 changes: 2 additions & 2 deletions offload/unittests/OffloadAPI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ add_offload_unittest("device"

add_offload_unittest("event"
event/olDestroyEvent.cpp
event/olWaitEvent.cpp
event/olSyncEvent.cpp
event/olGetEventInfo.cpp
event/olGetEventInfoSize.cpp)

Expand All @@ -36,7 +36,7 @@ add_offload_unittest("program"

add_offload_unittest("queue"
queue/olCreateQueue.cpp
queue/olWaitQueue.cpp
queue/olSyncQueue.cpp
queue/olDestroyQueue.cpp
queue/olGetQueueInfo.cpp
queue/olGetQueueInfoSize.cpp)
Expand Down
2 changes: 1 addition & 1 deletion offload/unittests/OffloadAPI/common/Fixtures.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ struct OffloadEventTest : OffloadQueueTest {
olMemAlloc(Device, OL_ALLOC_TYPE_DEVICE, sizeof(Value), &Alloc));
ASSERT_SUCCESS(
olMemcpy(Queue, Alloc, Device, &Value, Host, sizeof(Value), &Event));
ASSERT_SUCCESS(olWaitEvent(Event));
ASSERT_SUCCESS(olSyncEvent(Event));
ASSERT_SUCCESS(olMemFree(Alloc));
}

Expand Down
2 changes: 1 addition & 1 deletion offload/unittests/OffloadAPI/event/olDestroyEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ TEST_P(olDestroyEventTest, Success) {
ASSERT_SUCCESS(
olMemcpy(Queue, DstPtr, Device, &Src, Host, sizeof(Src), &Event));
ASSERT_NE(Event, nullptr);
ASSERT_SUCCESS(olWaitQueue(Queue));
ASSERT_SUCCESS(olSyncQueue(Queue));
ASSERT_SUCCESS(olDestroyEvent(Event));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===------- Offload API tests - olWaitEvent -====-------------------------===//
//===------- Offload API tests - olSyncEvent -====-------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -10,10 +10,10 @@
#include <OffloadAPI.h>
#include <gtest/gtest.h>

using olWaitEventTest = OffloadQueueTest;
OFFLOAD_TESTS_INSTANTIATE_DEVICE_FIXTURE(olWaitEventTest);
using olSyncEventTest = OffloadQueueTest;
OFFLOAD_TESTS_INSTANTIATE_DEVICE_FIXTURE(olSyncEventTest);

TEST_P(olWaitEventTest, Success) {
TEST_P(olSyncEventTest, Success) {
uint32_t Src = 42;
void *DstPtr;

Expand All @@ -23,15 +23,15 @@ TEST_P(olWaitEventTest, Success) {
ASSERT_SUCCESS(
olMemcpy(Queue, DstPtr, Device, &Src, Host, sizeof(Src), &Event));
ASSERT_NE(Event, nullptr);
ASSERT_SUCCESS(olWaitEvent(Event));
ASSERT_SUCCESS(olSyncEvent(Event));
ASSERT_SUCCESS(olDestroyEvent(Event));
}

TEST_P(olWaitEventTest, InvalidNullEvent) {
ASSERT_ERROR(OL_ERRC_INVALID_NULL_HANDLE, olWaitEvent(nullptr));
TEST_P(olSyncEventTest, InvalidNullEvent) {
ASSERT_ERROR(OL_ERRC_INVALID_NULL_HANDLE, olSyncEvent(nullptr));
}

TEST_P(olWaitEventTest, SuccessMultipleWait) {
TEST_P(olSyncEventTest, SuccessMultipleWait) {
uint32_t Src = 42;
void *DstPtr;

Expand All @@ -43,7 +43,7 @@ TEST_P(olWaitEventTest, SuccessMultipleWait) {
ASSERT_NE(Event, nullptr);

for (size_t I = 0; I < 10; I++)
ASSERT_SUCCESS(olWaitEvent(Event));
ASSERT_SUCCESS(olSyncEvent(Event));

ASSERT_SUCCESS(olDestroyEvent(Event));
}
18 changes: 9 additions & 9 deletions offload/unittests/OffloadAPI/kernel/olLaunchKernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ TEST_P(olLaunchKernelFooTest, Success) {
ASSERT_SUCCESS(olLaunchKernel(Queue, Device, Kernel, &Args, sizeof(Args),
&LaunchArgs, nullptr));

ASSERT_SUCCESS(olWaitQueue(Queue));
ASSERT_SUCCESS(olSyncQueue(Queue));

uint32_t *Data = (uint32_t *)Mem;
for (uint32_t i = 0; i < 64; i++) {
Expand All @@ -108,7 +108,7 @@ TEST_P(olLaunchKernelNoArgsTest, Success) {
ASSERT_SUCCESS(
olLaunchKernel(Queue, Device, Kernel, nullptr, 0, &LaunchArgs, nullptr));

ASSERT_SUCCESS(olWaitQueue(Queue));
ASSERT_SUCCESS(olSyncQueue(Queue));
}

TEST_P(olLaunchKernelFooTest, SuccessSynchronous) {
Expand Down Expand Up @@ -147,7 +147,7 @@ TEST_P(olLaunchKernelLocalMemTest, Success) {
ASSERT_SUCCESS(olLaunchKernel(Queue, Device, Kernel, &Args, sizeof(Args),
&LaunchArgs, nullptr));

ASSERT_SUCCESS(olWaitQueue(Queue));
ASSERT_SUCCESS(olSyncQueue(Queue));

uint32_t *Data = (uint32_t *)Mem;
for (uint32_t i = 0; i < LaunchArgs.GroupSize.x * LaunchArgs.NumGroups.x; i++)
Expand All @@ -170,7 +170,7 @@ TEST_P(olLaunchKernelLocalMemReductionTest, Success) {
ASSERT_SUCCESS(olLaunchKernel(Queue, Device, Kernel, &Args, sizeof(Args),
&LaunchArgs, nullptr));

ASSERT_SUCCESS(olWaitQueue(Queue));
ASSERT_SUCCESS(olSyncQueue(Queue));

uint32_t *Data = (uint32_t *)Mem;
for (uint32_t i = 0; i < LaunchArgs.NumGroups.x; i++)
Expand All @@ -193,7 +193,7 @@ TEST_P(olLaunchKernelLocalMemStaticTest, Success) {
ASSERT_SUCCESS(olLaunchKernel(Queue, Device, Kernel, &Args, sizeof(Args),
&LaunchArgs, nullptr));

ASSERT_SUCCESS(olWaitQueue(Queue));
ASSERT_SUCCESS(olSyncQueue(Queue));

uint32_t *Data = (uint32_t *)Mem;
for (uint32_t i = 0; i < LaunchArgs.NumGroups.x; i++)
Expand All @@ -212,10 +212,10 @@ TEST_P(olLaunchKernelGlobalTest, Success) {

ASSERT_SUCCESS(olLaunchKernel(Queue, Device, Kernels[0], nullptr, 0,
&LaunchArgs, nullptr));
ASSERT_SUCCESS(olWaitQueue(Queue));
ASSERT_SUCCESS(olSyncQueue(Queue));
ASSERT_SUCCESS(olLaunchKernel(Queue, Device, Kernels[1], &Args, sizeof(Args),
&LaunchArgs, nullptr));
ASSERT_SUCCESS(olWaitQueue(Queue));
ASSERT_SUCCESS(olSyncQueue(Queue));

uint32_t *Data = (uint32_t *)Mem;
for (uint32_t i = 0; i < 64; i++) {
Expand Down Expand Up @@ -244,7 +244,7 @@ TEST_P(olLaunchKernelGlobalCtorTest, Success) {

ASSERT_SUCCESS(olLaunchKernel(Queue, Device, Kernel, &Args, sizeof(Args),
&LaunchArgs, nullptr));
ASSERT_SUCCESS(olWaitQueue(Queue));
ASSERT_SUCCESS(olSyncQueue(Queue));

uint32_t *Data = (uint32_t *)Mem;
for (uint32_t i = 0; i < 64; i++) {
Expand All @@ -260,5 +260,5 @@ TEST_P(olLaunchKernelGlobalDtorTest, Success) {
// crashes
ASSERT_SUCCESS(
olLaunchKernel(Queue, Device, Kernel, nullptr, 0, &LaunchArgs, nullptr));
ASSERT_SUCCESS(olWaitQueue(Queue));
ASSERT_SUCCESS(olSyncQueue(Queue));
}
18 changes: 9 additions & 9 deletions offload/unittests/OffloadAPI/memory/olMemcpy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ TEST_P(olMemcpyTest, SuccessHtoD) {
std::vector<uint8_t> Input(Size, 42);
ASSERT_SUCCESS(
olMemcpy(Queue, Alloc, Device, Input.data(), Host, Size, nullptr));
olWaitQueue(Queue);
olSyncQueue(Queue);
olMemFree(Alloc);
}

Expand All @@ -61,7 +61,7 @@ TEST_P(olMemcpyTest, SuccessDtoH) {
olMemcpy(Queue, Alloc, Device, Input.data(), Host, Size, nullptr));
ASSERT_SUCCESS(
olMemcpy(Queue, Output.data(), Host, Alloc, Device, Size, nullptr));
ASSERT_SUCCESS(olWaitQueue(Queue));
ASSERT_SUCCESS(olSyncQueue(Queue));
for (uint8_t Val : Output) {
ASSERT_EQ(Val, 42);
}
Expand All @@ -83,7 +83,7 @@ TEST_P(olMemcpyTest, SuccessDtoD) {
olMemcpy(Queue, AllocB, Device, AllocA, Device, Size, nullptr));
ASSERT_SUCCESS(
olMemcpy(Queue, Output.data(), Host, AllocB, Device, Size, nullptr));
ASSERT_SUCCESS(olWaitQueue(Queue));
ASSERT_SUCCESS(olSyncQueue(Queue));
for (uint8_t Val : Output) {
ASSERT_EQ(Val, 42);
}
Expand Down Expand Up @@ -146,10 +146,10 @@ TEST_P(olMemcpyGlobalTest, SuccessRoundTrip) {

ASSERT_SUCCESS(olMemcpy(Queue, Addr, Device, SourceMem, Host,
64 * sizeof(uint32_t), nullptr));
ASSERT_SUCCESS(olWaitQueue(Queue));
ASSERT_SUCCESS(olSyncQueue(Queue));
ASSERT_SUCCESS(olMemcpy(Queue, DestMem, Host, Addr, Device,
64 * sizeof(uint32_t), nullptr));
ASSERT_SUCCESS(olWaitQueue(Queue));
ASSERT_SUCCESS(olSyncQueue(Queue));

uint32_t *DestData = (uint32_t *)DestMem;
for (uint32_t I = 0; I < 64; I++)
Expand Down Expand Up @@ -178,10 +178,10 @@ TEST_P(olMemcpyGlobalTest, SuccessWrite) {

ASSERT_SUCCESS(olMemcpy(Queue, Addr, Device, SourceMem, Host,
64 * sizeof(uint32_t), nullptr));
ASSERT_SUCCESS(olWaitQueue(Queue));
ASSERT_SUCCESS(olSyncQueue(Queue));
ASSERT_SUCCESS(olLaunchKernel(Queue, Device, ReadKernel, &Args, sizeof(Args),
&LaunchArgs, nullptr));
ASSERT_SUCCESS(olWaitQueue(Queue));
ASSERT_SUCCESS(olSyncQueue(Queue));

uint32_t *DestData = (uint32_t *)DestMem;
for (uint32_t I = 0; I < 64; I++)
Expand All @@ -199,10 +199,10 @@ TEST_P(olMemcpyGlobalTest, SuccessRead) {

ASSERT_SUCCESS(olLaunchKernel(Queue, Device, WriteKernel, nullptr, 0,
&LaunchArgs, nullptr));
ASSERT_SUCCESS(olWaitQueue(Queue));
ASSERT_SUCCESS(olSyncQueue(Queue));
ASSERT_SUCCESS(olMemcpy(Queue, DestMem, Host, Addr, Device,
64 * sizeof(uint32_t), nullptr));
ASSERT_SUCCESS(olWaitQueue(Queue));
ASSERT_SUCCESS(olSyncQueue(Queue));

uint32_t *DestData = (uint32_t *)DestMem;
for (uint32_t I = 0; I < 64; I++)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===------- Offload API tests - olWaitQueue ------------------------------===//
//===------- Offload API tests - olSyncQueue ------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -10,9 +10,9 @@
#include <OffloadAPI.h>
#include <gtest/gtest.h>

using olWaitQueueTest = OffloadQueueTest;
OFFLOAD_TESTS_INSTANTIATE_DEVICE_FIXTURE(olWaitQueueTest);
using olSyncQueueTest = OffloadQueueTest;
OFFLOAD_TESTS_INSTANTIATE_DEVICE_FIXTURE(olSyncQueueTest);

TEST_P(olWaitQueueTest, SuccessEmptyQueue) {
ASSERT_SUCCESS(olWaitQueue(Queue));
TEST_P(olSyncQueueTest, SuccessEmptyQueue) {
ASSERT_SUCCESS(olSyncQueue(Queue));
}
Loading