Skip to content
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
5656b91
Add mem_mgr class & buffer_t def
joeatodd Oct 3, 2024
d7898cb
Bring DPCT_USM_LEVEL_NONE code from dpct
joeatodd Oct 4, 2024
8dc0252
s/DPCT_USM/COMPAT_USM/
joeatodd Oct 4, 2024
c569ffe
Formatting & naming
joeatodd Oct 7, 2024
3d6562d
First effort at docs
joeatodd Oct 8, 2024
6b59b8b
Adding SYCLomatic-test tests as-is
joeatodd Oct 8, 2024
a735aef
compatify
joeatodd Oct 8, 2024
c65a025
Add build & run cmds
joeatodd Oct 8, 2024
26f63e0
renaming files
joeatodd Oct 8, 2024
4f70acb
compatify
joeatodd Oct 8, 2024
c7dcf91
compatify otra vez
joeatodd Oct 8, 2024
d22c4eb
compatify ultima vez
joeatodd Oct 8, 2024
3890f2d
Remove autocomments
joeatodd Oct 8, 2024
4a0ecd6
Add memory_common header to tests
joeatodd Oct 9, 2024
03a843b
s/dpct_kernel_name/syclcompat_kernel_name/
joeatodd Oct 9, 2024
7ebca22
Replace deprecated get_pointer()
joeatodd Oct 9, 2024
8d4e426
Remove mempcy_direction in the hopes its unnecessary
joeatodd Oct 9, 2024
fe6a0f6
memory_region is a class enum now
joeatodd Oct 9, 2024
03e0ff2
__PRETTY_FUNCTION__
joeatodd Oct 9, 2024
8388754
Test constant_memory object at global scope
joeatodd Oct 10, 2024
9f38b41
Can't write to a constant_memory region!
joeatodd Oct 10, 2024
3b497f7
Delete redundant tests
joeatodd Oct 10, 2024
a0a2817
Name tests properly
joeatodd Oct 10, 2024
26801fc
Fix comment typo
joeatodd Oct 10, 2024
72455f3
Remove redundant macro
joeatodd Oct 10, 2024
31b672b
pointer_t for constant_memory should be `const T *`
joeatodd Oct 10, 2024
80698ea
Update the README
joeatodd Oct 10, 2024
397c04e
Deprecate syclcompat::target in favour of sycl::target
joeatodd Oct 10, 2024
fa610e4
get_pointer -> get_multi_ptr
joeatodd Oct 10, 2024
a8ca6d1
Add USM_LEVEL_NONE specific fns
joeatodd Oct 10, 2024
de6de4e
Ensure lifetime of mem_mgr w.r.t. global-scope memory objects
joeatodd Oct 10, 2024
10cacd7
Harmonise new code w/ existing
joeatodd Oct 10, 2024
4ed2073
Delete old TODOs
joeatodd Oct 10, 2024
e3986cc
Updates to fill & memset
joeatodd Oct 10, 2024
580c4f7
Move memcpy_direction to detail
joeatodd Oct 14, 2024
cea476c
Formatting
joeatodd Oct 14, 2024
c7e44ad
Implement `syclcompat::free` using `detail::free`
joeatodd Oct 14, 2024
4720439
Re-enable memory_async tests since race condition is fixed
joeatodd Oct 14, 2024
2507bd8
Generalize AsyncTest to work with buffers too
joeatodd Oct 14, 2024
05a7f14
Implement enqueue_free using detail:free (handle buffers)
joeatodd Oct 14, 2024
3d7997f
Consolidate TODO for multi-device device_memory
joeatodd Oct 14, 2024
5b8dc3c
Replace sycl.hpp with sycl/detail/core.hpp
joeatodd Oct 17, 2024
2bddb98
Fix markdown reference
joeatodd Oct 17, 2024
9951ec0
Merge branch 'sycl' into jtodd/usm_level_none
joeatodd Oct 17, 2024
d3f8312
Apply suggestions from code review
joeatodd Oct 22, 2024
1d02f69
s/COMPAT_USM_LEVEL_NONE/SYCLCOMPAT_USM_LEVEL_NONE/
joeatodd Oct 22, 2024
2b72e40
As prev, in memory.hpp
joeatodd Oct 22, 2024
1781d5f
Address review feedback
joeatodd Oct 22, 2024
d984042
Improve variable naming
joeatodd Oct 22, 2024
2cc74ed
Actually check values in shared_memory_usmnon.cpp
joeatodd Oct 22, 2024
e435853
Improve test
joeatodd Oct 22, 2024
1042c8e
Move global/constant memory init() outside of cgh lambda
joeatodd Oct 22, 2024
7b88d79
Implement wait_and_free using detail::free
joeatodd Oct 22, 2024
834d941
Remove wait() in syclcompat::free for USM case
joeatodd Oct 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 24 additions & 15 deletions sycl/doc/syclcompat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ If available, the following extensions extend SYCLcompat functionality:
https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/experimental/sycl_ext_oneapi_max_work_group_query.md)
\[Optional\]

