Skip to content

Commit 108cb77

Browse files
Replaced uses of sycl::vector_class with std::vector
Also replaced sycl::ONEAPI::filter_selector with sycl::ext::oneapi::filter_selector The packages compiles using open source SYCL compiler after these changes.
1 parent 18b56cf commit 108cb77

11 files changed

+38
-29
lines changed

dpctl-capi/source/dpctl_sycl_context_interface.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "../helper/include/dpctl_async_error_handler.h"
2929
#include "Support/CBindingWrapping.h"
3030
#include <CL/sycl.hpp>
31+
#include <vector>
3132

3233
using namespace cl::sycl;
3334

@@ -36,7 +37,7 @@ namespace
3637
// Create wrappers for C Binding types (see CBindingWrapping.h).
3738
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(context, DPCTLSyclContextRef)
3839
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(device, DPCTLSyclDeviceRef)
39-
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(vector_class<DPCTLSyclDeviceRef>,
40+
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(std::vector<DPCTLSyclDeviceRef>,
4041
DPCTLDeviceVectorRef)
4142
} /* end of anonymous namespace */
4243

@@ -67,7 +68,7 @@ DPCTLContext_CreateFromDevices(__dpctl_keep const DPCTLDeviceVectorRef DVRef,
6768
int /**/)
6869
{
6970
DPCTLSyclContextRef CRef = nullptr;
70-
vector_class<device> Devices;
71+
std::vector<device> Devices;
7172
auto DeviceRefs = unwrap(DVRef);
7273
if (!DeviceRefs)
7374
return CRef;
@@ -125,9 +126,9 @@ DPCTLContext_GetDevices(__dpctl_keep const DPCTLSyclContextRef CRef)
125126
"input is a nullptr\n";
126127
return nullptr;
127128
}
128-
vector_class<DPCTLSyclDeviceRef> *DevicesVectorPtr = nullptr;
129+
std::vector<DPCTLSyclDeviceRef> *DevicesVectorPtr = nullptr;
129130
try {
130-
DevicesVectorPtr = new vector_class<DPCTLSyclDeviceRef>();
131+
DevicesVectorPtr = new std::vector<DPCTLSyclDeviceRef>();
131132
} catch (std::bad_alloc const &ba) {
132133
// \todo log error
133134
std::cerr << ba.what() << '\n';

dpctl-capi/source/dpctl_sycl_device_interface.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <CL/sycl.hpp> /* SYCL headers */
3232
#include <algorithm>
3333
#include <cstring>
34+
#include <vector>
3435

3536
using namespace cl::sycl;
3637

@@ -40,7 +41,7 @@ namespace
4041
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(device, DPCTLSyclDeviceRef)
4142
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(device_selector, DPCTLSyclDeviceSelectorRef)
4243
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(platform, DPCTLSyclPlatformRef)
43-
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(vector_class<DPCTLSyclDeviceRef>,
44+
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(std::vector<DPCTLSyclDeviceRef>,
4445
DPCTLDeviceVectorRef)
4546

4647
} /* end of anonymous namespace */
@@ -608,7 +609,7 @@ __dpctl_give DPCTLDeviceVectorRef
608609
DPCTLDevice_CreateSubDevicesEqually(__dpctl_keep const DPCTLSyclDeviceRef DRef,
609610
size_t count)
610611
{
611-
vector_class<DPCTLSyclDeviceRef> *Devices = nullptr;
612+
std::vector<DPCTLSyclDeviceRef> *Devices = nullptr;
612613
if (DRef) {
613614
if (count == 0) {
614615
std::cerr << "Can not create sub-devices with zero compute units"
@@ -619,7 +620,7 @@ DPCTLDevice_CreateSubDevicesEqually(__dpctl_keep const DPCTLSyclDeviceRef DRef,
619620
try {
620621
auto subDevices = D->create_sub_devices<
621622
info::partition_property::partition_equally>(count);
622-
Devices = new vector_class<DPCTLSyclDeviceRef>();
623+
Devices = new std::vector<DPCTLSyclDeviceRef>();
623624
for (const auto &sd : subDevices) {
624625
Devices->emplace_back(wrap(new device(sd)));
625626
}
@@ -646,7 +647,7 @@ DPCTLDevice_CreateSubDevicesByCounts(__dpctl_keep const DPCTLSyclDeviceRef DRef,
646647
__dpctl_keep size_t *counts,
647648
size_t ncounts)
648649
{
649-
vector_class<DPCTLSyclDeviceRef> *Devices = nullptr;
650+
std::vector<DPCTLSyclDeviceRef> *Devices = nullptr;
650651
std::vector<size_t> vcounts(ncounts);
651652
vcounts.assign(counts, counts + ncounts);
652653
size_t min_elem = *std::min_element(vcounts.begin(), vcounts.end());
@@ -657,7 +658,7 @@ DPCTLDevice_CreateSubDevicesByCounts(__dpctl_keep const DPCTLSyclDeviceRef DRef,
657658
}
658659
if (DRef) {
659660
auto D = unwrap(DRef);
660-
vector_class<std::remove_pointer<decltype(D)>::type> subDevices;
661+
std::vector<std::remove_pointer<decltype(D)>::type> subDevices;
661662
try {
662663
subDevices = D->create_sub_devices<
663664
info::partition_property::partition_by_counts>(vcounts);
@@ -670,7 +671,7 @@ DPCTLDevice_CreateSubDevicesByCounts(__dpctl_keep const DPCTLSyclDeviceRef DRef,
670671
return nullptr;
671672
}
672673
try {
673-
Devices = new vector_class<DPCTLSyclDeviceRef>();
674+
Devices = new std::vector<DPCTLSyclDeviceRef>();
674675
for (const auto &sd : subDevices) {
675676
Devices->emplace_back(wrap(new device(sd)));
676677
}
@@ -692,15 +693,15 @@ __dpctl_give DPCTLDeviceVectorRef DPCTLDevice_CreateSubDevicesByAffinity(
692693
__dpctl_keep const DPCTLSyclDeviceRef DRef,
693694
DPCTLPartitionAffinityDomainType PartitionAffinityDomainTy)
694695
{
695-
vector_class<DPCTLSyclDeviceRef> *Devices = nullptr;
696+
std::vector<DPCTLSyclDeviceRef> *Devices = nullptr;
696697
auto D = unwrap(DRef);
697698
if (D) {
698699
try {
699700
auto domain = DPCTL_DPCTLPartitionAffinityDomainTypeToSycl(
700701
PartitionAffinityDomainTy);
701702
auto subDevices = D->create_sub_devices<
702703
info::partition_property::partition_by_affinity_domain>(domain);
703-
Devices = new vector_class<DPCTLSyclDeviceRef>();
704+
Devices = new std::vector<DPCTLSyclDeviceRef>();
704705
for (const auto &sd : subDevices) {
705706
Devices->emplace_back(wrap(new device(sd)));
706707
}

dpctl-capi/source/dpctl_sycl_device_manager.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <iomanip>
3232
#include <iostream>
3333
#include <unordered_map>
34+
#include <vector>
3435

3536
using namespace cl::sycl;
3637

@@ -142,10 +143,10 @@ DPCTLDeviceMgr_GetCachedContext(__dpctl_keep const DPCTLSyclDeviceRef DRef)
142143
__dpctl_give DPCTLDeviceVectorRef
143144
DPCTLDeviceMgr_GetDevices(int device_identifier)
144145
{
145-
vector_class<DPCTLSyclDeviceRef> *Devices = nullptr;
146+
std::vector<DPCTLSyclDeviceRef> *Devices = nullptr;
146147

147148
try {
148-
Devices = new vector_class<DPCTLSyclDeviceRef>();
149+
Devices = new std::vector<DPCTLSyclDeviceRef>();
149150
} catch (std::bad_alloc const &ba) {
150151
delete Devices;
151152
return nullptr;

dpctl-capi/source/dpctl_sycl_device_selector_interface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ __dpctl_give DPCTLSyclDeviceSelectorRef
8383
DPCTLFilterSelector_Create(__dpctl_keep const char *filter_str)
8484
{
8585
try {
86-
auto Selector = new ONEAPI::filter_selector(filter_str);
86+
auto Selector = new ext::oneapi::filter_selector(filter_str);
8787
return wrap(Selector);
8888
} catch (std::bad_alloc &ba) {
8989
std::cerr << ba.what() << '\n';

dpctl-capi/source/dpctl_sycl_event_interface.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "../helper/include/dpctl_utils_helper.h"
2929
#include "Support/CBindingWrapping.h"
3030
#include <CL/sycl.hpp> /* SYCL headers */
31+
#include <vector>
3132

3233
using namespace cl::sycl;
3334

@@ -196,9 +197,9 @@ DPCTLEvent_GetWaitList(__dpctl_keep DPCTLSyclEventRef ERef)
196197
std::cerr << "Cannot get wait list as input is a nullptr\n";
197198
return nullptr;
198199
}
199-
vector_class<DPCTLSyclEventRef> *EventsVectorPtr = nullptr;
200+
std::vector<DPCTLSyclEventRef> *EventsVectorPtr = nullptr;
200201
try {
201-
EventsVectorPtr = new vector_class<DPCTLSyclEventRef>();
202+
EventsVectorPtr = new std::vector<DPCTLSyclEventRef>();
202203
} catch (std::bad_alloc const &ba) {
203204
// \todo log error
204205
std::cerr << ba.what() << '\n';

dpctl-capi/source/dpctl_sycl_platform_interface.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,15 @@
3232
#include <iostream>
3333
#include <set>
3434
#include <sstream>
35+
#include <vector>
3536

3637
using namespace cl::sycl;
3738

3839
namespace
3940
{
4041
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(platform, DPCTLSyclPlatformRef);
4142
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(device_selector, DPCTLSyclDeviceSelectorRef);
42-
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(vector_class<DPCTLSyclPlatformRef>,
43+
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(std::vector<DPCTLSyclPlatformRef>,
4344
DPCTLPlatformVectorRef);
4445
} // namespace
4546

@@ -207,12 +208,12 @@ DPCTLPlatform_GetVersion(__dpctl_keep const DPCTLSyclPlatformRef PRef)
207208

208209
__dpctl_give DPCTLPlatformVectorRef DPCTLPlatform_GetPlatforms()
209210
{
210-
vector_class<DPCTLSyclPlatformRef> *Platforms = nullptr;
211+
std::vector<DPCTLSyclPlatformRef> *Platforms = nullptr;
211212

212213
auto platforms = platform::get_platforms();
213214

214215
try {
215-
Platforms = new vector_class<DPCTLSyclPlatformRef>();
216+
Platforms = new std::vector<DPCTLSyclPlatformRef>();
216217
Platforms->reserve(platforms.size());
217218
} catch (std::bad_alloc const &ba) {
218219
return nullptr;

dpctl-capi/source/dpctl_sycl_queue_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ DEFINE_SIMPLE_CONVERSION_FUNCTIONS(context, DPCTLSyclContextRef)
4343

4444
struct QueueManager
4545
{
46-
using QueueStack = vector_class<queue>;
46+
using QueueStack = std::vector<queue>;
4747
static QueueStack &getQueueStack()
4848
{
4949
thread_local static QueueStack *activeQueues = new QueueStack([] {

dpctl-capi/source/dpctl_vector_templ.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@
2626
#include "../helper/include/dpctl_vector_macros.h"
2727
#include "Support/MemOwnershipAttrs.h"
2828
#include <type_traits>
29+
#include <vector>
2930

3031
namespace
3132
{
32-
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(vector_class<SYCLREF(EL)>, VECTOR(EL))
33+
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(std::vector<SYCLREF(EL)>, VECTOR(EL))
3334
}
3435

3536
/*!
@@ -39,9 +40,9 @@ DEFINE_SIMPLE_CONVERSION_FUNCTIONS(vector_class<SYCLREF(EL)>, VECTOR(EL))
3940
*/
4041
__dpctl_give VECTOR(EL) FN(EL, Create)()
4142
{
42-
vector_class<SYCLREF(EL)> *Vec = nullptr;
43+
std::vector<SYCLREF(EL)> *Vec = nullptr;
4344
try {
44-
Vec = new vector_class<SYCLREF(EL)>();
45+
Vec = new std::vector<SYCLREF(EL)>();
4546
return wrap(Vec);
4647
} catch (std::bad_alloc const &ba) {
4748
delete Vec;
@@ -58,9 +59,9 @@ __dpctl_give VECTOR(EL) FN(EL, Create)()
5859
__dpctl_give VECTOR(EL)
5960
FN(EL, CreateFromArray)(size_t n, __dpctl_keep SYCLREF(EL) * elems)
6061
{
61-
vector_class<SYCLREF(EL)> *Vec = nullptr;
62+
std::vector<SYCLREF(EL)> *Vec = nullptr;
6263
try {
63-
Vec = new vector_class<SYCLREF(EL)>();
64+
Vec = new std::vector<SYCLREF(EL)>();
6465
for (size_t i = 0; i < n; ++i) {
6566
auto Ref = unwrap(elems[i]);
6667
Vec->emplace_back(

dpctl-capi/tests/test_sycl_context_interface.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@
3131
#include "dpctl_sycl_types.h"
3232
#include <CL/sycl.hpp>
3333
#include <gtest/gtest.h>
34+
#include <vector>
3435

3536
using namespace cl::sycl;
3637

3738
namespace
3839
{
3940
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(sycl::device, DPCTLSyclDeviceRef);
40-
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(vector_class<DPCTLSyclDeviceRef>,
41+
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(std::vector<DPCTLSyclDeviceRef>,
4142
DPCTLDeviceVectorRef)
4243
} // namespace
4344

dpctl-capi/tests/test_sycl_event_interface.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@
2929
#include "dpctl_sycl_types.h"
3030
#include <CL/sycl.hpp>
3131
#include <gtest/gtest.h>
32+
#include <vector>
3233

3334
using namespace cl::sycl;
3435

3536
namespace
3637
{
3738
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(event, DPCTLSyclEventRef);
38-
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(vector_class<DPCTLSyclEventRef>,
39+
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(std::vector<DPCTLSyclEventRef>,
3940
DPCTLEventVectorRef);
4041

4142
#ifndef DPCTL_COVERAGE

dpctl-capi/tests/test_sycl_platform_interface.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@
3131
#include "dpctl_utils.h"
3232
#include <CL/sycl.hpp>
3333
#include <gtest/gtest.h>
34+
#include <vector>
3435

3536
using namespace cl::sycl;
3637

3738
namespace
3839
{
39-
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(vector_class<DPCTLSyclPlatformRef>,
40+
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(std::vector<DPCTLSyclPlatformRef>,
4041
DPCTLPlatformVectorRef);
4142

4243
void check_platform_name(__dpctl_keep const DPCTLSyclPlatformRef PRef)

0 commit comments

Comments
 (0)