Skip to content

Commit 50285f7

Browse files
Removed vector_class_t, use std::vector throughout
1 parent 2ebc671 commit 50285f7

7 files changed

+28
-64
lines changed

dpctl-capi/source/dpctl_sycl_context_interface.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
#include "dpctl_sycl_context_interface.h"
2828
#include "../helper/include/dpctl_async_error_handler.h"
2929
#include "Support/CBindingWrapping.h"
30-
#include "vector_type.hpp"
3130
#include <CL/sycl.hpp>
31+
#include <vector>
3232

3333
using namespace cl::sycl;
3434

@@ -37,7 +37,7 @@ namespace
3737
// Create wrappers for C Binding types (see CBindingWrapping.h).
3838
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(context, DPCTLSyclContextRef)
3939
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(device, DPCTLSyclDeviceRef)
40-
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(vector_class_t<DPCTLSyclDeviceRef>,
40+
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(std::vector<DPCTLSyclDeviceRef>,
4141
DPCTLDeviceVectorRef)
4242
} /* end of anonymous namespace */
4343

@@ -68,7 +68,7 @@ DPCTLContext_CreateFromDevices(__dpctl_keep const DPCTLDeviceVectorRef DVRef,
6868
int /**/)
6969
{
7070
DPCTLSyclContextRef CRef = nullptr;
71-
vector_class_t<device> Devices;
71+
std::vector<device> Devices;
7272
auto DeviceRefs = unwrap(DVRef);
7373
if (!DeviceRefs)
7474
return CRef;
@@ -126,9 +126,9 @@ DPCTLContext_GetDevices(__dpctl_keep const DPCTLSyclContextRef CRef)
126126
"input is a nullptr\n";
127127
return nullptr;
128128
}
129-
vector_class_t<DPCTLSyclDeviceRef> *DevicesVectorPtr = nullptr;
129+
std::vector<DPCTLSyclDeviceRef> *DevicesVectorPtr = nullptr;
130130
try {
131-
DevicesVectorPtr = new vector_class_t<DPCTLSyclDeviceRef>();
131+
DevicesVectorPtr = new std::vector<DPCTLSyclDeviceRef>();
132132
} catch (std::bad_alloc const &ba) {
133133
// \todo log error
134134
std::cerr << ba.what() << '\n';

dpctl-capi/source/dpctl_sycl_device_interface.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
#include "../helper/include/dpctl_utils_helper.h"
2929
#include "Support/CBindingWrapping.h"
3030
#include "dpctl_sycl_device_manager.h"
31-
#include "vector_type.hpp"
3231
#include <CL/sycl.hpp> /* SYCL headers */
3332
#include <algorithm>
3433
#include <cstring>
34+
#include <vector>
3535

3636
using namespace cl::sycl;
3737

@@ -41,7 +41,7 @@ namespace
4141
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(device, DPCTLSyclDeviceRef)
4242
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(device_selector, DPCTLSyclDeviceSelectorRef)
4343
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(platform, DPCTLSyclPlatformRef)
44-
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(vector_class_t<DPCTLSyclDeviceRef>,
44+
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(std::vector<DPCTLSyclDeviceRef>,
4545
DPCTLDeviceVectorRef)
4646

4747
} /* end of anonymous namespace */
@@ -609,7 +609,7 @@ __dpctl_give DPCTLDeviceVectorRef
609609
DPCTLDevice_CreateSubDevicesEqually(__dpctl_keep const DPCTLSyclDeviceRef DRef,
610610
size_t count)
611611
{
612-
vector_class_t<DPCTLSyclDeviceRef> *Devices = nullptr;
612+
std::vector<DPCTLSyclDeviceRef> *Devices = nullptr;
613613
if (DRef) {
614614
if (count == 0) {
615615
std::cerr << "Can not create sub-devices with zero compute units"
@@ -620,7 +620,7 @@ DPCTLDevice_CreateSubDevicesEqually(__dpctl_keep const DPCTLSyclDeviceRef DRef,
620620
try {
621621
auto subDevices = D->create_sub_devices<
622622
info::partition_property::partition_equally>(count);
623-
Devices = new vector_class_t<DPCTLSyclDeviceRef>();
623+
Devices = new std::vector<DPCTLSyclDeviceRef>();
624624
for (const auto &sd : subDevices) {
625625
Devices->emplace_back(wrap(new device(sd)));
626626
}
@@ -647,8 +647,8 @@ DPCTLDevice_CreateSubDevicesByCounts(__dpctl_keep const DPCTLSyclDeviceRef DRef,
647647
__dpctl_keep size_t *counts,
648648
size_t ncounts)
649649
{
650-
vector_class_t<DPCTLSyclDeviceRef> *Devices = nullptr;
651-
vector_class_t<size_t> vcounts(ncounts);
650+
std::vector<DPCTLSyclDeviceRef> *Devices = nullptr;
651+
std::vector<size_t> vcounts(ncounts);
652652
vcounts.assign(counts, counts + ncounts);
653653
size_t min_elem = *std::min_element(vcounts.begin(), vcounts.end());
654654
if (min_elem == 0) {
@@ -658,7 +658,7 @@ DPCTLDevice_CreateSubDevicesByCounts(__dpctl_keep const DPCTLSyclDeviceRef DRef,
658658
}
659659
if (DRef) {
660660
auto D = unwrap(DRef);
661-
vector_class_t<std::remove_pointer<decltype(D)>::type> subDevices;
661+
std::vector<std::remove_pointer<decltype(D)>::type> subDevices;
662662
try {
663663
subDevices = D->create_sub_devices<
664664
info::partition_property::partition_by_counts>(vcounts);
@@ -671,7 +671,7 @@ DPCTLDevice_CreateSubDevicesByCounts(__dpctl_keep const DPCTLSyclDeviceRef DRef,
671671
return nullptr;
672672
}
673673
try {
674-
Devices = new vector_class_t<DPCTLSyclDeviceRef>();
674+
Devices = new std::vector<DPCTLSyclDeviceRef>();
675675
for (const auto &sd : subDevices) {
676676
Devices->emplace_back(wrap(new device(sd)));
677677
}
@@ -693,15 +693,15 @@ __dpctl_give DPCTLDeviceVectorRef DPCTLDevice_CreateSubDevicesByAffinity(
693693
__dpctl_keep const DPCTLSyclDeviceRef DRef,
694694
DPCTLPartitionAffinityDomainType PartitionAffinityDomainTy)
695695
{
696-
vector_class_t<DPCTLSyclDeviceRef> *Devices = nullptr;
696+
std::vector<DPCTLSyclDeviceRef> *Devices = nullptr;
697697
auto D = unwrap(DRef);
698698
if (D) {
699699
try {
700700
auto domain = DPCTL_DPCTLPartitionAffinityDomainTypeToSycl(
701701
PartitionAffinityDomainTy);
702702
auto subDevices = D->create_sub_devices<
703703
info::partition_property::partition_by_affinity_domain>(domain);
704-
Devices = new vector_class_t<DPCTLSyclDeviceRef>();
704+
Devices = new std::vector<DPCTLSyclDeviceRef>();
705705
for (const auto &sd : subDevices) {
706706
Devices->emplace_back(wrap(new device(sd)));
707707
}

dpctl-capi/source/dpctl_sycl_device_manager.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
#include "../helper/include/dpctl_utils_helper.h"
2828
#include "Support/CBindingWrapping.h"
2929
#include "dpctl_sycl_enum_types.h"
30-
#include "vector_type.hpp"
3130
#include <CL/sycl.hpp> /* SYCL headers */
3231
#include <iomanip>
3332
#include <iostream>
3433
#include <unordered_map>
34+
#include <vector>
3535

3636
using namespace cl::sycl;
3737

@@ -143,10 +143,10 @@ DPCTLDeviceMgr_GetCachedContext(__dpctl_keep const DPCTLSyclDeviceRef DRef)
143143
__dpctl_give DPCTLDeviceVectorRef
144144
DPCTLDeviceMgr_GetDevices(int device_identifier)
145145
{
146-
vector_class_t<DPCTLSyclDeviceRef> *Devices = nullptr;
146+
std::vector<DPCTLSyclDeviceRef> *Devices = nullptr;
147147

148148
try {
149-
Devices = new vector_class_t<DPCTLSyclDeviceRef>();
149+
Devices = new std::vector<DPCTLSyclDeviceRef>();
150150
} catch (std::bad_alloc const &ba) {
151151
delete Devices;
152152
return nullptr;

dpctl-capi/source/dpctl_sycl_event_interface.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
#include "dpctl_sycl_event_interface.h"
2828
#include "../helper/include/dpctl_utils_helper.h"
2929
#include "Support/CBindingWrapping.h"
30-
#include "vector_type.hpp"
3130
#include <CL/sycl.hpp> /* SYCL headers */
31+
#include <vector>
3232

3333
using namespace cl::sycl;
3434

@@ -197,9 +197,9 @@ DPCTLEvent_GetWaitList(__dpctl_keep DPCTLSyclEventRef ERef)
197197
std::cerr << "Cannot get wait list as input is a nullptr\n";
198198
return nullptr;
199199
}
200-
vector_class_t<DPCTLSyclEventRef> *EventsVectorPtr = nullptr;
200+
std::vector<DPCTLSyclEventRef> *EventsVectorPtr = nullptr;
201201
try {
202-
EventsVectorPtr = new vector_class_t<DPCTLSyclEventRef>();
202+
EventsVectorPtr = new std::vector<DPCTLSyclEventRef>();
203203
} catch (std::bad_alloc const &ba) {
204204
// \todo log error
205205
std::cerr << ba.what() << '\n';

dpctl-capi/source/dpctl_sycl_platform_interface.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@
2727
#include "dpctl_sycl_platform_interface.h"
2828
#include "../helper/include/dpctl_utils_helper.h"
2929
#include "Support/CBindingWrapping.h"
30-
#include "vector_type.hpp"
3130
#include <CL/sycl.hpp>
3231
#include <iomanip>
3332
#include <iostream>
3433
#include <set>
3534
#include <sstream>
35+
#include <vector>
3636

3737
using namespace cl::sycl;
3838

3939
namespace
4040
{
4141
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(platform, DPCTLSyclPlatformRef);
4242
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(device_selector, DPCTLSyclDeviceSelectorRef);
43-
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(vector_class_t<DPCTLSyclPlatformRef>,
43+
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(std::vector<DPCTLSyclPlatformRef>,
4444
DPCTLPlatformVectorRef);
4545
} // namespace
4646

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

209209
__dpctl_give DPCTLPlatformVectorRef DPCTLPlatform_GetPlatforms()
210210
{
211-
vector_class_t<DPCTLSyclPlatformRef> *Platforms = nullptr;
211+
std::vector<DPCTLSyclPlatformRef> *Platforms = nullptr;
212212

213213
auto platforms = platform::get_platforms();
214214

215215
try {
216-
Platforms = new vector_class_t<DPCTLSyclPlatformRef>();
216+
Platforms = new std::vector<DPCTLSyclPlatformRef>();
217217
Platforms->reserve(platforms.size());
218218
} catch (std::bad_alloc const &ba) {
219219
return nullptr;

dpctl-capi/source/dpctl_sycl_queue_manager.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
#include "dpctl_sycl_queue_manager.h"
2727
#include "Support/CBindingWrapping.h"
2828
#include "dpctl_sycl_device_manager.h"
29-
#include "vector_type.hpp" /* vector_class_t */
30-
#include <CL/sycl.hpp> /* SYCL headers */
29+
#include <CL/sycl.hpp> /* SYCL headers */
30+
#include <vector>
3131

3232
using namespace cl::sycl;
3333

@@ -43,7 +43,7 @@ DEFINE_SIMPLE_CONVERSION_FUNCTIONS(context, DPCTLSyclContextRef)
4343

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

dpctl-capi/source/vector_type.hpp

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)