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

Commit 2656ca9

Browse files
committed
This commit removes the unnessasary usage of the buffer allocator in virtual pointer.
1 parent 8c4b221 commit 2656ca9

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

include/vptr/virtual_ptr.hpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ using sycl_acc_mode = cl::sycl::access::mode;
4949
* Default values for template arguments
5050
*/
5151
using buffer_data_type_t = uint8_t;
52-
using buffer_allocator_base_t = cl::sycl::buffer_allocator<buffer_data_type_t>;
53-
using buffer_allocator_default_t =
54-
cl::sycl::default_allocator<buffer_data_type_t>;
5552
const sycl_acc_target default_acc_target = sycl_acc_target::global_buffer;
5653
const sycl_acc_mode default_acc_mode = sycl_acc_mode::read_write;
5754

@@ -232,11 +229,10 @@ class PointerMapper {
232229
/* get_buffer.
233230
* Returns a buffer from the map using the pointer address
234231
*/
235-
template <typename buffer_allocator = buffer_allocator_base_t,
236-
typename buffer_data_type = buffer_data_type_t>
237-
cl::sycl::buffer<buffer_data_type, 1, buffer_allocator> get_buffer(
232+
template <typename buffer_data_type = buffer_data_type_t>
233+
cl::sycl::buffer<buffer_data_type, 1> get_buffer(
238234
const virtual_pointer_t ptr) {
239-
using buffer_t = cl::sycl::buffer<buffer_data_type, 1, buffer_allocator>;
235+
using buffer_t = cl::sycl::buffer<buffer_data_type, 1>;
240236

241237
// get_node() returns a `buffer_mem`, so we need to cast it to a `buffer<>`.
242238
// We can do this without the `buffer_mem` being a pointer, as we
@@ -256,7 +252,7 @@ class PointerMapper {
256252
typename buffer_data_type = buffer_data_type_t>
257253
cl::sycl::accessor<buffer_data_type, 1, access_mode, access_target>
258254
get_access(const virtual_pointer_t ptr) {
259-
auto buf = get_buffer<buffer_allocator_base_t, buffer_data_type>(ptr);
255+
auto buf = get_buffer<buffer_data_type>(ptr);
260256
return buf.template get_access<access_mode>();
261257
}
262258

@@ -273,7 +269,7 @@ class PointerMapper {
273269
typename buffer_data_type = buffer_data_type_t>
274270
cl::sycl::accessor<buffer_data_type, 1, access_mode, access_target>
275271
get_access(const virtual_pointer_t ptr, cl::sycl::handler& cgh) {
276-
auto buf = get_buffer<buffer_allocator_base_t, buffer_data_type>(ptr);
272+
auto buf = get_buffer<buffer_data_type>(ptr);
277273
return buf.template get_access<access_mode, access_target>(cgh);
278274
}
279275

@@ -504,13 +500,12 @@ inline void PointerMapper::remove_pointer<false>(const virtual_pointer_t ptr) {
504500
* \param size Size in bytes of the desired allocation
505501
* \throw cl::sycl::exception if error while creating the buffer
506502
*/
507-
template <typename buffer_allocator = buffer_allocator_default_t>
508503
inline void* SYCLmalloc(size_t size, PointerMapper& pMap) {
509504
if (size == 0) {
510505
return nullptr;
511506
}
512507
// Create a generic buffer of the given size
513-
using buffer_t = cl::sycl::buffer<buffer_data_type_t, 1, buffer_allocator>;
508+
using buffer_t = cl::sycl::buffer<buffer_data_type_t, 1>;
514509
auto thePointer = pMap.add_pointer(buffer_t(cl::sycl::range<1>{size}));
515510
// Store the buffer on the global list
516511
return static_cast<void*>(thePointer);

0 commit comments

Comments
 (0)