LoadDataUnzip
产品支持情况
产品 |
是否支持 |
|---|---|
x |
|
x |
|
x |
|
√ |
|
x |
|
x |
功能说明
将GM上的数据解压并搬运到A1/B1/B2上。执行该API前需要执行LoadUnzipIndex加载压缩索引表。
函数原型
1 2 | template <typename T> __aicore__ inline void LoadDataUnzip(const LocalTensor<T>& dst, const GlobalTensor<T>& src) |
参数说明
参数名称 |
输入/输出 |
含义 |
|---|---|---|
dst |
输出 |
目的操作数,类型为LocalTensor,支持的TPosition为A1/B1/B2。 LocalTensor的起始地址需要保证:TPosition为A1/B1时,32字节对齐;TPosition为B2时,512B对齐。 支持的数据类型为:int8_t。 |
src |
输入 |
源操作数,类型为GlobalTensor。数据类型需要与dst保持一致。 |
约束说明
- 操作数地址对齐要求请参见通用地址对齐约束。
返回值说明
无
调用示例
该调用示例支持的运行平台为
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | AscendC::TPipe pipe; AscendC::TQue<AscendC::TPosition::B1, 1> inQueueB1; AscendC::TQue<AscendC::TPosition::VECOUT, 1> outQueueUB; AscendC::GlobalTensor<int8_t> weGlobal; AscendC::GlobalTensor<int8_t> dstGlobal; AscendC::GlobalTensor<int8_t> indexGlobal; pipe.InitBuffer(inQueueB1, 1, dstLen * sizeof(int8_t)); pipe.InitBuffer(outQueueUB, 1, dstLen * sizeof(int8_t)); uint32_t srcLen = 896, dstLen = 1024, numOfIndexTabEntry = 1; AscendC::LocalTensor<int8_t> weightB1 = inQueueB1.AllocTensor<int8_t>(); AscendC::LoadUnzipIndex(indexGlobal, numOfIndexTabEntry); AscendC::LoadDataUnzip(weightB1, weGlobal); inQueueB1.EnQue(weightB1); inQueueB1.FreeTensor(weightB1); |
父主题: 数据搬运