MarkStamp

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

x

Atlas A2 training product/Atlas A2 inference product

x

Atlas 200I/500 A2 inference product

x

Atlas inference product AI Core

x

Atlas inference product Vector Core

x

Atlas training product

x

Function Usage

You are advised to use the asc_mark_stamp API to mark a specific position. This API is applicable to both C and C++ programming.

Marks a specific position during operator execution by calling this API, facilitating subsequent analysis of code execution paths and performance hotspots through the pipeline chart.

Prototype

template<pipe_t pipe, uint16_t index>
__aicore__ inline void MarkStamp()

template<pipe_t pipe>
__aicore__ inline void MarkStamp(uint16_t index)

Parameters

Parameter

Description

pipe

Type of the pipeline where the stamp is located.

index

Unique ID of the stamp set by the user.

Returns

None

Restrictions

  • The chip reserves 12 bits for the index. The value range is [0, 4095]. To easily find the corresponding code in the stamping diagram, you are advised not to use the same index repeatedly.
  • If a MarkStamp instruction is added to a loop, a stamp is output each time the instruction is executed, and the index is the same.
  • If developers add stamps to two adjacent VFs, MarkStamp1 and MarkStamp2 will be optimized and no stamp will be output because the compiler may fuse VF A and VF B.

Example

mte2_opt();
mte1_opt();
// Stamping at the beginning of operator execution.
MarkStamp<CUBE, 0>();
// Performing core computation.
cube_opt();
// Stamping at the end of operator execution.
MarkStamp<CUBE, 1>();
mte3_opt();