Skip to content

Commit bd5a102

Browse files
authored
Merge pull request #623 from gmlueck/gmlueck/default-context
Clarify default context behavior
2 parents 0ec8235 + 3a69290 commit bd5a102

1 file changed

Lines changed: 40 additions & 11 deletions

File tree

adoc/chapters/programming_interface.adoc

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,15 @@ The [code]#platform# class also provides constructors, but constructing a new
969969
[code]#platform# instance merely creates a new object that is a copy of one of
970970
the objects returned by [api]#platform::get_platforms#.
971971

972+
Each platform has an associated default context which contains all of the
973+
<<root-device,root devices>> in the platform.
974+
This default context does not have an asynchronous error handler.
975+
Applications can retrieve a copy of this default `context` object, for example,
976+
by constructing a `queue`.
977+
These copies follow the common reference semantics, as though they are all
978+
copies of an internal per-platform `context` object representing the platform's
979+
default context.
980+
972981
The [code]#platform# class provides the common reference semantics as defined in
973982
<<sec:reference-semantics>>.
974983

@@ -3774,10 +3783,6 @@ passing <<async-error,asynchronous errors>> at specific times to an
37743783
The application can wait for all <<command-group,command groups>> submitted to a
37753784
queue calling [api]#queue::wait# or [api]#queue::wait_and_throw#.
37763785

3777-
All constructors of the [code]#queue# class implicitly construct a
3778-
[code]#platform#, [code]#device#, and [code]#context# in order to facilitate the
3779-
construction of the queue.
3780-
37813786
A queue may be destroyed even when there are uncompleted <<command, commands>>
37823787
that have been submitted to the queue.
37833788
Doing so does not block.
@@ -3817,6 +3822,9 @@ explicit queue(const property_list& propList = {})
38173822

38183823
_Effects:_ Constructs a [code]#queue# object using the device selected by
38193824
[code]#default_selector_v#.
3825+
The queue's platform is the platform that contains this device.
3826+
The queue's context is this platform's default context as described in
3827+
<<sec:platform-class>>.
38203828

38213829
'''
38223830

@@ -3829,6 +3837,9 @@ explicit queue(const async_handler& asyncHandler,
38293837

38303838
_Effects:_ Constructs a [code]#queue# object using the device selected by
38313839
[code]#default_selector_v#.
3840+
The queue's platform is the platform that contains this device.
3841+
The queue's context is this platform's default context as described in
3842+
<<sec:platform-class>>.
38323843
The queue has the asynchronous error handler [code]#asyncHandler#.
38333844

38343845
'''
@@ -3848,6 +3859,9 @@ satisfies the requirements of a <<device-selector>> as defined in
38483859
_Effects:_ The [code]#deviceSelector# is called for every <<root-device>> as
38493860
described in <<sec:device-selector>>, and a [code]#queue# object is constructed
38503861
using the device it selects.
3862+
The queue's platform is the platform that contains this device.
3863+
The queue's context is this platform's default context as described in
3864+
<<sec:platform-class>>.
38513865

38523866
'''
38533867

@@ -3867,6 +3881,9 @@ satisfies the requirements of a <<device-selector>> as defined in
38673881
_Effects:_ The [code]#deviceSelector# is called for every <<root-device>> as
38683882
described in <<sec:device-selector>>, and a [code]#queue# object is constructed
38693883
using the device it selects.
3884+
The queue's platform is the platform that contains this device.
3885+
The queue's context is this platform's default context as described in
3886+
<<sec:platform-class>>.
38703887
The queue has the asynchronous error handler [code]#asyncHandler#.
38713888

38723889
'''
@@ -3879,6 +3896,9 @@ explicit queue(const device& syclDevice, const property_list& propList = {})
38793896

38803897
_Effects:_ Constructs a [code]#queue# object using the device
38813898
[code]#syclDevice#.
3899+
The queue's platform is the platform that contains this device.
3900+
The queue's context is this platform's default context as described in
3901+
<<sec:platform-class>>.
38823902

38833903
'''
38843904

@@ -3891,6 +3911,9 @@ explicit queue(const device& syclDevice, const async_handler& asyncHandler,
38913911

38923912
_Effects:_ Constructs a [code]#queue# object using the device
38933913
[code]#syclDevice#.
3914+
The queue's platform is the platform that contains this device.
3915+
The queue's context is this platform's default context as described in
3916+
<<sec:platform-class>>.
38943917
The queue has the asynchronous error handler [code]#asyncHandler#.
38953918

38963919
'''
@@ -3910,7 +3933,8 @@ satisfies the requirements of a <<device-selector>> as defined in
39103933
_Effects:_ The [code]#deviceSelector# is called for every <<root-device>> as
39113934
described in <<sec:device-selector>>, and a [code]#queue# object is constructed
39123935
using the device it selects.
3913-
The queue has the context [code]#syclContext#.
3936+
The queue's platform is the platform that contains this device.
3937+
The queue's context is [code]#syclContext#.
39143938

39153939
_Throws:_ An [code]#exception# with the [code]#errc::invalid# error code if
39163940
[code]#syclContext# does not contain the device selected by
@@ -3934,8 +3958,9 @@ satisfies the requirements of a <<device-selector>> as defined in
39343958
_Effects:_ The [code]#deviceSelector# is called for every <<root-device>> as
39353959
described in <<sec:device-selector>>, and a [code]#queue# object is constructed
39363960
using the device it selects.
3937-
The queue has the context [code]#syclContext# and the asynchronous error handler
3938-
[code]#asyncHandler#.
3961+
The queue's platform is the platform that contains this device.
3962+
The queue's context is [code]#syclContext#.
3963+
The queue has the asynchronous error handler [code]#asyncHandler#.
39393964

39403965
_Throws:_ An [code]#exception# with the [code]#errc::invalid# error code if
39413966
[code]#syclContext# does not contain the device selected by
@@ -3950,8 +3975,10 @@ explicit queue(const context& syclContext, const device& syclDevice,
39503975
const property_list& propList = {})
39513976
----
39523977

3953-
_Effects:_ Constructs a [code]#queue# object using the device [code]#syclDevice#
3954-
and the context [code]#syclContext#.
3978+
_Effects:_ Constructs a [code]#queue# object using the device
3979+
[code]#syclDevice#.
3980+
The queue's platform is the platform that contains this device.
3981+
The queue's context is [code]#syclContext#.
39553982

39563983
_Throws:_ An [code]#exception# with the [code]#errc::invalid# error code unless
39573984
[code]#syclDevice# is contained by [code]#syclContext# or is a
@@ -3967,8 +3994,10 @@ explicit queue(const context& syclContext, const device& syclDevice,
39673994
const property_list& propList = {})
39683995
----
39693996

3970-
_Effects:_ Constructs a [code]#queue# object using the device [code]#syclDevice#
3971-
and the context [code]#syclContext#.
3997+
_Effects:_ Constructs a [code]#queue# object using the device
3998+
[code]#syclDevice#.
3999+
The queue's platform is the platform that contains this device.
4000+
The queue's context is [code]#syclContext#.
39724001
The queue has the asynchronous error handler [code]#asyncHandler#.
39734002

39744003
_Throws:_ An [code]#exception# with the [code]#errc::invalid# error code unless

0 commit comments

Comments
 (0)