This repository was archived by the owner on Mar 28, 2023. It is now read-only.
forked from llvm/llvm-test-suite
-
Notifications
You must be signed in to change notification settings - Fork 130
[SYCL] Remove old style interop #448
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5f73750
[SYCL] Remove old style interop
68692e6
Fix more cases
497c3a0
Merge branch 'intel' into remove_old_interop
alexbatashev 821be9c
Update SYCL/OnlineCompiler/online_compiler_OpenCL.cpp
alexbatashev 9700cde
Merge remote-tracking branch 'upstream/intel' into remove_old_interop
562acdb
Merge branch 'remove_old_interop' of github.com:alexbatashev/llvm-tes…
53b6406
fix header
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
SYCL/Basic/buffer/buffer_interop.cpp → SYCL/DeprecatedFeatures/buffer_interop.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// REQUIRES: opencl, opencl_icd | ||
|
||
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -D__SYCL_INTERNAL_API %s -o %t.out %opencl_lib | ||
// RUN: %HOST_RUN_PLACEHOLDER %t.out | ||
// RUN: %CPU_RUN_PLACEHOLDER %t.out | ||
// RUN: %GPU_RUN_PLACEHOLDER %t.out | ||
|
||
//==--------------- event.cpp - SYCL event test ----------------------------==// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
#include <CL/sycl.hpp> | ||
#include <iostream> | ||
|
||
int main() { | ||
try { | ||
std::cout << "Try create OpenCL event" << std::endl; | ||
cl::sycl::context c; | ||
if (!c.is_host()) { | ||
::cl_int error; | ||
cl_event u_e = clCreateUserEvent(c.get(), &error); | ||
cl::sycl::event cl_e(u_e, c); | ||
std::cout << "OpenCL event: " << std::hex << cl_e.get() | ||
<< ((cl_e.get() == u_e) ? " matches " : " does not match ") | ||
<< u_e << std::endl; | ||
|
||
} else { | ||
std::cout << "Failed to create OpenCL context" << std::endl; | ||
} | ||
} catch (cl::sycl::device_error e) { | ||
std::cout << "Failed to create device for context" << std::endl; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...AndProgram/kernel-and-program-interop.cpp → ...edFeatures/kernel-and-program-interop.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
SYCL/Basic/kernel_interop.cpp → SYCL/DeprecatedFeatures/kernel_interop.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
SYCL/Basic/opencl-interop.cpp → SYCL/DeprecatedFeatures/opencl-interop.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
SYCL/Basic/opencl_interop.cpp → SYCL/DeprecatedFeatures/opencl_interop.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -D__SYCL_INTERNAL_API %s -o %t.out | ||
// RUN: %BE_RUN_PLACEHOLDER %t.out | ||
//==-------- queue_old_interop.cpp - SYCL queue OpenCL interop test --------==// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
#include <CL/sycl.hpp> | ||
#include <iostream> | ||
|
||
using namespace cl::sycl; | ||
|
||
std::string get_type(const device &dev) { | ||
return ((dev.is_host()) ? "host" | ||
: (dev.is_gpu() ? "OpenCL.GPU" : "OpenCL.CPU")); | ||
} | ||
|
||
void print_queue_info(const queue &q) { | ||
std::cout << "ID=" << std::hex | ||
<< ((q.get_device().is_host() || | ||
q.get_context().get_platform().get_backend() != | ||
cl::sycl::backend::opencl) | ||
? nullptr | ||
: q.get()) | ||
<< std::endl; | ||
std::cout << "queue wraps " << get_type(q.get_device()) << " device" | ||
<< std::endl; | ||
} | ||
int main() { | ||
try { | ||
std::cout << "Create default queue." << std::endl; | ||
queue q; | ||
print_queue_info(q); | ||
|
||
} catch (device_error e) { | ||
std::cout << "Failed to create device for context" << std::endl; | ||
} | ||
|
||
auto devices = device::get_devices(); | ||
device &deviceA = devices[0]; | ||
device &deviceB = (devices.size() > 1 ? devices[1] : devices[0]); | ||
{ | ||
std::cout << "move constructor" << std::endl; | ||
queue Queue(deviceA); | ||
size_t hash = std::hash<queue>()(Queue); | ||
queue MovedQueue(std::move(Queue)); | ||
assert(hash == std::hash<queue>()(MovedQueue)); | ||
assert(deviceA.is_host() == MovedQueue.is_host()); | ||
if (!deviceA.is_host() && | ||
deviceA.get_platform().get_backend() == cl::sycl::backend::opencl) { | ||
assert(MovedQueue.get() != nullptr); | ||
} | ||
} | ||
{ | ||
std::cout << "move assignment operator" << std::endl; | ||
queue Queue(deviceA); | ||
size_t hash = std::hash<queue>()(Queue); | ||
queue WillMovedQueue(deviceB); | ||
WillMovedQueue = std::move(Queue); | ||
assert(hash == std::hash<queue>()(WillMovedQueue)); | ||
assert(deviceA.is_host() == WillMovedQueue.is_host()); | ||
if (!deviceA.is_host() && | ||
deviceA.get_platform().get_backend() == cl::sycl::backend::opencl) { | ||
assert(WillMovedQueue.get() != nullptr); | ||
} | ||
} | ||
{ | ||
std::cout << "copy constructor" << std::endl; | ||
queue Queue(deviceA); | ||
size_t hash = std::hash<queue>()(Queue); | ||
queue QueueCopy(Queue); | ||
assert(hash == std::hash<queue>()(Queue)); | ||
assert(hash == std::hash<queue>()(QueueCopy)); | ||
assert(Queue == QueueCopy); | ||
assert(Queue.is_host() == QueueCopy.is_host()); | ||
} | ||
{ | ||
std::cout << "copy assignment operator" << std::endl; | ||
queue Queue(deviceA); | ||
size_t hash = std::hash<queue>()(Queue); | ||
queue WillQueueCopy(deviceB); | ||
WillQueueCopy = Queue; | ||
assert(hash == std::hash<queue>()(Queue)); | ||
assert(hash == std::hash<queue>()(WillQueueCopy)); | ||
assert(Queue == WillQueueCopy); | ||
assert(Queue.is_host() == WillQueueCopy.is_host()); | ||
} | ||
|
||
{ | ||
property_list pl = {}; | ||
queue Queue(pl); | ||
try { | ||
Queue.throw_asynchronous(); | ||
} catch (const std::bad_function_call &e) { | ||
std::cout << "Default asynchronous handler call failed: " << e.what() | ||
<< std::endl; | ||
throw; | ||
} | ||
} | ||
|
||
{ | ||
default_selector Selector; | ||
device Device = Selector.select_device(); | ||
context Context(Device); | ||
queue Queue(Context, Selector); | ||
assert(Context == Queue.get_context()); | ||
} | ||
|
||
{ | ||
context Context(deviceA); | ||
queue Queue(Context, deviceA); | ||
assert(Context == Queue.get_context()); | ||
} | ||
|
||
if (devices.size() > 1) { | ||
bool GotException = false; | ||
try { | ||
context Context(deviceA); | ||
queue Queue(Context, deviceB); | ||
assert(Context == Queue.get_context()); | ||
} catch (std::exception &e) { | ||
std::cout << "Exception check passed: " << e.what() << std::endl; | ||
GotException = true; | ||
} | ||
assert(GotException); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
SYCL/Basic/sampler/sampler_ocl.cpp → SYCL/DeprecatedFeatures/sampler_ocl.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
SYCL/Basic/set_arg_interop.cpp → SYCL/DeprecatedFeatures/set_arg_interop.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
SYCL/Basic/buffer/subbuffer_interop.cpp → .../DeprecatedFeatures/subbuffer_interop.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.