Skip to content

Commit

Permalink
Fix prvalue to xvalue conversion address space assignment
Browse files Browse the repository at this point in the history
The common address deduction rules assumed prvalue-to-xvalue conversion
can only happens inside a function.
The patch aligns the rules to match declaration rules.
  • Loading branch information
Naghasan committed Nov 30, 2023
1 parent bc7420b commit 9d8e159
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions adoc/chapters/device_compiler.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -737,8 +737,8 @@ The variable declarations get assigned to an address space depending on their
scope and storage class:

* Namespace scope
** If the type is [code]#const#, the address space the declaration is assigned
to is implementation-defined.
** If the type is [code]#const#, the address space of the declaration is
assigned to is implementation-defined.
If the target of the SYCL backend can represent the generic address space,
then the assigned address space must be compatible with the generic address
space.
Expand All @@ -761,9 +761,11 @@ device kernel or code called by the device kernel.
** Static data members are treated the same way as for variable in namespace
scope

The result of a prvalue-to-xvalue conversion is assigned to the local address
space if it happens in a hierarchical context or to the private address space
otherwise.
If a prvalue-to-xvalue conversion happens in a block scope or function parameter
scope, the result is assigned to the local address space if it happens a
hierarchical context otherwise it is assigned to the private address space.
It the prvalue-to-xvalue conversion happens in another scope, the result is
assigned in the same way as declaration in namespace scope.


[[subsec:genericAddressSpace]]
Expand Down

0 comments on commit 9d8e159

Please sign in to comment.