GetValue

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product AI Core

Atlas inference product Vector Core

Atlas training product

Function Usage

Obtains the value of the corresponding offset position of the GlobalTensor.

Prototype

1
__aicore__ inline __inout_pipe__(S) PrimType GetValue(const uint64_t offset) const

Parameters

Table 1 Parameters

Parameter

Input/Output

Description

offset

Input

Number of elements to offset.

Returns

Returns an immediate of the PrimType type.

Restrictions

If the content at the global memory address obtained by GetValue may be overwritten externally, call DataCacheCleanAndInvalid first to ensure cache coherence between the data cache and global memory, and then call this API.

Examples

1
2
3
4
5
6
7
8
// Data (GlobalTensor): [0 100 200 ...]

AscendC::GlobalTensor<uint32_t> tiling_global;
tiling_global.SetGlobalBuffer(reinterpret_cast<__gm__ uint32_t *>(tiling), 16);
const uint16_t C1 = (uint16_t)tiling_global.GetValue(0);
const uint16_t H = (uint16_t)tiling_global(1);  
// The result is as follows:
// C1 = 0, H = 100