Skip to content

Commit 8a25c46

Browse files
committed
change use_priority to priority_low and priority_high
Signed-off-by: Sergey V Maslov <[email protected]>
1 parent 00d1678 commit 8a25c46

File tree

6 files changed

+59
-48
lines changed

6 files changed

+59
-48
lines changed

sycl/doc/extensions/supported/sycl_ext_oneapi_queue_priority.asciidoc

100644100755
Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,27 @@ the implementation supports.
7474

7575
=== API of the extension
7676

77-
This extension adds support for a new property for SYCL queue constructors
77+
This extension adds support for new properties for SYCL queue constructors
7878
taking properties list:
7979

8080
```c++
8181
namespace sycl::ext::oneapi::property::queue {
8282

83-
class use_priority {
83+
class priority_low {
8484
public:
85-
using priority_type = enum {
86-
normal = 0, // default
87-
low = 1,
88-
high = 2
89-
};
90-
use_priority(priority_type);
85+
priority_low() = default;
86+
};
87+
class priority_high {
88+
public:
89+
priority_high() = default;
9190
};
9291

9392
} // namespace
9493
```
95-
The new property hints the SYCL runtime that the queue gets the specified
96-
priority for execution if supported by underlying target runtimes. This
97-
property is a hint and may safely be ignored by an implementation.
94+
The new properties hint the SYCL runtime that the queue gets the specified
95+
priority for execution if supported by underlying target runtimes. These
96+
properties are hints and may safely be ignored by an implementation.
97+
98+
It is illegal to specify both `priority_low` ans `priority_high` hints
99+
for the same queue, and would result in `invalid` exception thrown by
100+
SYCL runtime.

sycl/include/sycl/detail/properties_traits.def

100644100755
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ __SYCL_PARAM_TRAITS_SPEC(
1414
sycl::ext::oneapi::cuda::property::context::use_primary_context)
1515
__SYCL_PARAM_TRAITS_SPEC(sycl::property::queue::in_order)
1616
__SYCL_PARAM_TRAITS_SPEC(sycl::property::reduction::initialize_to_identity)
17-
__SYCL_PARAM_TRAITS_SPEC(sycl::ext::oneapi::property::queue::use_priority)
17+
__SYCL_PARAM_TRAITS_SPEC(sycl::ext::oneapi::property::queue::priority_low)
18+
__SYCL_PARAM_TRAITS_SPEC(sycl::ext::oneapi::property::queue::priority_high)

sycl/include/sycl/detail/property_helper.hpp

100644100755
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ enum DataLessPropKind {
4040
FusionNoBarrier = 13,
4141
FusionEnable = 14,
4242
FusionForce = 15,
43+
QueuePriorityLow = 16,
44+
QueuePriorityHigh = 17,
4345
// Indicates the last known dataless property.
44-
LastKnownDataLessPropKind = 15,
46+
LastKnownDataLessPropKind = 17,
4547
// Exceeding 32 may cause ABI breaking change on some of OSes.
4648
DataLessPropKindSize = 32
4749
};
@@ -54,8 +56,7 @@ enum PropWithDataKind {
5456
ImageContextBound = 3,
5557
BufferMemChannel = 4,
5658
AccPropBufferLocation = 5,
57-
QueuePriority = 6,
58-
PropWithDataKindSize = 7,
59+
PropWithDataKindSize = 6,
5960
};
6061

6162
// Base class for dataless properties, needed to check that the type of an

sycl/include/sycl/properties/queue_properties.hpp

100644100755
Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,11 @@ namespace queue {
2929
class discard_events
3030
: public ::sycl::detail::DataLessProperty<::sycl::detail::DiscardEvents> {};
3131

32-
class use_priority : public sycl::detail::PropertyWithData<
33-
sycl::detail::PropWithDataKind::QueuePriority> {
34-
public:
35-
using priority_type = enum {
36-
normal = 0, // default
37-
low = 1,
38-
high = 2
39-
};
40-
use_priority(priority_type Priority) : MPriority(Priority) {}
41-
priority_type get_priority() const { return MPriority; }
42-
43-
private:
44-
priority_type MPriority;
45-
};
32+
class priority_low : public sycl::detail::DataLessProperty<
33+
sycl::detail::QueuePriorityLow> {};
34+
class priority_high : public sycl::detail::DataLessProperty<
35+
sycl::detail::QueuePriorityHigh> {};
36+
4637
} // namespace queue
4738
} // namespace property
4839

