PrintTimeStamp

Supported Products

Product

Supported/Unsupported

Atlas A3 training products / Atlas A3 inference products

Atlas A2 training products / Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference product 's AI Core

x

Atlas inference product 's Vector Core

x

Atlas training products

x

Functions

Provides the timestamp logging function to mark key execution points in the operator kernel code. After the function is called, the following information is displayed:

  • descId: user-defined identifier, which is used to distinguish different logging positions.
  • rsv: reserved value. The default value is 0. You do not need to focus on it.
  • timeStamp: number of cycles in the current system, which is used to compute the time difference. For details about the time conversion rule, see GetSystemCycle(ISASI).
  • pcPtr: PC pointer value. You do not need to focus on it unless otherwise specified.
  • entry: reserved field. You can ignore it.

The following is an example:

1
descId is 65577, rsv is 0, timeStamp is 13806084506158, pcPtr is 20619064414544, entry is 0.

This function is mainly used for debugging and performance analysis. Enabling this function will affect the operator performance. You are advised to disable this function in the production environment.

By default, this function is disabled. You can enable the dotting function by adding the compilation option -DASCENDC_TIME_STAMP_ON as required.

Prototype

1
__aicore__ inline void PrintTimeStamp(uint32_t descId)

Parameters

Parameter

Input/Output

Description

descId

Input

User-defined identifier (customized number), which is used to distinguish different logging positions.

CAUTION:

[0, 0xffff] is reserved for internal Ascend C modules. You are advised to set descId to a value greater than 0xffff.

Returns

None

Restrictions

  • This function is used only for debugging on the NPU board.
  • Currently, printing in the operator graph input scenario is not supported.
  • The total amount of data printed when this API is called at a time cannot exceed 1 MB (including a small amount of header and tail information required by the framework, which can be ignored). Note that if the limit is exceeded, the data will not be printed. When a custom operator project is used for operator development, the total amount of data dumped by all dump APIs of an operator on each core cannot exceed 1 MB. You need to control the amount of data to be printed. If the limit is exceeded, no content will be printed.

Examples

1
AscendC::PrintTimeStamp(65577);

The printed result is as follows (the dump information header is printed only when the custom operator project is used):

1
2
3
opType=AddCustom, DumpHead: AIV-0, CoreType=AIV, block dim=8, total_block_num=8, block_remain_len=1047136, block_initial_space=1048576, rsv=0, magic=5aa5bccd
...// Some logging information in the framework
descId is 65577, rsv is 0, timeStamp is 13806084506158, pcPtr is 20619064414544, entry is 0.