Skip to content

Commit 492f0ba

Browse files
AerialMantisRuyman
authored andcommitted
CP019: Add initial draft of on-chip memory proposal. (#83)
1 parent c1cc06b commit 492f0ba

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,4 @@ Each proposal in the table below will be tagged with one of the following states
5454
| CP013 | [Supporting Heterogeneous & Distributed Computing Through Affinity](affinity/index.md) | ISO C++ SG1, SG14 | 15 November 2017 | 12 August 2018 | _Work in Progress_ |
5555
| CP014 | [Shared Virtual Memory](svm/index.md) | SYCL 2.2 | 22 January 2018 | 22 January 2018 | _Work in Progress_ |
5656
| CP015 | [Specialization Constant](spec-constant/index.md) | SYCL 1.2.1 extension / SYCL 2.2 | 24 April 2018 | 24 April 2018 | _Work in Progress_ |
57+
| CP019 | [On-chip Memory Allocation](onchip-memory/index.md) | SYCL 1.2.1 extension / SYCL 2.2 | 03 December 2018 | 03 December 2018 | _Work in Progress_ |

onchip-memory/index.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# On-chip Memory Allocation
2+
3+
| Proposal ID | CP019 |
4+
|-------------|--------|
5+
| Name | On-chip Memory Allocation |
6+
| Previous Names | n/a |
7+
| Date of Creation | 03 December 2018 |
8+
| Target | SYCL 1.2.1 vendor extension |
9+
| Current Status | _Work in Progress_ |
10+
| Reply-to | Gordon Brown <gordon@codeplay.com> |
11+
| Original author | Gordon Brown <gordon@codeplay.com> |
12+
| Contributors | Gordon Brown <gordon@codeplay.com> Ruyman Reyes <ruyman@codeplay.com> |
13+
14+
## Overview
15+
16+
See sycl-1.2.1/onchip-memory.md
17+
18+
## Versions
19+
20+
| Version | Last Modified | Document |
21+
|---------|----- | ---------|
22+
| 0.1 Draft | 03 December 2018 | [Link](sycl-1.2.1/onchip-memory.md) |
23+
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# On-chip-Memory Allocation
2+
3+
| Proposal ID | CP019 |
4+
|-------------|--------|
5+
| Name | On-chip-Memory Allocation |
6+
| Date of Creation | 03 December 2018 |
7+
| Target | SYCL 1.2.1 vendor extension |
8+
| Current Status | _Work In Progress_ |
9+
| Implemented in | _N/A_ |
10+
| Reply-to | Gordon Brown <gordon@codeplay.com> |
11+
| Original author | Gordon Brown <gordon@codeplay.com> |
12+
| Contributors | Gordon Brown <gordon@codeplay.com>, Ruyman Reyes <ruyman@codeplay.com> |
13+
14+
## Overview
15+
16+
Various OpenCL platforms for embedded system provides an additional dedicated on-chip memory region that is not available in the standard OpenCL memory model. This memory region is accessible in the global address space and adheres to the OpenCL memory model requirements for global memory, however is lower latency to access. This proposal is to introduce an extension to SYCL that will allow buffers to be allocated in this on-chip memory region.
17+
18+
# Requirements
19+
20+
In designing an interface for this feature we must adhere to the following requirement:
21+
22+
* We must provide a way for the SYCL interface to instruct the SYCL runtime that a buffer object should allocate memory in an on-chip memory region.
23+
* We must allow buffers which are allocated in a on-chip memory region to also be accessed on the host.
24+
* We must allow for the SYCL runtime to preemptively allocate buffers using a on-chip memory region in the buffer constructor.
25+
* We must allow this extension to fall-back if on-chip memory is not supported.
26+
27+
# Proposed Design
28+
29+
```cpp
30+
buffer<float, 1> onchipBuffer(range, {property::buffer::context_bound(queue.get_context()), codeplay::property::buffer::use_onchip_memory(cl::sycl::codeplay::property::required)});
31+
32+
queue.submit([&](handler &cgh) {
33+
auto onchipAcc = onchipBuffer.get_access<access::mode::read_write>(cgh);
34+
35+
cgh.parallel_for(range, [=](id<1> id) {
36+
do_something(onchipAcc);
37+
});
38+
});
39+
```
40+
41+
## `use_onchip_memory` property
42+
43+
The `use_onchip_memory` is available to `buffer`s and can be used to instruct the SYCL runtime that it should use on-chip memory to allocate a buffer.
44+
45+
This approach allows SYCL buffers to support on-chip memory to be used with minimal changes to user code. The philosophy of this approach is that on-chip is an extension of the global address space and can be accessed as global memory can, so it should accessed as though it were a global buffer, but the underlying memory allocation is in a different location with different access latency.
46+
47+
A SYCL buffer that is using on-chip memory will have the following restriction:
48+
* The buffer may not perform map/unmap operations.
49+
* The buffer may not support the creation of sub buffers.
50+
51+
## `require` and `prefer` tags
52+
53+
In this proposal we also introduce the `require` and `prefer` property tags, one of which is passed to the construction of a property. These tags instruct the SYCL runtime the priority of the property, where `require` requires the SYCL runtime to throw an exception if the property cannot be support and `prefer` allows the SYCL runtime to fall-back ini the case that the property is not supported.
54+
55+
In the case of fall-back the SYCL runtime will behave **as-if** the property were not specified.
56+
57+
Currently this proposal only suggests using the `require` and `prefer` tags for the `use_onchip_memory` property, however the intention is that these tags can be applied to other SYCL properties.
58+
59+
## Relationship with `context_bound` property
60+
61+
The `context_bound` property is not required or inferred by using the `use_onchip_memory` property, however users may want to use the two properties in tandem to ensure that memory is only allocated on the context which supports on-chip memory and allow the constructor to preemptively allocate on-chip memory in the buffer constructor.
62+
63+
## References
64+
65+
* SYCL 1.2.1 specification
66+
* OpenCL 1.2 specification

0 commit comments

Comments
 (0)