Binding
The binding task set for a targetdata region is the generating task. The targetdata region binds
to the region of the generating task.
Description
When a targetdata construct is encountered, the encountering task executes the region. If no device
clause is present, the behavior is as if the device clause appeared with an expression equal to the value of
the default-device-var ICV. When an if clause is present and the if clause expression evaluates to false,
the target device is the host. Variables are mapped for the extent of the region, according to any
data-mapping attribute clauses, from the data environment of the encountering task to the device data
environment.
If a list item that appears in a use_device_addr clause has corresponding storage in the device data
environment, references to the list item in the associated structured block are converted into references to
the corresponding list item. If the list item is not a mapped list item, it is assumed to be accessible on the
target device. Inside the structured block, the list item has a device address and its storage may not be
accessible from the host device. The list items that appear in a use_device_addr clause may include
array sections.
If a list item in a use_device_addr clause is an array section that has a base pointer, the effect of
the clause is to convert the base pointer to a pointer that is local to the structured block and
that contains the device address. This conversion may be elided if the list item was not already
mapped.
If a list item that appears in a use_device_ptr clause is a pointer to an object that is mapped to the
device data environment, references to the list item in the associated structured block are converted into
references to a device pointer that is local to the structured block and that refers to the device address of the
corresponding object. If the list item does not point to a mapped object, it must contain a valid device
address for the target device, and the list item references are instead converted to references to a local device
pointer that refers to this device address.
If a list item that appears in a use_device_ptr clause is of type C_PTR and points to a data entity that
is mapped to the device data environment, references to the list item in the associated structured block are
converted into references to a device pointer that is local to the structured block and that refers to the
device address of the corresponding entity. If a list item of type C_PTR does not point to a
mapped object, it must contain a valid device address for the target device, and the list item
references are instead converted to references to a local device pointer that refers to this device
address.
If a list item in a use_device_ptr clause is not of type C_PTR, the behavior is as if the list item
appeared in a use_device_addr clause. Support for such list items in a use_device_ptr clause is
deprecated.
If one or more map clauses are present, the list item conversions that are performed for any
use_device_ptr or use_device_addr clause occur after all variables are mapped on entry to the
region according to those map clauses.
Execution Model Events
The events associated with entering a targetdata region are the same events as associated with a
targetenterdata construct, as described in Section 2.14.3.
The events associated with exiting a targetdata region are the same events as associated with a
targetexitdata construct, as described in Section 2.14.4.
Tool Callbacks
The tool callbacks dispatched when entering a targetdata region are the same as the tool
callbacks dispatched when encountering a targetenterdata construct, as described in
Section 2.14.3.
The tool callbacks dispatched when exiting a targetdata region are the same as the tool
callbacks dispatched when encountering a targetexitdata construct, as described in
Section 2.14.4.
Restrictions
Restrictions to the targetdata construct are as follows:
A
program
must
not
depend
on
any
ordering
of
the
evaluations
of
the
clauses
of
the
targetdata
directive,
except
as
explicitly
stated
for
map
clauses
and
for
map
clauses
relative
to
use_device_ptr
and
use_device_addr
clauses,
or
on
any
side
effects
of
the
evaluations
of
the
clauses.
At
most
one
device
clause
can
appear
on
the
directive.
The
device
clause
expression
must
evaluate
to
a
non-negative
integer
value
that
is
less
than
or
equal
to
the
value
of
omp_get_num_devices().
At
most
one
if
clause
can
appear
on
the
directive.
A
map-type
in
a
map
clause
must
be
to,
from,
tofrom
or
alloc.
At
least
one
map,
use_device_addr
or
use_device_ptr
clause
must
appear
on
the
directive.
A
list
item
may
not
be
specified
more
than
once
in
use_device_ptr
clauses
that
appear
on
the
directive.
A
list
item
may
not
be
specified
more
than
once
in
use_device_addr
clauses
that
appear
on
the
directive.
A
list
item
may
not
be
specified
in
both
a
use_device_addr
clause
and
a
use_device_ptr
clause
on
the
directive.
A
list
item
in
a
use_device_addr
clause
must
have
a
corresponding
list
item
in
the
device
data
environment
or
be
accessible
on
the
target
device.
A
list
item
that
appears
in
a
use_device_ptr
or
use_device_addr
clause
must
not
be
a
structure
element.
∙ A list item in a use_device_ptr clause must be a pointer for which the value is the address of an
object that has corresponding storage in the device data environment or is accessible on the target
device.
∙ If a list item in a use_device_addr clause is an array section, the base expression must be a base
language identifier.
∙ The value of a list item in a use_device_ptr clause that is of type C_PTR must be the address of a
data entity that has corresponding storage in the device data environment or is accessible on the target
device.
∙ If a list item in a use_device_addr clause is an array section, the designator of the base expression
must be a name without any selectors.