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

Commit ee55af2

Browse files
AdamBrouwersHarriesDuncanMcBain
authored andcommitted
Add property_list parameter to syclmalloc (#157)
Property lists are useful, and we still want to pass them to buffers through the SYCL malloc interface. In addition, a related test was failing because of an interface change, and has been removed.
1 parent 05e2b37 commit ee55af2

File tree

2 files changed

+2
-27
lines changed

2 files changed

+2
-27
lines changed

include/vptr/virtual_ptr.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,13 +500,13 @@ inline void PointerMapper::remove_pointer<false>(const virtual_pointer_t ptr) {
500500
* \param size Size in bytes of the desired allocation
501501
* \throw cl::sycl::exception if error while creating the buffer
502502
*/
503-
inline void* SYCLmalloc(size_t size, PointerMapper& pMap) {
503+
inline void* SYCLmalloc(size_t size, PointerMapper& pMap, const property_list &pList = {}) {
504504
if (size == 0) {
505505
return nullptr;
506506
}
507507
// Create a generic buffer of the given size
508508
using sycl_buffer_t = cl::sycl::buffer<buffer_data_type_t, 1>;
509-
auto thePointer = pMap.add_pointer(sycl_buffer_t(cl::sycl::range<1>{size}));
509+
auto thePointer = pMap.add_pointer(sycl_buffer_t(cl::sycl::range<1>{size}, pList));
510510
// Store the buffer on the global list
511511
return static_cast<void*>(thePointer);
512512
}

tests/vptr/accessor.cc

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -121,28 +121,3 @@ TEST(accessor, two_buffers) {
121121
}
122122
}
123123

124-
TEST(accessor, allocator) {
125-
// an allocator type
126-
using alloc_t = cl::sycl::buffer_allocator<uint8_t>;
127-
128-
PointerMapper pMap;
129-
{
130-
ASSERT_EQ(pMap.count(), 0u);
131-
132-
// add a pointer with the base allocator type
133-
void* ptrA = SYCLmalloc(100 * sizeof(int), pMap);
134-
135-
// get the buffer with the base allocator type
136-
auto bufA = pMap.get_buffer(ptrA);
137-
138-
ASSERT_EQ(pMap.count(), 1u);
139-
140-
// add a pointer with the allocator type
141-
void* ptrB = SYCLmalloc<alloc_t>(100 * sizeof(int), pMap);
142-
143-
// get the buffer with the allocator type
144-
cl::sycl::buffer<uint8_t, 1, alloc_t> bufB = pMap.get_buffer<alloc_t>(ptrB);
145-
146-
ASSERT_EQ(pMap.count(), 2u);
147-
}
148-
}

0 commit comments

Comments
 (0)