### Hardware Requirements

Some of the functionality provided by SYCLcompat relies on Unified Shared Memory (`aspect::usm_device_allocations`), though most of the USM-like memory APIs (malloc*, memcpy*, memset*) support hardware with only buffer/accessor support. See section [Buffer Support](#buffer-support) below.

## Usage

All functionality is available under the `syclcompat::` namespace, imported
Expand Down Expand Up @@ -606,14 +610,6 @@ namespace syclcompat {
namespace experimental {
// Forward declarations for types relating to unsupported memcpy_parameter API:

enum memcpy_direction {
host_to_host,
host_to_device,
device_to_host,
device_to_device,
automatic
};

#ifdef SYCL_EXT_ONEAPI_BINDLESS_IMAGES
class image_mem_wrapper;
#endif
Expand All @@ -632,7 +628,6 @@ struct memcpy_parameter {
data_wrapper from{};
data_wrapper to{};
sycl::range<3> size{};
syclcompat::detail::memcpy_direction direction{syclcompat::detail::memcpy_direction::automatic};
};

/// [UNSUPPORTED] Synchronously copies 2D/3D memory data specified by \p param .
Expand Down Expand Up @@ -709,18 +704,16 @@ enum class memory_region {

using byte_t = uint8_t;

enum class target { device, local };

template <memory_region Memory, class T = byte_t> class memory_traits {
public:
static constexpr sycl::access::address_space asp =
(Memory == memory_region::local)
? sycl::access::address_space::local_space
: sycl::access::address_space::global_space;
static constexpr target target =
static constexpr sycl::target target =
(Memory == memory_region::local)
? target::local
: target::device;
? sycl::target::local
: sycl::target::device;
static constexpr sycl::access_mode mode =
(Memory == memory_region::constant)
? sycl::access_mode::read
Expand All @@ -731,7 +724,7 @@ public:
using value_t = typename std::remove_cv_t<T>;
template <size_t Dimension = 1>
using accessor_t = typename std::conditional_t<
target == target::local,
target == sycl::target::local,
sycl::local_accessor<T, Dimension>,
sycl::accessor<T, Dimension, mode>>;
using pointer_t = T *;
Expand Down Expand Up @@ -854,6 +847,22 @@ public:

} // syclcompat
```
#### Buffer Support

Although SYCLcompat is primarily designed around the Unified Shared Memory
model, there is (limited) support for the buffer/accessor model. This can be
enabled by setting the compiler define `COMPAT_USM_LEVEL_NONE`. This macro
instructs SYCLcompat to effectively provide emulated USM pointers via a Memory
Manager singleton.

Note that in `COMPAT_USM_LEVEL_NONE` mode, the pointers returned by e.g.
`syclcompat::malloc`, and passed to `syclcompat::memcpy` can *only* interact
with `syclcompat` APIs. It is legal to perform pointer arithmetic on these
virtual pointers, but attempting to dereference them, passing them to `sycl`
APIs, or passing them into kernels will result in an error.

The SYCLcompat tests with the suffix `_usmnone.cpp` provide examples of how to
use `COMPAT_USM_LEVEL_NONE`.

### ptr_to_int

Expand Down
2 changes: 1 addition & 1 deletion sycl/include/syclcompat/defs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
**************************************************************************/

// The original source was under the license below:
//==---- dpct.hpp ---------------------------------*- C++ -*----------------==//
//==---- defs.hpp ---------------------------------*- C++ -*----------------==//
//
// Copyright (C) Intel Corporation
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Expand Down
Loading
Loading