OpenCL™ C 6.15.17. 工作组共有统一算术函数

6.15.17. Work-group Collective Uniform Arithmetic Functions
6.15.17. 工作组共有统一算术函数

The functionality described in this section requires support for OpenCL C 2.0 and the cl_khr_work_group_uniform_arithmetic extension macro.

​本节中描述的功能需要支持OpenCL C 2.0和cl_khr_work_group_uniform_arithmetic扩展宏。

The Built-in Work-group Logical Arithmetic Functions table describes the OpenCL C programming language built-in functions that perform logical arithmetic operations across work items in a work-group. These functions must be encountered by all work items in a work-group executing the kernel, otherwise the behavior is undefined. For these functions, a non-zero predicate argument or return value is logically true and a zero predicate argument or return value is logically false.

​内置工作组逻辑算术函数表描述了OpenCL C编程语言的内置函数,这些函数在工作组中的工作项之间执行逻辑算术运算。执行内核的工作组中的所有工作项都必须遇到这些函数,否则行为未定义。对于这些函数,非零的predicate参数或返回值在逻辑上为真,而零的predicate变量或返回值则为假。

Table 38. Built-in Work-group Logical Arithmetic Functions

表38 内置工作组逻辑算术函数

Function

函数

Description

描述

int work_group_reduce_logical_and(
  int predicate);
int work_group_reduce_logical_or(
  int predicate);
int work_group_reduce_logical_xor(
  int predicate);

Returns the logical andor, or xor of predicate for all work items in the work-group.

返回工作组中所有工作项的谓词的逻辑和、或、异或。

int work_group_scan_inclusive_logical_and(
  int predicate);
int work_group_scan_inclusive_logical_or(
  int predicate);
int work_group_scan_inclusive_logical_xor(
  int predicate);

Returns the result of an inclusive scan operation, which is the logical andor, or xor of predicate for all work items in the work-group with a work-group linear local ID less than or equal to this work item’s work-group linear local ID.

返回包容性扫描操作的结果,该结果是工作组线性本地ID小于或等于此工作项的工作组线性局部ID的工作组中所有工作项的谓词的逻辑和、或或异或。

int work_group_scan_exclusive_logical_and(
  int predicate);
int work_group_scan_exclusive_logical_or(
  int predicate);
int work_group_scan_exclusive_logical_xor(
  int predicate);

Returns the result of an exclusive scan operation, which is the logical andor, or xor of predicate for all work items in the work-group with a work-group linear local ID less than this work item’s work-group linear local ID.

返回独占扫描操作的结果,该结果是工作组中所有工作项的predicate的逻辑和、或或异或,工作组线性本地ID小于此工作项的工作组线性局部ID。

If there is no work item in the work-group with a work-group linear local ID less than this work item’s work-group linear local ID then an identity value I is returned. For and, the identity value is true (non-zero). For or and xor, the identity value is false (zero).

如果工作组中没有工作组线性本地ID小于此工作项的线性本地ID的工作项,则返回标识值I。对于and,标识值为真(非零)。对于or和xor,标识值为false(零)。

The Built-in Work-group Bitwise Integer Functions table describes the OpenCL C programming language built-in functions that perform bitwise integer operations across work items in a work-group. These functions must be encountered by all work items in a work-group executing the kernel, otherwise the behavior is undefined. For the functions below, the generic type name gentype may be one of the supported built-in scalar data types intuintlong, and ulong.

​内置工作组逐位整数函数表描述了OpenCL C编程语言的内置函数,这些函数在工作组中的工作项之间执行逐位整数运算。执行内核的工作组中的所有工作项都必须遇到这些函数,否则行为未定义。对于下面的函数,泛型类型名称gentype可能是支持的内置标量数据类型之一,如int、uint、long和ulong。

Table 39. Built-in Work-group Bitwise Integer Functions

表39 内置工作组位整数函数

Function

函数

Description

描述

gentype work_group_reduce_and(
  gentype value);
gentype work_group_reduce_or(
  gentype value);
gentype work_group_reduce_xor(
  gentype value);

Returns the bitwise andor, or xor of value for all work items in the work-group.

返回工作组中所有工作项的按位和、或、异或值。

gentype work_group_scan_inclusive_and(
  gentype value);
gentype work_group_scan_inclusive_or(
  gentype value);
gentype work_group_scan_inclusive_xor(
  gentype value);

Returns the result of an inclusive scan operation, which is the bitwise andor, or xor of value for all work items in the work-group with a work-group linear local ID less than or equal to this work item’s work-group linear local ID.

返回包容性扫描操作的结果,即工作组线性本地ID小于或等于此工作项的工作组线性局部ID的工作组中所有工作项的按位和、或、异或值。

gentype work_group_scan_exclusive_and(
  gentype value);
gentype work_group_scan_exclusive_or(
  gentype value);
gentype work_group_scan_exclusive_xor(
  gentype value);

Returns the result of an exclusive scan operation, which is the bitwise andor, or xor of value for all work items in the work-group with a work-group linear local ID less than this work item’s work-group linear local ID.

返回独占扫描操作的结果,即工作组线性本地ID小于此工作项的工作组线性局部ID的工作组中所有工作项的按位和、或、异或值。

If there is no work item in the work-group with a work-group linear local ID less than this work item’s work-group linear local ID then an identity value I is returned. For and, the identity value is ~0 (all bits set). For or and xor, the identity value is 0.

如果工作组中没有工作组线性本地ID小于此工作项的线性本地ID的工作项,则返回标识值I。对于and,标识值为~0(所有位都已设置)。对于or和xor,标识值为0。

The Built-in Work-group Multiplicative Functions table describes the OpenCL C programming language built-in functions that perform multiplicative operations across work items in a work-group. These functions must be encountered by all work items in a work-group executing the kernel, otherwise the behavior is undefined. For the functions below, the generic type name gentype may be one of the supported built-in scalar data types intuintlongulongfloatdouble (if double precision is supported), or half (if half precision is supported).

​内置工作组乘法函数表描述了OpenCL C编程语言的内置函数,这些函数在工作组中的工作项之间执行乘法操作。执行内核的工作组中的所有工作项都必须遇到这些函数,否则行为未定义。对于下面的函数,泛型类型名称gentype可以是支持的内置标量数据类型之一,如int、uint、long、ulong、float、double(如果支持双精度)或half(如果支持半精度)。

Table 40. Built-in Work-group Multiplicative Functions

表40 内置工作组乘法函数

Function

函数

Description

描述

gentype work_group_reduce_mul(
  gentype value);

Returns the multiplication of value for all work items in the work-group.

返回工作组中所有工作项的值的乘积。

gentype work_group_scan_inclusive_mul(
  gentype value);

Returns the result of an inclusive scan operation which is the multiplication of value for all work items in the work-group with a work-group linear local ID less than or equal to this work item’s work-group linear local ID.

返回包容性扫描操作的结果,该操作是将工作组中所有工作项的值与小于或等于此工作项的工作组线性本地ID相乘。

gentype work_group_scan_exclusive_mul(
  gentype value);

Returns the result of an exclusive scan operation which is the multiplication of value for all work items in the work-group with a work-group linear local ID less than this work item’s work-group linear local ID.

返回独占扫描操作的结果,该操作是工作组中所有工作项的值与小于此工作项的工作组线性本地ID的工作组的线性本地ID相乘。

If there is no work item in the work-group with a work-group linear local ID less than this work item’s work-group linear local ID then the identity value 1 is returned.

如果工作组中没有工作组线性本地ID小于此工作项的工作组线性局部ID的工作项,则返回标识值1。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值