LoadUnzipIndex

Supported Products

Product

Supported (√/x)

Atlas A3 training products/Atlas A3 inference products

x

Atlas A2 training products/Atlas A2 inference products

x

Atlas 200I/500 A2 inference products

x

Atlas inference product's AI Core

Atlas inference product's Vector Core

x

Atlas training products

x

Function Usage

Loads the compression index table on GM to internal registers.

The index table is LoadDataUnzip compression information (such as compression length) to obtain compressed data.

The index table is generated offline by the compression tool based on the corresponding weight data. One LoadUnzipIndex instruction can load multiple index tables, but each LoadDataUnzip instruction can consume only one index table. Therefore, the order of index tables should be determined by the user to ensure their correspondence to the compressed data.

Prototype

1
2
template <typename T = int8_t, typename Std::enable_if<Std::is_same<PrimT<T>, int8_t>::value, bool>::type = true> 
__aicore__ inline void LoadUnzipIndex(const GlobalTensor<T>& src, uint32_t numOfIndexTabEntry)

Parameters

Table 1 Parameters in the template

Parameter

Description

T

Data type of the source operand.

  • When srcTensor uses the basic data type, its data type must be uint8_t. Otherwise, the compilation fails.
  • When the TensorTrait type is used as the source operand, the LiteType of the source operand data type T must be int8_t. Otherwise, the compilation fails.

The last template parameter is used only for checking the preceding data types.

Table 2 Parameters

Parameter

Input/Output

Meaning

src

Input

Source operand, index table address. The type is GlobalTensor.

The src address must be 2-byte aligned. The src length must be an integer multiple of 512 bytes and cannot exceed 32 KB.

numOfIndexTabEntry

Input

Input data, indicating the number of loaded index tables. The number of index tables must be greater than 0.

Returns

None

Restrictions

  • For details about the operand address alignment requirements, see General Address Alignment Restrictions.
  • LoadUnzipIndex must be executed before any LoadDataUnzip instruction.
  • The number of index tables loaded by LoadUnzipIndex must be greater than or equal to the number of times that the LoadDataUnzip instruction is executed.

Example

The calling example supports the Atlas inference product's AI Core platform. For details, see LoadDataUnzip.

1
2
indexGlobal.SetGlobalBuffer((__gm__ int8_t*)indexGm);
AscendC::LoadUnzipIndex(indexGlobal, numOfIndexTabEntry);