OpenCL C 6.15.21. 内核时钟函数

6.15.21. Kernel Clock Functions

6.15.21. 内核时钟函数

 

The functionality described in this section requires support for the cl_khr_kernel_clock extension.

 

​本节中描述的功能需要支持cl_khr_kernel_clock扩展。


The clock_read_device and clock_read_hilo_device functions require support for the __opencl_c_kernel_clock_scope_device feature. The clock_read_work_group and clock_read_hilo_work_group functions require support for the __opencl_c_kernel_clock_scope_work_group feature. The clock_read_sub_group and clock_read_hilo_sub_group functions require support for the __opencl_c_kernel_clock_scope_sub_group feature.

 

clock_read_device和clock_read_hilo_device函数需要支持__opencl_c_kernel_clock_scope_device功能。clock_read_work_group和clock_read_hilo_work_goup函数需要支持__opencl_c_kernel_clock_scope_work_group功能。clock_read_sub_group和clock_read_hilo_sub_group函数需要支持__opencl_c_kernel_clock_scope_sub_group功能。

This section describes OpenCL C built-in functions that sample the value from one of three clocks provided by compute units.

本节介绍OpenCL C内置函数,这些函数从计算单元提供的三个时钟之一中采样值。

Table 64. Built-in Kernel Clock Functions

表64 内置内核时钟函数

Function

函数

Description

描述

ulong clock_read_device();
ulong clock_read_work_group();
ulong clock_read_sub_group();

Returns a sampled value of a clock as seen by the compute unit.

 

返回计算单元看到的时钟采样值。

 

An idealized clock is an unbounded unsigned scalar integer tick count increasing monotonically over time. A clock’s rate of progress may vary within the lifetime of a work-item, may vary across different executions of the program, and may be affected by conditions beyond the control of the programmer. The sampled value read by this function consists of the least significant bits of the idealized clock’s tick count at the time the instruction was executed. In particular, an observer may see sampled values wrap around zero.

 

理想化的时钟是一个无界的无符号标量整数滴答数,随时间单调递增。时钟的进度可能在工作项的生命周期内有所不同,可能在程序的不同执行过程中有所不同,并可能受到程序员无法控制的条件的影响。此函数读取的采样值由执行指令时理想时钟滴答数的最低有效位组成。特别是,观察者可能会看到采样值围绕零。

uint2 clock_read_hilo_device();
uint2 clock_read_hilo_work_group();
uint2 clock_read_hilo_sub_group();

Performs the same operation as clock_read, but returns the value as a uint2 whose .lo component contains the 32 least significant bits of the result and .hi component contains the 32 most significant bits of the result.

 

执行与clock_read相同的操作,但返回值为uint2,其.lo分量包含结果的32个最低有效位,.hi分量包含结果中的32个最高有效位。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值