-
Notifications
You must be signed in to change notification settings - Fork 788
[SYCL][E2E] Add pre-C++11 ABI tests #12900
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
Changes from all commits
Commits
Show all changes
80 commits
Select commit
Hold shift + click to select a range
f62375d
[SYCL][L0] return error code when ZE_DEBUG=4 detects memory leaks.
bso-intel 7d9755e
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 84b6710
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 534f424
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 81b4db5
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 0c249f1
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 200f8ea
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel aaed454
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel d1c6404
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 1032a47
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel abbc3a0
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 1b2bcc7
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 4657e3b
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 39515bd
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 89e505b
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 6f2d5dd
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel f0b7ec1
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 0a63386
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel ff05096
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 76670e6
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 2228b5f
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 5589806
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 0df6354
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 066e537
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 4c6bdbf
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 29bfebe
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 5013125
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 9eeb08d
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel d2bfa6e
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel ed37e84
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 82140f2
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 9cdb8c7
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel e89281c
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel df66ba6
Merge branch 'sycl' of https://github.com/bso-intel/llvm into sycl
bso-intel 2f738d9
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel bb0a636
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel ef6772d
Merge branch 'sycl' of https://github.com/bso-intel/llvm into sycl
bso-intel af8b4d6
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel d53a2a8
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel c9d532e
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 70ceaac
merge from upstream
bso-intel 58d75c3
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 002c81d
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel e087c5b
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 938b7ba
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 958760d
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 2fe5ece
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 59f3656
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 434117a
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 55d41d6
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 16469df
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel f6c796b
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel d1193a3
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 7b7f84e
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 5739c22
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 1fa1d86
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 0ea8e1f
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 5319024
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel ace7748
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel b62af7f
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 224ce55
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 12e6cac
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 0791d2f
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 5d4d7d3
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel a7f33b7
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 4e1e4a2
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 46ce473
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel ed3c59d
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 5250852
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 265e6a8
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 18d859f
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 6630705
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 12bdfd3
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 98dd8a5
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 4a13701
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 9a641f2
Merge remote-tracking branch 'upstream/sycl' into sycl
bso-intel 37833fd
[SYCL] ABI Neutral Tests
bso-intel b3a85fb
fix comment
bso-intel b4ad2ca
added REQUIRES
bso-intel 85e832b
added comments
bso-intel 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// RUN: %{build} -o %t.out | ||
// RUN: %{run} %t.out | ||
// RUN: %if preview-breaking-changes-supported %{ %{build} -fpreview-breaking-changes -D_GLIBCXX_USE_CXX11_ABI=0 -o %t2.out %} | ||
// RUN: %if preview-breaking-changes-supported %{ %{run} %t2.out %} | ||
// REQUIRES: level_zero && gpu | ||
|
||
// This test case tests if compiling works with or without | ||
// _GLIBCXX_USE_CXX11_ABI=0. | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
int main() { | ||
#ifdef _GLIBCXX_USE_CXX11_ABI | ||
std::cout << "is_cxx11_abi: " << (_GLIBCXX_USE_CXX11_ABI != 0) << std::endl; | ||
; | ||
#else | ||
std::cout << "is_cxx11_abi: 1" << std::endl; | ||
#endif | ||
std::vector<sycl::device> root_devices; | ||
auto platform_list = sycl::platform::get_platforms(); | ||
// Enumerated GPU devices from GPU platform firstly. | ||
for (const auto &platform : platform_list) { | ||
if (platform.get_backend() != sycl::backend::ext_oneapi_level_zero) { | ||
continue; | ||
} | ||
auto device_list = platform.get_devices(); | ||
for (const auto &device : device_list) { | ||
if (device.is_gpu()) { | ||
root_devices.push_back(device); | ||
} | ||
} | ||
} | ||
assert(root_devices.size() > 0); | ||
std::cout << "gpu number: " << root_devices.size() << std::endl; | ||
constexpr sycl::info::partition_property partition_by_affinity = | ||
sycl::info::partition_property::partition_by_affinity_domain; | ||
constexpr sycl::info::partition_affinity_domain next_partitionable = | ||
sycl::info::partition_affinity_domain::next_partitionable; | ||
for (const auto &root_device : root_devices) { | ||
try { | ||
auto sub_devices = root_device.create_sub_devices<partition_by_affinity>( | ||
next_partitionable); | ||
std::cout << "tile partition is supported!" << std::endl; | ||
} catch (sycl::exception &e) { | ||
if (e.code() != sycl::errc::feature_not_supported && | ||
e.code() != sycl::errc::invalid) { | ||
throw std::runtime_error( | ||
std::string("Failed to apply tile partition: ") + e.what()); | ||
} else { | ||
std::cout << "tile partition is UNSUPPORTED!" << std::endl; | ||
} | ||
} | ||
} | ||
std::cout << "pass!" << std::endl; | ||
} |
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,149 @@ | ||
// RUN: %{build} -o %t.out | ||
// RUN: %{run} %t.out | ||
// RUN: %if preview-breaking-changes-supported %{ %{build} -fpreview-breaking-changes -D_GLIBCXX_USE_CXX11_ABI=0 -o %t2.out %} | ||
// RUN: %if preview-breaking-changes-supported %{ %{run} %t2.out %} | ||
|
||
// This test case tests if compiling works with or without | ||
// _GLIBCXX_USE_CXX11_ABI=0. | ||
|
||
#include <deque> | ||
#include <iostream> | ||
#include <mutex> | ||
#include <sycl/sycl.hpp> | ||
#include <vector> | ||
|
||
template <typename T> using dpcpp_info_t = typename T::return_type; | ||
|
||
struct DeviceProp { | ||
dpcpp_info_t<sycl::info::device::name> device_name; | ||
dpcpp_info_t<sycl::info::platform::name> platform_name; | ||
dpcpp_info_t<sycl::info::device::vendor> vendor; | ||
dpcpp_info_t<sycl::info::device::driver_version> driver_version; | ||
dpcpp_info_t<sycl::info::device::version> version; | ||
dpcpp_info_t<sycl::info::device::max_compute_units> max_compute_units; | ||
}; | ||
|
||
static std::once_flag init_device_flag; | ||
static std::once_flag init_prop_flag; | ||
static std::deque<std::once_flag> device_prop_flags; | ||
static std::vector<DeviceProp> device_properties; | ||
|
||
struct DevicePool { | ||
std::vector<std::unique_ptr<sycl::device>> devices; | ||
std::vector<std::unique_ptr<sycl::context>> contexts; | ||
std::mutex mutex; | ||
} gDevPool; | ||
|
||
bool is_cxx11_abi() { | ||
#ifdef _GLIBCXX_USE_CXX11_ABI | ||
return (_GLIBCXX_USE_CXX11_ABI != 0); | ||
#else | ||
return true; | ||
#endif | ||
} | ||
|
||
static void enumDevices(std::vector<std::unique_ptr<sycl::device>> &devices) { | ||
auto platform_list = sycl::platform::get_platforms(); | ||
for (const auto &platform : platform_list) { | ||
if (platform.get_backend() != sycl::backend::ext_oneapi_level_zero) { | ||
continue; | ||
} | ||
auto device_list = platform.get_devices(); | ||
for (const auto &device : device_list) { | ||
if (device.is_gpu()) { | ||
devices.push_back(std::make_unique<sycl::device>(device)); | ||
} | ||
} | ||
} | ||
} | ||
|
||
static void initGlobalDevicePoolState() { | ||
enumDevices(gDevPool.devices); | ||
|
||
auto device_count = gDevPool.devices.size(); | ||
if (device_count <= 0) { | ||
std::cout << "XPU device count is zero!" << std::endl; | ||
return; | ||
} | ||
gDevPool.contexts.resize(1); | ||
gDevPool.contexts[0] = std::make_unique<sycl::context>( | ||
gDevPool.devices[0]->get_platform().ext_oneapi_get_default_context()); | ||
} | ||
|
||
static void initDevicePoolCallOnce() { | ||
std::call_once(init_device_flag, initGlobalDevicePoolState); | ||
} | ||
|
||
int dpcppGetDeviceCount() { | ||
initDevicePoolCallOnce(); | ||
std::lock_guard<std::mutex> lock(gDevPool.mutex); | ||
return static_cast<int>(gDevPool.devices.size()); | ||
} | ||
|
||
sycl::device &dpcppGetRawDevice(int device) { | ||
initDevicePoolCallOnce(); | ||
std::lock_guard<std::mutex> lock(gDevPool.mutex); | ||
if (device > static_cast<int>(gDevPool.devices.size())) { | ||
throw std::runtime_error(std::string("device is out of range")); | ||
} | ||
return *gDevPool.devices[device]; | ||
} | ||
|
||
static void initDevicePropState() { | ||
auto device_count = dpcppGetDeviceCount(); | ||
device_prop_flags.resize(device_count); | ||
device_properties.resize(device_count); | ||
} | ||
|
||
static void initDeviceProperties(int device) { | ||
DeviceProp device_prop; | ||
auto &raw_device = dpcppGetRawDevice(device); | ||
|
||
device_prop.device_name = raw_device.get_info<sycl::info::device::name>(); | ||
device_prop.platform_name = | ||
raw_device.get_platform().get_info<sycl::info::platform::name>(); | ||
device_prop.vendor = raw_device.get_info<sycl::info::device::vendor>(); | ||
device_prop.driver_version = | ||
raw_device.get_info<sycl::info::device::driver_version>(); | ||
device_prop.version = raw_device.get_info<sycl::info::device::version>(); | ||
device_prop.max_compute_units = | ||
raw_device.get_info<sycl::info::device::max_compute_units>(); | ||
|
||
device_properties[device] = device_prop; | ||
} | ||
|
||
static void initDevicePropCallOnce(int device) { | ||
std::call_once(init_prop_flag, initDevicePropState); | ||
std::call_once(device_prop_flags[device], initDeviceProperties, device); | ||
} | ||
|
||
DeviceProp &dpcppGetDeviceProperties(int device) { | ||
initDevicePropCallOnce(device); | ||
auto device_count = dpcppGetDeviceCount(); | ||
if (device > device_count) { | ||
throw std::runtime_error(std::string("device is out of range")); | ||
} | ||
return device_properties[device]; | ||
} | ||
|
||
std::string &dpcppGetDeviceName(int device) { | ||
return dpcppGetDeviceProperties(device).device_name; | ||
} | ||
|
||
int main() { | ||
std::cout << "device_count: " << dpcppGetDeviceCount() << std::endl; | ||
std::cout << "hello world!" << std::endl; | ||
std::cout << "is_cxx11_abi: " << is_cxx11_abi() << std::endl; | ||
for (auto i = 0; i < dpcppGetDeviceCount(); i++) { | ||
// std::cout << i << "th device name is " << dpcppGetDeviceName(i) << | ||
// std::endl; | ||
std::cout << i << "th device name is " | ||
<< dpcppGetDeviceProperties(i).device_name << std::endl; | ||
std::cout << i << "th platform name is " | ||
<< dpcppGetDeviceProperties(i).platform_name << std::endl; | ||
std::cout << dpcppGetDeviceProperties(i).version << std::endl; | ||
std::cout << dpcppGetDeviceProperties(i).driver_version << std::endl; | ||
std::cout << dpcppGetDeviceProperties(i).vendor << std::endl; | ||
std::cout << dpcppGetDeviceProperties(i).max_compute_units << std::endl; | ||
} | ||
} |
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,31 @@ | ||
// RUN: %{build} -o %t.out | ||
// RUN: %{run} %t.out | ||
// RUN: %if preview-breaking-changes-supported %{ %{build} -fpreview-breaking-changes -D_GLIBCXX_USE_CXX11_ABI=0 -o %t2.out %} | ||
// RUN: %if preview-breaking-changes-supported %{ %{run} %t2.out %} | ||
|
||
// This test case tests if compiling works with or without | ||
// _GLIBCXX_USE_CXX11_ABI=0. | ||
|
||
#include <iostream> | ||
#include <sycl/sycl.hpp> | ||
|
||
int main() { | ||
try { | ||
auto cgf = [&](sycl::handler &cgh) { cgh.single_task([=]() {}); }; | ||
sycl::queue queue; | ||
for (auto i = 0; i < 25; i++) { | ||
sycl::malloc_device(1024, queue); | ||
} | ||
auto event = queue.submit(cgf); | ||
event.wait_and_throw(); | ||
} catch (const sycl::exception &ep) { | ||
const std::string_view err_msg(ep.what()); | ||
if (err_msg.find("PI_ERROR_OUT_OF_RESOURCES") != std::string::npos) { | ||
std::cout << "Allocation is out of device memory on the current platform." | ||
<< std::endl; | ||
} else { | ||
throw ep; | ||
} | ||
} | ||
std::cout << "pass!" << std::endl; | ||
} |
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.