GpuLaneBroadcast¶
The value an expression has in the first lane of the iteration.
声明¶
语法¶
GpuLaneBroadcast(expr arg, ttype type, expr? value)
参数¶
Argument |
描述 |
|---|---|
|
an integer, real or logical scalar. |
|
the type of |
|
always |
返回值¶
The value arg has in lane zero of the running thread’s iteration.
描述¶
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.
示例¶
(GpuLaneBroadcast
(Var 2 x)
(Integer
:kind 4
)
()
)
也可以看看¶
GpuLaneIndex, GpuLaneBroadcast, GpuLaneBarrier, gpu_kernel_layout