# Adding Info Objects or hints to SYCL

**URL:** <https://community.khronos.org/t/adding-info-objects-or-hints-to-sycl/108776>\
**Category:** SYCL\
**Created:** [June 19, 2022, 4:57pm UTC](https://community.khronos.org/t/adding-info-objects-or-hints-to-sycl/108776 "2022-06-19T16:57:17Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![tschuett](https://community.khronos.org/user_avatar/community.khronos.org/tschuett/32/8420_2.png) [@tschuett](https://community.khronos.org/u/tschuett)\
**Post date:** [June 19, 2022, 4:57pm UTC](https://community.khronos.org/t/adding-info-objects-or-hints-to-sycl/108776/1 "2022-06-19T16:57:17Z")

</div>

MPI supports info objects, see MPI 4.0 standard chapter 10. They are hints to the implementation and may be ignored. SQL supports a similar mechanism. I am wondering whether adding hints to SYCL would provide further optimisation opportunities.

```nohighlight
let mut queue = Queue::new();

let buffer = Buffer::<f64, 3>::new3(N, N, N);

let range = Range::new2(N, N);
let accessor = DeviceAccessor::new(&buffer, AccessMode::Write,
                                            AccessorInfo::LOW_LAT);

let command_group = CommandGroup::builder()
    .add_accessor("A", Rc::new(accessor))
    .add_parallel_for("index", &range, "A[index] = index[0] * 2 + index[1];")
    .build();

queue.submit(command_group);

```

```cpp
enum class AccessorInfo {
  LOW_TRAFFIC,
  HIGH_BW,
  LOW_LAT,
}

```

In my first attempt, I am adding hints to accessors. You can specify the memory access pattern.

---

<div class="post-metadata">

**Author:** ![keryell1](https://community.khronos.org/letter_avatar_proxy/v4/letter/k/48db29/32.png) [@keryell1](https://community.khronos.org/u/keryell1)\
**Post date:** [June 21, 2022, 12:19am UTC](https://community.khronos.org/t/adding-info-objects-or-hints-to-sycl/108776/2 "2022-06-21T00:19:00Z")

</div>

Most of the SYCL objects accept properties to somehow tweak the behavior as you suggest.  
There are a few properties [SYCL™ 2020 Specification (revision 6)](https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html#_properties) defined in the standard but many more are in use as extensions in the various implementations (for example to specify on which FPGA memory bank a buffer is viewed through an accessor, etc.).  
So, globally, I would say that what you propose is useful.  
But do you think we need another kind of objects like “hint” beyond the property lists we have already?  
Otherwise, we could start a SYCL Rust TSG (Task Sub-Group) inside the SYCL working group if you are motivated. 🙂

---

<div class="post-metadata">

**Author:** ![tschuett](https://community.khronos.org/user_avatar/community.khronos.org/tschuett/32/8420_2.png) [@tschuett](https://community.khronos.org/u/tschuett)\
**Post date:** [June 21, 2022, 10:47am UTC](https://community.khronos.org/t/adding-info-objects-or-hints-to-sycl/108776/3 "2022-06-21T10:47:45Z")

</div>

Maybe hints and property lists have different semantics. Saying that the access pattern of this accessor is streaming and it would benefit from HBM as a hint may be ignored by the runtime. I believe a property list is more assertive and may not be ignored.

---

<div class="post-metadata">

**Author:** ![tschuett](https://community.khronos.org/user_avatar/community.khronos.org/tschuett/32/8420_2.png) [@tschuett](https://community.khronos.org/u/tschuett)\
**Post date:** [June 21, 2022, 11:36am UTC](https://community.khronos.org/t/adding-info-objects-or-hints-to-sycl/108776/4 "2022-06-21T11:36:29Z")

</div>

In most cases, it would change the semantics of the program, if you would ignore property lists. Hints are different.

---

<div class="post-metadata">

**Author:** ![keryell1](https://community.khronos.org/letter_avatar_proxy/v4/letter/k/48db29/32.png) [@keryell1](https://community.khronos.org/u/keryell1)\
**Post date:** [June 21, 2022, 8:57pm UTC](https://community.khronos.org/t/adding-info-objects-or-hints-to-sycl/108776/5 "2022-06-21T20:57:47Z")

</div>

It depends on what you put in the semantics. At the end this is the choice of the property implementer.  
For example we want AMD FPGA properties to be ignored when running on CPU such as if there is no HBM or DDR bank the program can still run.

---

<div class="post-metadata">

**Author:** ![tschuett](https://community.khronos.org/user_avatar/community.khronos.org/tschuett/32/8420_2.png) [@tschuett](https://community.khronos.org/u/tschuett)\
**Post date:** [June 21, 2022, 9:16pm UTC](https://community.khronos.org/t/adding-info-objects-or-hints-to-sycl/108776/6 "2022-06-21T21:16:41Z")

</div>

Totally agreed. These are neither vendor nor device specific hints. I just says would benefit from HBM. Implementations are free to ignore this hint even if they have HBM.

---

<div class="post-metadata">

**Author:** ![tschuett](https://community.khronos.org/user_avatar/community.khronos.org/tschuett/32/8420_2.png) [@tschuett](https://community.khronos.org/u/tschuett)\
**Post date:** [June 21, 2022, 10:21pm UTC](https://community.khronos.org/t/adding-info-objects-or-hints-to-sycl/108776/7 "2022-06-21T22:21:31Z")

</div>

Scenario 1: The first accessor has a hint low latency. The second accessor has a hint high bandwidth.  
Scenario 2: No hints at all.

I guess there are cases where the first scenario is faster because the implementation can make more informed decisions.

---

<div class="post-metadata">

**Author:** ![keryell1](https://community.khronos.org/letter_avatar_proxy/v4/letter/k/48db29/32.png) [@keryell1](https://community.khronos.org/u/keryell1)\
**Post date:** [June 21, 2022, 10:34pm UTC](https://community.khronos.org/t/adding-info-objects-or-hints-to-sycl/108776/8 "2022-06-21T22:34:38Z")

</div>

Globally I would say this is always good to have more information as you propose.  
But at the same time it has to be driven by the current implementations for some existing hardware.  
Looking at [https://www.mpi-forum.org/docs/mpi-4.0/mpi40-report.pdf](https://www.mpi-forum.org/docs/mpi-4.0/mpi40-report.pdf) chapter 10, this is similar to SYCL properties, just that in SYCL this is simpler since it relies on modern C++ and not C or Fortran.

---

<div class="post-metadata">

**Author:** ![tschuett](https://community.khronos.org/user_avatar/community.khronos.org/tschuett/32/8420_2.png) [@tschuett](https://community.khronos.org/u/tschuett)\
**Post date:** [June 21, 2022, 11:21pm UTC](https://community.khronos.org/t/adding-info-objects-or-hints-to-sycl/108776/9 "2022-06-21T23:21:30Z")

</div>

Note that I used an enum class for hints to limit the number of possible values.

---

<div class="post-metadata">

**Author:** ![system](https://community.khronos.org/uploads/default/original/2X/b/ba89cb49313a0e869198c8be354afde8bcae027e.png) [@system](https://community.khronos.org/u/system)\
**Post date:** [December 18, 2022, 11:21pm UTC](https://community.khronos.org/t/adding-info-objects-or-hints-to-sycl/108776/10 "2022-12-18T23:21:39Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
