CheckLocalMemoryIA(ISASI)
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
x |
√ |
|
√ |
|
√ |
|
√ |
|
x |
|
x |
Function Usage
Checks the UB read and write operations within the specified range. If the UB read and write operations are within the specified range, an EXCEPTION error is reported. If the UB read and write operations are not within the specified range, no error is reported.
Prototype
1 | __aicore__ inline void CheckLocalMemoryIA(const CheckLocalMemoryIAParam& checkParams) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
checkParams |
Input |
UB access check configuration. The parameter type is CheckLocalMemoryIAParam. For details, see ${INSTALL_DIR}/include/ascendc/basic_api/interface/kernel_struct_mm.h. Replace ${INSTALL_DIR} with the CANN installation path. For details about the parameter description, see Table 2. |
Parameter |
Description |
|---|---|
enableBit |
Configures the exception register. enableBit ∈ [0,3]. The default value is 0.
|
startAddr |
Start address of CheckLocalMemoryIAParam, 32-byte aligned. Value range: startAddr ∈ [0, 65535]. The default value is 0. For example, startAddr may be obtained by using LocalTensor.GetPhyAddr()/32. |
endAddr |
End address of CheckLocalMemoryIAParam, 32-byte aligned. Value range: endAddr ∈ [0, 65535]. The default value is 0. |
isScalarRead |
Checks scalar read access.
|
isScalarWrite |
Checks scalar write access.
|
isVectorRead |
Checks vector read access.
|
isVectorWrite |
Checks vector write access.
|
isMteRead |
Checks Mte read access.
|
isMteWrite |
Checks Mte write access.
|
isEnable |
Enables or disables the exception register configured by the enableBit parameter.
|
reserved |
Reserved parameter. This parameter is reserved for future functions. Developers can use the default value. |
Restrictions
- The unit of startAddr/endAddr is 32 bytes. The check range does not contain startAddr but contains endAddr, that is, (startAddr, endAddr].
- This API needs to be reset each time it is called (by setting isEnable to false).
- For details about the operand address alignment requirements, see General Address Alignment Restrictions.
Example
1 2 3 4 5 6 7 8 9 10 11 | AscendC::TPipe pipe; AscendC::TQue<AscendC::TPosition::VECIN, 1> inQueueSrc0, inQueueSrc1; AscendC::TQue<AscendC::TPosition::VECOUT, 1> outQueueDst pipe.InitBuffer(inQueueSrc0, 1, 512 * sizeof(half)); pipe.InitBuffer(inQueueSrc1, 1, 512 * sizeof(half)); pipe.InitBuffer(outQueueDst, 1, 512 * sizeof(half)); AscendC::LocalTensor<half> src0Local = inQueueSrc0.DeQue<half>(); AscendC::LocalTensor<half> src1Local = inQueueSrc1.DeQue<half>(); AscendC::LocalTensor<half> dstLocal = outQueueDst.AllocTensor<half>(); AscendC::CheckLocalMemoryIA({ 0, (uint32_t)(dstLocal.GetPhyAddr() / 32),(uint32_t)((dstLocal.GetPhyAddr() + 512 * sizeof(half)) / 32), false, false, false, true, false, false, true }); |