Skip to content
This repository was archived by the owner on Aug 11, 2023. It is now read-only.
Merged
Changes from all commits
Commits
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
17 changes: 6 additions & 11 deletions include/vptr/virtual_ptr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ using sycl_acc_mode = cl::sycl::access::mode;
* Default values for template arguments
*/
using buffer_data_type_t = uint8_t;
using buffer_allocator_base_t = cl::sycl::buffer_allocator<buffer_data_type_t>;
using buffer_allocator_default_t =
cl::sycl::default_allocator<buffer_data_type_t>;
const sycl_acc_target default_acc_target = sycl_acc_target::global_buffer;
const sycl_acc_mode default_acc_mode = sycl_acc_mode::read_write;

Expand Down Expand Up @@ -232,11 +229,10 @@ class PointerMapper {
/* get_buffer.
* Returns a buffer from the map using the pointer address
*/
template <typename buffer_allocator = buffer_allocator_base_t,
typename buffer_data_type = buffer_data_type_t>
cl::sycl::buffer<buffer_data_type, 1, buffer_allocator> get_buffer(
template <typename buffer_data_type = buffer_data_type_t>
cl::sycl::buffer<buffer_data_type, 1> get_buffer(
const virtual_pointer_t ptr) {
using buffer_t = cl::sycl::buffer<buffer_data_type, 1, buffer_allocator>;
using buffer_t = cl::sycl::buffer<buffer_data_type, 1>;

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

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

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