CheckLocalMemoryIA(ISASI)
产品支持情况
产品 |
是否支持 |
|---|---|
√ |
|
√ |
|
√ |
|
√ |
|
x |
|
x |
功能说明
check设定范围内的UB读写行为,如果有设定范围的读写行为则会出现EXCEPTION报错,无设定范围的读写行为则不会报错。
函数原型
1 | __aicore__ inline void CheckLocalMemoryIA(const CheckLocalMemoryIAParam& checkParams) |
参数说明
参数名称 |
输入/输出 |
含义 |
|---|---|---|
checkParams |
输入 |
用于配置对UB访问的检查行为,类型为CheckLocalMemoryIAParam。 具体定义请参考${INSTALL_DIR}/include/ascendc/basic_api/interface/kernel_struct_mm.h,${INSTALL_DIR}请替换为CANN软件安装后文件存储路径。 参数说明请参考表2。 |
参数名称 |
含义 |
|---|---|
enableBit |
配置的异常寄存器,取值范围:enableBit∈[0,3],默认为0。
|
startAddr |
Check的起始地址,32B对齐,取值范围:startAddr∈[0, 65535],默认值为0。比如,可通过LocalTensor.GetPhyAddr()/32来获取startAddr。 |
endAddr |
Check的结束地址,32B对齐,取值范围:endAddr∈[0, 65535] 。默认值为0。 |
isScalarRead |
Check标量读访问。
|
isScalarWrite |
Check标量写访问。
|
isVectorRead |
Check矢量读访问。
|
isVectorWrite |
Check矢量写访问。
|
isMteRead |
Check Mte读访问。
|
isMteWrite |
Check Mte写访问。
|
isEnable |
是否使能enableBit参数配置的异常寄存器。
|
reserved |
预留参数。为后续的功能做保留,开发者暂时无需关注,使用默认值即可。 |
约束说明
- startAddr/endAddr的单位是32B,check的范围不包含startAddr,包含endAddr,即(startAddr,endAddr]。
- 每次调用完该接口需要进行复位(配置isEnable为false进行复位);
- 操作数地址对齐要求请参见通用地址对齐约束。
调用示例
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 }); |