Skip to content
This repository was archived by the owner on Aug 11, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions include/vptr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ simultaneously.
## Usage

Include the `virtual_ptr` header file in your program. Replace your
device `malloc` and `free` operations with `codeplay::SYCLmalloc`
and `codeplay::SYCLfree`. These functions are not thread-safe, even
device `malloc` and `free` operations with `vptr::SYCLmalloc`
and `vptr::SYCLfree`. These functions are not thread-safe, even
though the underlying SYCL buffer objects are thread-safe.

To retrieve the SYCL buffer from the virtual pointer, use the
`codeplay::PointerMapper::get_buffer` function. The offset into the
`vptr::PointerMapper::get_buffer` function. The offset into the
SYCL buffer on the device side can be retrieved using the
`codeplay::PointerMapper::get_offset` function. A pointer of size
`vptr::PointerMapper::get_offset` function. A pointer of size
zero can be malloc’ed and free’d but will throw an exception if
accessed.

Expand Down
14 changes: 6 additions & 8 deletions include/vptr/virtual_ptr.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2017 Codeplay Software Limited
* Copyright (C) Codeplay Software Limited
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand Down Expand Up @@ -35,15 +35,14 @@

#include <CL/sycl.hpp>


#include <cstddef>
#include <queue>
#include <set>
#include <stdexcept>
#include <map>

namespace cl {
namespace sycl {
namespace codeplay {
namespace vptr {

using sycl_acc_target = cl::sycl::access::target;
using sycl_acc_mode = cl::sycl::access::mode;
Expand Down Expand Up @@ -506,7 +505,7 @@ inline void PointerMapper::remove_pointer<false>(const virtual_pointer_t ptr) {
* \throw cl::sycl::exception if error while creating the buffer
*/
inline void* SYCLmalloc(size_t size, PointerMapper& pMap,
const property_list& pList = {}) {
const cl::sycl::property_list& pList = {}) {
if (size == 0) {
return nullptr;
}
Expand Down Expand Up @@ -538,7 +537,6 @@ inline void SYCLfreeAll(PointerMapper& pMap) {
pMap.clear();
}

} // namespace codeplay
} // namespace sycl
} // namespace cl
} // namespace vptr

#endif // CL_SYCL_SDK_CODEPLAY_VIRTUAL_PTR_HPP
2 changes: 1 addition & 1 deletion samples/vptr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const size_t M = 150;
int main() {
{
queue myQueue;
cl::sycl::codeplay::PointerMapper pMap;
vptr::PointerMapper pMap;

/* Allocate the matrices using SYCLmalloc. a, b and c are virtual pointers,
* pointing to device buffers.
Expand Down
2 changes: 1 addition & 1 deletion tests/vptr/accessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const sycl_acc_target sycl_acc_host = sycl_acc_target::host_buffer;
using sycl_acc_mode = cl::sycl::access::mode;
const sycl_acc_mode sycl_acc_rw = sycl_acc_mode::read_write;

using namespace cl::sycl::codeplay;
using namespace vptr;

TEST(accessor, basic_test) {
PointerMapper pMap;
Expand Down
2 changes: 1 addition & 1 deletion tests/vptr/basic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const sycl_acc_mode sycl_acc_rw = sycl_acc_mode::read_write;
using sycl_acc_target = cl::sycl::access::target;
const sycl_acc_target sycl_acc_host = sycl_acc_target::host_buffer;

using namespace cl::sycl::codeplay;
using namespace vptr;

TEST(pointer_mapper, basic_test) {
PointerMapper pMap;
Expand Down
2 changes: 1 addition & 1 deletion tests/vptr/offset.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const sycl_acc_target sycl_acc_buffer = sycl_acc_target::global_buffer;
using sycl_acc_mode = cl::sycl::access::mode;
const sycl_acc_mode sycl_acc_rw = sycl_acc_mode::read_write;

using namespace cl::sycl::codeplay;
using namespace vptr;

using buffer_t = PointerMapper::buffer_t;

Expand Down
2 changes: 1 addition & 1 deletion tests/vptr/space.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "vptr/pointer_alias.hpp"
#include "vptr/virtual_ptr.hpp"

using namespace cl::sycl::codeplay;
using namespace vptr;

using buffer_t = PointerMapper::buffer_t;

Expand Down