@@ -82,7 +73,10 @@ template <>
8273
struct is_property_of<ext::oneapi::property::queue::discard_events, queue>
8374
: std::true_type {};
8475
template <>
85-
struct is_property_of<ext::oneapi::property::queue::use_priority, queue>
76+
struct is_property_of<ext::oneapi::property::queue::priority_low, queue>
77+
: std::true_type {};
78+
template <>
79+
struct is_property_of<ext::oneapi::property::queue::priority_high, queue>
8680
: std::true_type {};
8781
template <>
8882
struct is_property_of<property::queue::cuda::use_default_stream, queue>

sycl/source/detail/queue_impl.hpp

100644100755
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -312,14 +312,16 @@ class queue_impl {
312312
// queue property.
313313
CreationFlags |= PI_EXT_ONEAPI_QUEUE_DISCARD_EVENTS;
314314
}
315-
if (MPropList.has_property<ext::oneapi::property::queue::use_priority>()) {
316-
auto Priority =
317-
MPropList.get_property<ext::oneapi::property::queue::use_priority>()
318-
.get_priority();
319-
if (Priority == ext::oneapi::property::queue::use_priority::high)
320-
CreationFlags |= PI_EXT_ONEAPI_QUEUE_PRIORITY_HIGH;
321-
else if (Priority == ext::oneapi::property::queue::use_priority::low)
322-
CreationFlags |= PI_EXT_ONEAPI_QUEUE_PRIORITY_LOW;
315+
if (MPropList.has_property<ext::oneapi::property::queue::priority_low>()) {
316+
CreationFlags |= PI_EXT_ONEAPI_QUEUE_PRIORITY_LOW;
317+
}
318+
if (MPropList.has_property<ext::oneapi::property::queue::priority_high>()) {
319+
if (MPropList.has_property<ext::oneapi::property::queue::priority_low>()) {
320+
throw sycl::exception(make_error_code(errc::invalid),
321+
"Queue cannot be constructed with both of "
322+
"priority_low and priority_high.");
323+
}
324+
CreationFlags |= PI_EXT_ONEAPI_QUEUE_PRIORITY_HIGH;
323325
}
324326
RT::PiQueue Queue{};
325327
RT::PiContext Context = MContext->getHandleRef();

sycl/test/abi/sycl_symbols_linux.dump

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4057,7 +4057,8 @@ _ZNK4sycl3_V16detail11buffer_impl15getNativeVectorENS0_7backendE
40574057
_ZNK4sycl3_V16detail11buffer_impl16addInteropObjectERSt6vectorImSaImEE
40584058
_ZNK4sycl3_V16detail11image_plain11getRowPitchEv
40594059
_ZNK4sycl3_V16detail11image_plain12get_propertyINS0_3ext6oneapi4cuda8property7context19use_primary_contextEEET_v
4060-
_ZNK4sycl3_V16detail11image_plain12get_propertyINS0_3ext6oneapi8property5queue12use_priorityEEET_v
4060+
_ZNK4sycl3_V16detail11image_plain12get_propertyINS0_3ext6oneapi8property5queue12priority_lowEEET_v
4061+
_ZNK4sycl3_V16detail11image_plain12get_propertyINS0_3ext6oneapi8property5queue13priority_highEEET_v
40614062
_ZNK4sycl3_V16detail11image_plain12get_propertyINS0_3ext6oneapi8property6buffer22use_pinned_host_memoryEEET_v
40624063
_ZNK4sycl3_V16detail11image_plain12get_propertyINS0_8property5image12use_host_ptrEEET_v
40634064
_ZNK4sycl3_V16detail11image_plain12get_propertyINS0_8property5image13context_boundEEET_v
@@ -4071,7 +4072,8 @@ _ZNK4sycl3_V16detail11image_plain12get_propertyINS0_8property7context4cuda19use_
40714072
_ZNK4sycl3_V16detail11image_plain12get_propertyINS0_8property7no_initEEET_v
40724073
_ZNK4sycl3_V16detail11image_plain12get_propertyINS0_8property9reduction22initialize_to_identityEEET_v
40734074
_ZNK4sycl3_V16detail11image_plain12has_propertyINS0_3ext6oneapi4cuda8property7context19use_primary_contextEEEbv
4074-
_ZNK4sycl3_V16detail11image_plain12has_propertyINS0_3ext6oneapi8property5queue12use_priorityEEEbv
4075+
_ZNK4sycl3_V16detail11image_plain12has_propertyINS0_3ext6oneapi8property5queue12priority_lowEEEbv
4076+
_ZNK4sycl3_V16detail11image_plain12has_propertyINS0_3ext6oneapi8property5queue13priority_highEEEbv
40754077
_ZNK4sycl3_V16detail11image_plain12has_propertyINS0_3ext6oneapi8property6buffer22use_pinned_host_memoryEEEbv
40764078
_ZNK4sycl3_V16detail11image_plain12has_propertyINS0_8property5image12use_host_ptrEEEbv
40774079
_ZNK4sycl3_V16detail11image_plain12has_propertyINS0_8property5image13context_boundEEEbv
@@ -4096,7 +4098,8 @@ _ZNK4sycl3_V16detail11image_plain9get_rangeEv
40964098
_ZNK4sycl3_V16detail11stream_impl22get_max_statement_sizeEv
40974099
_ZNK4sycl3_V16detail11stream_impl8get_sizeEv
40984100
_ZNK4sycl3_V16detail12buffer_plain12get_propertyINS0_3ext6oneapi4cuda8property7context19use_primary_contextEEET_v
4099-
_ZNK4sycl3_V16detail12buffer_plain12get_propertyINS0_3ext6oneapi8property5queue12use_priorityEEET_v
4101+
_ZNK4sycl3_V16detail12buffer_plain12get_propertyINS0_3ext6oneapi8property5queue12priority_lowEEET_v
4102+
_ZNK4sycl3_V16detail12buffer_plain12get_propertyINS0_3ext6oneapi8property5queue13priority_highEEET_v
41004103
_ZNK4sycl3_V16detail12buffer_plain12get_propertyINS0_3ext6oneapi8property6buffer22use_pinned_host_memoryEEET_v
41014104
_ZNK4sycl3_V16detail12buffer_plain12get_propertyINS0_8property5image12use_host_ptrEEET_v
41024105
_ZNK4sycl3_V16detail12buffer_plain12get_propertyINS0_8property5image13context_boundEEET_v
@@ -4110,7 +4113,8 @@ _ZNK4sycl3_V16detail12buffer_plain12get_propertyINS0_8property7context4cuda19use
41104113
_ZNK4sycl3_V16detail12buffer_plain12get_propertyINS0_8property7no_initEEET_v
41114114
_ZNK4sycl3_V16detail12buffer_plain12get_propertyINS0_8property9reduction22initialize_to_identityEEET_v
41124115
_ZNK4sycl3_V16detail12buffer_plain12has_propertyINS0_3ext6oneapi4cuda8property7context19use_primary_contextEEEbv
4113-
_ZNK4sycl3_V16detail12buffer_plain12has_propertyINS0_3ext6oneapi8property5queue12use_priorityEEEbv
4116+
_ZNK4sycl3_V16detail12buffer_plain12has_propertyINS0_3ext6oneapi8property5queue12priority_lowEEEbv
4117+
_ZNK4sycl3_V16detail12buffer_plain12has_propertyINS0_3ext6oneapi8property5queue13priority_highEEEbv
41144118
_ZNK4sycl3_V16detail12buffer_plain12has_propertyINS0_3ext6oneapi8property6buffer22use_pinned_host_memoryEEEbv
41154119
_ZNK4sycl3_V16detail12buffer_plain12has_propertyINS0_8property5image12use_host_ptrEEEbv
41164120
_ZNK4sycl3_V16detail12buffer_plain12has_propertyINS0_8property5image13context_boundEEEbv
@@ -4317,7 +4321,8 @@ _ZNK4sycl3_V16kernel8get_infoINS0_4info6kernel7contextEEENS0_6detail19is_kernel_
43174321
_ZNK4sycl3_V16kernel8get_infoINS0_4info6kernel8num_argsEEENS0_6detail19is_kernel_info_descIT_E11return_typeEv
43184322
_ZNK4sycl3_V16kernel9getNativeEv
43194323
_ZNK4sycl3_V16stream12get_propertyINS0_3ext6oneapi4cuda8property7context19use_primary_contextEEET_v
4320-
_ZNK4sycl3_V16stream12get_propertyINS0_3ext6oneapi8property5queue12use_priorityEEET_v
4324+
_ZNK4sycl3_V16stream12get_propertyINS0_3ext6oneapi8property5queue12priority_lowEEET_v
4325+
_ZNK4sycl3_V16stream12get_propertyINS0_3ext6oneapi8property5queue13priority_highEEET_v
43214326
_ZNK4sycl3_V16stream12get_propertyINS0_3ext6oneapi8property6buffer22use_pinned_host_memoryEEET_v
43224327
_ZNK4sycl3_V16stream12get_propertyINS0_8property5image12use_host_ptrEEET_v
43234328
_ZNK4sycl3_V16stream12get_propertyINS0_8property5image13context_boundEEET_v
@@ -4331,7 +4336,8 @@ _ZNK4sycl3_V16stream12get_propertyINS0_8property7context4cuda19use_primary_conte
43314336
_ZNK4sycl3_V16stream12get_propertyINS0_8property7no_initEEET_v
43324337
_ZNK4sycl3_V16stream12get_propertyINS0_8property9reduction22initialize_to_identityEEET_v
43334338
_ZNK4sycl3_V16stream12has_propertyINS0_3ext6oneapi4cuda8property7context19use_primary_contextEEEbv
4334-
_ZNK4sycl3_V16stream12has_propertyINS0_3ext6oneapi8property5queue12use_priorityEEEbv
4339+
_ZNK4sycl3_V16stream12has_propertyINS0_3ext6oneapi8property5queue12priority_lowEEEbv
4340+
_ZNK4sycl3_V16stream12has_propertyINS0_3ext6oneapi8property5queue13priority_highEEEbv
43354341
_ZNK4sycl3_V16stream12has_propertyINS0_3ext6oneapi8property6buffer22use_pinned_host_memoryEEEbv
43364342
_ZNK4sycl3_V16stream12has_propertyINS0_8property5image12use_host_ptrEEEbv
43374343
_ZNK4sycl3_V16stream12has_propertyINS0_8property5image13context_boundEEEbv
@@ -4352,7 +4358,8 @@ _ZNK4sycl3_V17context11get_backendEv
43524358
_ZNK4sycl3_V17context11get_devicesEv
43534359
_ZNK4sycl3_V17context12get_platformEv
43544360
_ZNK4sycl3_V17context12get_propertyINS0_3ext6oneapi4cuda8property7context19use_primary_contextEEET_v
4355-
_ZNK4sycl3_V17context12get_propertyINS0_3ext6oneapi8property5queue12use_priorityEEET_v
4361+
_ZNK4sycl3_V17context12get_propertyINS0_3ext6oneapi8property5queue12priority_lowEEET_v
4362+
_ZNK4sycl3_V17context12get_propertyINS0_3ext6oneapi8property5queue13priority_highEEET_v
43564363
_ZNK4sycl3_V17context12get_propertyINS0_3ext6oneapi8property6buffer22use_pinned_host_memoryEEET_v
43574364
_ZNK4sycl3_V17context12get_propertyINS0_8property5image12use_host_ptrEEET_v
43584365
_ZNK4sycl3_V17context12get_propertyINS0_8property5image13context_boundEEET_v
@@ -4366,7 +4373,8 @@ _ZNK4sycl3_V17context12get_propertyINS0_8property7context4cuda19use_primary_cont
43664373
_ZNK4sycl3_V17context12get_propertyINS0_8property7no_initEEET_v
43674374
_ZNK4sycl3_V17context12get_propertyINS0_8property9reduction22initialize_to_identityEEET_v
43684375
_ZNK4sycl3_V17context12has_propertyINS0_3ext6oneapi4cuda8property7context19use_primary_contextEEEbv
4369-
_ZNK4sycl3_V17context12has_propertyINS0_3ext6oneapi8property5queue12use_priorityEEEbv
4376+
_ZNK4sycl3_V17context12has_propertyINS0_3ext6oneapi8property5queue12priority_lowEEEbv
4377+
_ZNK4sycl3_V17context12has_propertyINS0_3ext6oneapi8property5queue13priority_highEEEbv
43704378
_ZNK4sycl3_V17context12has_propertyINS0_3ext6oneapi8property6buffer22use_pinned_host_memoryEEEbv
43714379
_ZNK4sycl3_V17context12has_propertyINS0_8property5image12use_host_ptrEEEbv
43724380
_ZNK4sycl3_V17context12has_propertyINS0_8property5image13context_boundEEEbv
@@ -4390,7 +4398,8 @@ _ZNK4sycl3_V17context9getNativeEv
43904398
_ZNK4sycl3_V17handler27isStateExplicitKernelBundleEv
43914399
_ZNK4sycl3_V17handler30getOrInsertHandlerKernelBundleEb
43924400
_ZNK4sycl3_V17sampler12get_propertyINS0_3ext6oneapi4cuda8property7context19use_primary_contextEEET_v
4393-
_ZNK4sycl3_V17sampler12get_propertyINS0_3ext6oneapi8property5queue12use_priorityEEET_v
4401+
_ZNK4sycl3_V17sampler12get_propertyINS0_3ext6oneapi8property5queue12priority_lowEEET_v
4402+
_ZNK4sycl3_V17sampler12get_propertyINS0_3ext6oneapi8property5queue13priority_highEEET_v
43944403
_ZNK4sycl3_V17sampler12get_propertyINS0_3ext6oneapi8property6buffer22use_pinned_host_memoryEEET_v
43954404
_ZNK4sycl3_V17sampler12get_propertyINS0_8property5image12use_host_ptrEEET_v
43964405
_ZNK4sycl3_V17sampler12get_propertyINS0_8property5image13context_boundEEET_v
@@ -4404,7 +4413,8 @@ _ZNK4sycl3_V17sampler12get_propertyINS0_8property7context4cuda19use_primary_cont
44044413
_ZNK4sycl3_V17sampler12get_propertyINS0_8property7no_initEEET_v
44054414
_ZNK4sycl3_V17sampler12get_propertyINS0_8property9reduction22initialize_to_identityEEET_v
44064415
_ZNK4sycl3_V17sampler12has_propertyINS0_3ext6oneapi4cuda8property7context19use_primary_contextEEEbv
4407-
_ZNK4sycl3_V17sampler12has_propertyINS0_3ext6oneapi8property5queue12use_priorityEEEbv
4416+
_ZNK4sycl3_V17sampler12has_propertyINS0_3ext6oneapi8property5queue12priority_lowEEEbv
4417+
_ZNK4sycl3_V17sampler12has_propertyINS0_3ext6oneapi8property5queue13priority_highEEEbv
44084418
_ZNK4sycl3_V17sampler12has_propertyINS0_3ext6oneapi8property6buffer22use_pinned_host_memoryEEEbv
44094419
_ZNK4sycl3_V17sampler12has_propertyINS0_8property5image12use_host_ptrEEEbv
44104420
_ZNK4sycl3_V17sampler12has_propertyINS0_8property5image13context_boundEEEbv

0 commit comments

Comments
 (0)