Skip to content
Closed
Changes from all commits
Commits
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
119 changes: 119 additions & 0 deletions sycl/doc/extensions/proposed/sycl_ext_oneapi_queue_priority.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
= sycl_ext_oneapi_queue_priority

:source-highlighter: coderay
:coderay-linenums-mode: table

// This section needs to be after the document title.
:doctype: book
:toc2:
:toc: left
:encoding: utf-8
:lang: en
:dpcpp: pass:[DPC++]

// Set the default source code type in this document to C++,
// for syntax highlighting purposes. This is needed because
// docbook uses c++ and html5 uses cpp.
:language: {basebackend@docbook:c++:cpp}


== Notice

[%hardbreaks]
Copyright (C) 2022-2023 Intel Corporation. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Copyright (C) 2022-2023 Intel Corporation. All rights reserved.
Copyright (C) 2022 Intel Corporation. All rights reserved.

We just use the first date of publication now.


Khronos(R) is a registered trademark and SYCL(TM) and SPIR(TM) are trademarks
of The Khronos Group Inc. OpenCL(TM) is a trademark of Apple Inc. used by
permission by Khronos.


== Contact

To report problems with this extension, please open a new issue at:

https://github.com/intel/llvm/issues


== Dependencies

This extension is written against the SYCL 2020 revision 6 specification. All
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This extension is written against the SYCL 2020 revision 6 specification. All
This extension is written against the SYCL 2020 revision 8 specification. All

references below to the "core SYCL specification" or to section numbers in the
SYCL specification refer to that revision.

== Status

This is a proposed extension specification, intended to gather community
feedback. Interfaces defined in this specification may not be implemented yet
or may be in a preliminary state. The specification itself may also change in
incompatible ways before it is finalized. *Shipping software products should
not rely on APIs defined in this specification.*

== Specification

This extension defines an additional queue property that permit a backend,
when supported, to create command queues with different levels of priority.
Priorities are hints from the programmer that certain command submissions
to a device may execute before others of lesser priority.

=== Feature test macro

This extension provides a feature-test macro as described in the core SYCL
specification. An implementation supporting this extension must predefine the
macro `SYCL_EXT_ONEAPI_QUEUE_PRIORITY` to one of the values defined in the table
below. Applications can test for the existence of this macro to determine if
the implementation supports this feature, or applications can test the macro's
value to determine which of the extension's features the implementation
supports.

[%header,cols="1,5"]
|===
|Value
|Description

|1
|Initial version of this extension.
|===

=== API Additions


This extension defines the following new property that may be passed to the
constructor of the `queue` class:

[%header,cols="1,5"]
|===
|Property
|Description

| `sycl::ext::oneapi::property::queue::priority`
|
|===

[%header,cols="1,5"]
|===
|Property Constructor
|Description

| `sycl::ext::oneapi::property::queue::priority(int priority=0)`
| Specifies that the queue should be constructed with the specified `priority`.
Commands executed by this queue may take priority over commands with lower priority
on this queue's device. The default priority has value `0`. If the user specifies
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should not have a default value. Users should be required to specify a priority. There is no reason to use the priority property if you want to get default behavior If you want default behavior, you don't need the property at all. Code that uses property wants some non-default behavior, so we should require that code to specify which priority they want.

Otherwise, I can imagine someone writing code like this, thinking that they created a queue with high priority:

sycl::queue q{priority{}};

`priority` outside the range returned by `sycl::ext::oneapi::queue::priority_range`,
`priority` will be clamped down or up to the least or greatest priority in the range.

|===

This extension also defines the following new query for the `queue` class:

[%header,cols="1,5"]
|===
|Property
|Description

| `sycl::ext::oneapi::info::queue::priority_range`
| Returns a `std::array<int,2>` that represents the `{leastPriority,greatestPriority}`
for this queue. Lower numbers imply greater priorities. The default priority has value `0`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lower numbers imply greater priorities

I think this will be confusing. Can we flip this, so that higher numbers mean higher priority? This would match the Posix sched_get_priority_max / sched_get_priority_min APIs, and it would match the Windows SetThreadPriority API. In all of those, higher numbers mean higher priority,

Specifying priorities outside of this range when creating a queue will result in the specified
priority being clamped down or up to the least priority or greatest priority, respectively.

|===