GpuLaneBroadcast¶
The value an expression has in the first lane of the iteration.
Declaration¶
Syntax¶
GpuLaneBroadcast(expr arg, ttype type, expr? value)
Arguments¶
Argument |
Description |
|---|---|
|
an integer, real or logical scalar. |
|
the type of |
|
always |
Return values¶
The value arg has in lane zero of the running thread's iteration.
Description¶
In a kernel whose layout has lanes (see
gpu_kernel_layout), a statement
that must not be repeated by every lane of an iteration -- it writes memory
the lanes share, or takes elements of the device heap -- runs on the first
lane only. Each lane holds its own copy of a scalar local, so after the
statement every lane takes the scalars it assigned from the first one:
x = GpuLaneBroadcast(x). Every lane of the iteration evaluates it at the
same point. Only such a kernel has one.
Examples¶
(GpuLaneBroadcast
(Var 2 x)
(Integer
:kind 4
)
()
)
See Also¶
GpuLaneIndex, GpuLaneBroadcast, GpuLaneBarrier, gpu_kernel_layout