Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

[SYCL] Adjust tests to get_native class functions removal #1113

Merged
merged 3 commits into from
Jul 29, 2022
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
16 changes: 8 additions & 8 deletions SYCL/Basic/interop/construction_ocl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,35 @@ constexpr auto BE = sycl::backend::opencl;

int main() {
sycl::device Dev{sycl::default_selector{}};
auto NativeDev = Dev.get_native<BE>();
auto NativeDev = sycl::get_native<BE>(Dev);

sycl::device NewDev = sycl::make_device<BE>(NativeDev);
assert(NewDev.get_info<sycl::info::device::name>() ==
Dev.get_info<sycl::info::device::name>());

sycl::platform Plt = Dev.get_platform();
auto NativePlt = Plt.get_native<BE>();
auto NativePlt = sycl::get_native<BE>(Plt);

sycl::platform NewPlt = sycl::make_platform<BE>(NativePlt);
assert(NewPlt == Plt);

sycl::context Ctx{Dev};
auto NativeCtx = Ctx.get_native<BE>();
auto NativeCtx = sycl::get_native<BE>(Ctx);

sycl::context NewCtx = sycl::make_context<BE>(NativeCtx);
assert(NewCtx.get_native<BE>() == NativeCtx);
assert(sycl::get_native<BE>(NewCtx) == NativeCtx);

sycl::queue Q{Ctx, Dev};
auto NativeQ = Q.get_native<BE>();
auto NativeQ = sycl::get_native<BE>(Q);

sycl::queue NewQ = sycl::make_queue<BE>(NativeQ, Ctx);
assert(NativeQ == NewQ.get_native<BE>());
assert(NativeQ == sycl::get_native<BE>(NewQ));

sycl::event Evt = Q.single_task<class Tst>([] {});
auto NativeEvt = Evt.get_native<BE>();
auto NativeEvt = sycl::get_native<BE>(Evt);

sycl::event NewEvt = sycl::make_event<BE>(NativeEvt, Ctx);
assert(NativeEvt == NewEvt.get_native<BE>());
assert(NativeEvt == sycl::get_native<BE>(NewEvt));

cl_mem NativeBuf =
clCreateBuffer(NativeCtx, CL_MEM_READ_WRITE, 128, nullptr, nullptr);
Expand Down
2 changes: 1 addition & 1 deletion SYCL/Basic/interop/construction_ze.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ int main() {
}

sycl::platform Plt = Dev.get_platform();
auto NativePlt = Plt.get_native<BE>();
auto NativePlt = sycl::get_native<BE>(Plt);

sycl::platform NewPlt = sycl::make_platform<BE>(NativePlt);
assert(NewPlt == Plt);
Expand Down
4 changes: 2 additions & 2 deletions SYCL/DeprecatedFeatures/device_platform_interop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int main() {
cl_device_id cl_device;
{
device D2(device_selector);
cl_device = D2.get_native<backend::opencl>();
cl_device = get_native<backend::opencl>(D2);
}
device D3(cl_device);
assert(D1 == D3 && "Device impls are different");
Expand All @@ -37,7 +37,7 @@ int main() {
cl_platform_id cl_platform;
{
platform P2(device_selector);
cl_platform = P2.get_native<backend::opencl>();
cl_platform = get_native<backend::opencl>(P2);
}
platform P3(cl_platform);
assert(P1 == P3 && "Platform impls are different");
Expand Down
6 changes: 4 additions & 2 deletions SYCL/OnlineCompiler/online_compiler_L0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ sycl::kernel getSYCLKernelWithIL(sycl::queue &Queue,

sycl::context Context = Queue.get_context();
sycl::device Device = Queue.get_device();
auto ZeDevice = Device.get_native<sycl::backend::ext_oneapi_level_zero>();
auto ZeContext = Context.get_native<sycl::backend::ext_oneapi_level_zero>();
auto ZeDevice =
sycl::get_native<sycl::backend::ext_oneapi_level_zero>(Device);
auto ZeContext =
sycl::get_native<sycl::backend::ext_oneapi_level_zero>(Context);

ze_module_build_log_handle_t ZeBuildLog;
ze_module_handle_t ZeModule;
Expand Down
2 changes: 1 addition & 1 deletion SYCL/Plugin/interop-level-zero-interop-task-mem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ int main() {
{SIZE, SIZE});

ze_context_handle_t ze_context =
queue.get_context().get_native<backend::ext_oneapi_level_zero>();
get_native<backend::ext_oneapi_level_zero>(queue.get_context());

queue
.submit([&](handler &cgh) {
Expand Down
4 changes: 2 additions & 2 deletions SYCL/Plugin/interop-level-zero-keep-ownership.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ int main() {
ze_context_handle_t ZeContext;
ze_context_desc_t ZeContextDesc = {ZE_STRUCTURE_TYPE_CONTEXT_DESC, nullptr,
0};
auto ZeDriver = Platform.get_native<backend::ext_oneapi_level_zero>();
auto ZeDevice = Device.get_native<backend::ext_oneapi_level_zero>();
auto ZeDriver = get_native<backend::ext_oneapi_level_zero>(Platform);
auto ZeDevice = get_native<backend::ext_oneapi_level_zero>(Device);
zeContextCreate(ZeDriver, &ZeContextDesc, &ZeContext);

{ // Scope in which SYCL interop context object is live
Expand Down
16 changes: 8 additions & 8 deletions SYCL/Plugin/interop-opencl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ int main() {
}

// Get native OpenCL handles
auto ocl_platform = Platform.get_native<backend::opencl>();
auto ocl_device = Device.get_native<backend::opencl>();
auto ocl_context = Context.get_native<backend::opencl>();
auto ocl_queue = Queue.get_native<backend::opencl>();
auto ocl_platform = get_native<backend::opencl>(Platform);
auto ocl_device = get_native<backend::opencl>(Device);
auto ocl_context = get_native<backend::opencl>(Context);
auto ocl_queue = get_native<backend::opencl>(Queue);
auto ocl_buffers = get_native<backend::opencl>(Buffer);
#ifdef SYCL2020_CONFORMANT_APIS
assert(ocl_buffers.size() == 1);
Expand All @@ -68,10 +68,10 @@ int main() {
#endif

// Check native handles
assert(ocl_platform == PlatformInterop.get_native<backend::opencl>());
assert(ocl_device == DeviceInterop.get_native<backend::opencl>());
assert(ocl_context == ContextInterop.get_native<backend::opencl>());
assert(ocl_queue == QueueInterop.get_native<backend::opencl>());
assert(ocl_platform == get_native<backend::opencl>(PlatformInterop));
assert(ocl_device == get_native<backend::opencl>(DeviceInterop));
assert(ocl_context == get_native<backend::opencl>(ContextInterop));
assert(ocl_queue == get_native<backend::opencl>(QueueInterop));
assert(ocl_buffers == get_native<backend::opencl>(BufferInterop));

return 0;
Expand Down