Merged
TensorAPI资料修改 #5134
ca1kwAdd on Aug 17
TensorAPI资料修改 #5134
Merged
Merged fromca1kw/asc-devkitdoc_masterintocann/asc-devkitmaster
Total: 135 files changed+6419-2981
| @@ -58,7 +58,7 @@ repos: | |||
| 58 | - id: codespell | 58 | - id: codespell |
| 59 | args: [ | 59 | args: [ |
| 60 | "-L", | 60 | "-L", |
| 61 | - "CANN,cann,NNAL,nnal,ASCEND,ascend,EnQue,CopyIn,ArchType,AND,ND,tbe,copyin,alog,Collet,Enque,Normale,OUTTER,OffsetT,REGIST,Te,ThirdParty,VOR,abl,ans,catched,commiter,devlop,dout,enque,ges,nIn,nd,outter,padd,parm,subtile", | 61 | + "CANN,cann,NNAL,nnal,ASCEND,ascend,EnQue,CopyIn,ArchType,AND,ND,tbe,copyin,alog,Collet,Enque,Normale,OUTTER,OffsetT,REGIST,Te,ThirdParty,VOR,abl,ans,catched,commiter,devlop,dout,enque,ges,nIn,nd,outter,padd,parm,subtile,te", |
| 62 | "--skip", | 62 | "--skip", |
| 63 | "*.py,*.cpp,*.hpp,*.c,*.h,*.asc,*.cc", | 63 | "*.py,*.cpp,*.hpp,*.c,*.h,*.asc,*.cc", |
| 64 | ] | 64 | ] |
| @@ -44,40 +44,6 @@ | |||
| 44 | - [GetShapeInfo](SIMD-API/basic_api/data_structures/GlobalTensor/GetShapeInfo.md) | 44 | - [GetShapeInfo](SIMD-API/basic_api/data_structures/GlobalTensor/GetShapeInfo.md) |
| 45 | - [SetL2CacheHint](SIMD-API/basic_api/data_structures/GlobalTensor/SetL2CacheHint.md) | 45 | - [SetL2CacheHint](SIMD-API/basic_api/data_structures/GlobalTensor/SetL2CacheHint.md) |
| 46 | - [ReinterpretCast](SIMD-API/basic_api/data_structures/GlobalTensor/ReinterpretCast.md) | 46 | - [ReinterpretCast](SIMD-API/basic_api/data_structures/GlobalTensor/ReinterpretCast.md) |
| 47 | - | ||
| 48 | - - [数据结构(TensorAPI,试验特性)](SIMD-API/basic_api/data_structure_TensorAPI/data_structure_TensorAPI.md) | ||
| 49 | - - [Layout数据结构](SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/layout_structure.md) | ||
| 50 | - - [Capacity](SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Capacity.md) | ||
| 51 | - - [Coord](SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Coord.md) | ||
| 52 | - - [Coshape](SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Coshape.md) | ||
| 53 | - - [Cosize](SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Cosize.md) | ||
| 54 | - - [Get](SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Get.md) | ||
| 55 | - - [GetShape](SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/GetShape.md) | ||
| 56 | - - [GetStride](SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/GetStride.md) | ||
| 57 | - - [Layout](SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Layout.md) | ||
| 58 | - - [Layout和层次化表述法](SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Layout_hierarchical_representation.md) | ||
| 59 | - - [MakeCoord](SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/MakeCoord.md) | ||
| 60 | - - [MakeFrameLayout](SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/MakeFrameLayout.md) | ||
| 61 | - - [MakeLayout](SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/MakeLayout.md) | ||
| 62 | - - [MakePatternLayout](SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/MakePatternLayout.md) | ||
| 63 | - - [MakeShape](SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/MakeShape.md) | ||
| 64 | - - [MakeStride](SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/MakeStride.md) | ||
| 65 | - - [Rank](SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Rank.md) | ||
| 66 | - - [Select](SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Select.md) | ||
| 67 | - - [Squeeze](SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Squeeze.md) | ||
| 68 | - - [Shape](SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Shape.md) | ||
| 69 | - - [Size](SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Size.md) | ||
| 70 | - - [Stride](SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Stride.md) | ||
| 71 | - - [Tensor数据结构](SIMD-API/basic_api/data_structure_TensorAPI/tensor_structure/tensor_structure.md) | ||
| 72 | - - [MakeMemPtr](SIMD-API/basic_api/data_structure_TensorAPI/tensor_structure/MakeMemPtr.md) | ||
| 73 | - - [MakeTensor](SIMD-API/basic_api/data_structure_TensorAPI/tensor_structure/MakeTensor.md) | ||
| 74 | - - [Pointer](SIMD-API/basic_api/data_structure_TensorAPI/tensor_structure/Pointer.md) | ||
| 75 | - - [Slice](SIMD-API/basic_api/data_structure_TensorAPI/tensor_structure/Slice.md) | ||
| 76 | - - [Tensor](SIMD-API/basic_api/data_structure_TensorAPI/tensor_structure/Tensor.md) | ||
| 77 | - - [ViewEngine](SIMD-API/basic_api/data_structure_TensorAPI/tensor_structure/ViewEngine.md) | ||
| 78 | - - [工具函数](SIMD-API/basic_api/data_structure_TensorAPI/utils/tool_functions.md) | ||
| 79 | - - [GetLayoutPattern](SIMD-API/basic_api/data_structure_TensorAPI/utils/GetLayoutPattern.md) | ||
| 80 | - | ||
| 81 | - [辅助数据结构](SIMD-API/basic_api/aux_data_structures/aux_data_structures.md) | 47 | - [辅助数据结构](SIMD-API/basic_api/aux_data_structures/aux_data_structures.md) |
| 82 | - [Coordinate](SIMD-API/basic_api/aux_data_structures/Coordinate/Coordinate.md) | 48 | - [Coordinate](SIMD-API/basic_api/aux_data_structures/Coordinate/Coordinate.md) |
| 83 | - [Coordinate简介](SIMD-API/basic_api/aux_data_structures/Coordinate/Coordinate_intro.md) | 49 | - [Coordinate简介](SIMD-API/basic_api/aux_data_structures/Coordinate/Coordinate_intro.md) |
| @@ -246,36 +212,6 @@ | |||
| 246 | - [SetFixpipeNz2ndFlag](SIMD-API/basic_api/cube_compute_ISASI/cube_store_aux_config/SetFixpipeNz2ndFlag.md) | 212 | - [SetFixpipeNz2ndFlag](SIMD-API/basic_api/cube_compute_ISASI/cube_store_aux_config/SetFixpipeNz2ndFlag.md) |
| 247 | - [SetFixPipeClipRelu](SIMD-API/basic_api/cube_compute_ISASI/cube_store_aux_config/SetFixPipeClipRelu.md) | 213 | - [SetFixPipeClipRelu](SIMD-API/basic_api/cube_compute_ISASI/cube_store_aux_config/SetFixPipeClipRelu.md) |
| 248 | - [SetFixPipeAddr](SIMD-API/basic_api/cube_compute_ISASI/cube_store_aux_config/SetFixPipeAddr.md) | 214 | - [SetFixPipeAddr](SIMD-API/basic_api/cube_compute_ISASI/cube_store_aux_config/SetFixPipeAddr.md) |
| 249 | - | ||
| 250 | - - [矩阵计算(Tensor API,试验特性)](SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_TensorAPI.md) | ||
| 251 | - - [概述](SIMD-API/basic_api/cube_compute_TensorAPI/overview/overview.md) | ||
| 252 | - - [矩阵计算的搬入](SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_load/cube_compute_load.md) | ||
| 253 | - - [总体说明](SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_load/overall_description.md) | ||
| 254 | - - [Copy(Global Memory到L1 Buffer数据搬运)](SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_load/Copy_GMToL1.md) | ||
| 255 | - - [Copy(L1 Buffer到L0A Buffer数据搬运)](SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_load/Copy_L1ToL0A.md) | ||
| 256 | - - [Copy(L1 Buffer到L0B Buffer数据搬运)](SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_load/Copy_L1ToL0B.md) | ||
| 257 | - - [Copy(L1 Buffer到L0ScaleA Buffer数据搬运)](SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_load/Copy_L1ToL0ScaleA.md) | ||
| 258 | - - [Copy(L1 Buffer到L0ScaleB Buffer数据搬运)](SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_load/Copy_L1ToL0ScaleB.md) | ||
| 259 | - - [Copy(L1 Buffer到BiasTable Buffer数据搬运)](SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_load/Copy_L1ToBiasTable.md) | ||
| 260 | - - [Copy(L1 Buffer到Fixpipe Buffer数据搬运)](SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_load/Copy_L1ToFixpipe.md) | ||
| 261 | - - [Mmad计算](SIMD-API/basic_api/cube_compute_TensorAPI/mmad_compute/mmad_compute.md) | ||
| 262 | - - [Mmad](SIMD-API/basic_api/cube_compute_TensorAPI/mmad_compute/Mmad.md) | ||
| 263 | - - [Mmad计算关键特性说明](SIMD-API/basic_api/cube_compute_TensorAPI/mmad_compute_key_features/mmad_compute_key_features.md) | ||
| 264 | - - [GEMV](SIMD-API/basic_api/cube_compute_TensorAPI/mmad_compute_key_features/GEMV.md) | ||
| 265 | - - [HF32](SIMD-API/basic_api/cube_compute_TensorAPI/mmad_compute_key_features/HF32.md) | ||
| 266 | - - [UnitFlag](SIMD-API/basic_api/cube_compute_TensorAPI/mmad_compute_key_features/UnitFlag.md) | ||
| 267 | - - [Mmad计算辅助配置接口](SIMD-API/basic_api/cube_compute_TensorAPI/mmad_compute_aux_config/mmad_compute_aux_config.md) | ||
| 268 | - - [矩阵计算的搬出](SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_store/cube_compute_store.md) | ||
| 269 | - - [总体说明](SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_store/overall_description.md) | ||
| 270 | - - [Copy(L0C Buffer到Global Memory数据搬运)](SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_store/Copy_L0CToGM.md) | ||
| 271 | - - [Copy(L0C Buffer到Unified Buffer数据搬运)](SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_store/Copy_L0CToUB.md) | ||
| 272 | - - [矩阵搬出关键特性说明](SIMD-API/basic_api/cube_compute_TensorAPI/cube_store_key_features/cube_store_key_features.md) | ||
| 273 | - - [F32 Channel Split](SIMD-API/basic_api/cube_compute_TensorAPI/cube_store_key_features/f32_channel_split.md) | ||
| 274 | - - [Int8 Channel Merge](SIMD-API/basic_api/cube_compute_TensorAPI/cube_store_key_features/int8_channel_merge.md) | ||
| 275 | - - [L0C Buffer到Unified Buffer双目标模式](SIMD-API/basic_api/cube_compute_TensorAPI/cube_store_key_features/l0c_to_ub_dual_dst.md) | ||
| 276 | - - [batch搬运](SIMD-API/basic_api/cube_compute_TensorAPI/cube_store_key_features/batch_copy.md) | ||
| 277 | - - [随路量化](SIMD-API/basic_api/cube_compute_TensorAPI/cube_store_key_features/quant_pre.md) | ||
| 278 | - - [随路Relu](SIMD-API/basic_api/cube_compute_TensorAPI/cube_store_key_features/relu_pre.md) | ||
| 279 | - [Memory矢量计算](SIMD-API/basic_api/memory_vector_compute/memory_vector_compute.md) | 215 | - [Memory矢量计算](SIMD-API/basic_api/memory_vector_compute/memory_vector_compute.md) |
| 280 | - [Vector逻辑架构](SIMD-API/basic_api/memory_vector_compute/Vector_logical_arch/Vector_logical_arch.md) | 216 | - [Vector逻辑架构](SIMD-API/basic_api/memory_vector_compute/Vector_logical_arch/Vector_logical_arch.md) |
| 281 | - [SIMD计算说明](SIMD-API/basic_api/memory_vector_compute/SIMD_compute/SIMD_compute.md) | 217 | - [SIMD计算说明](SIMD-API/basic_api/memory_vector_compute/SIMD_compute/SIMD_compute.md) |
| @@ -1396,6 +1332,109 @@ | |||
| 1396 | - [asc_storeunalign_postupdate(废弃)](SIMD-API/c_api/deprecated_interface/asc_storeunalign_postupdate_deprecated.md) | 1332 | - [asc_storeunalign_postupdate(废弃)](SIMD-API/c_api/deprecated_interface/asc_storeunalign_postupdate_deprecated.md) |
| 1397 | - [asc_exp_sub(废弃)](SIMD-API/c_api/deprecated_interface/asc_exp_sub_deprecated.md) | 1333 | - [asc_exp_sub(废弃)](SIMD-API/c_api/deprecated_interface/asc_exp_sub_deprecated.md) |
| 1398 | 1334 | ||
| 1335 | + - [Tensor API](SIMD-API/tensor_api/tensor_api.md) | ||
| 1336 | + - [Tensor API列表](SIMD-API/tensor_api/tensor_api_list.md) | ||
| 1337 | + - [Layout](SIMD-API/tensor_api/layout/layout_structure.md) | ||
| 1338 | + - [capacity](SIMD-API/tensor_api/layout/capacity.md) | ||
| 1339 | + - [coord](SIMD-API/tensor_api/layout/coord.md) | ||
| 1340 | + - [coshape](SIMD-API/tensor_api/layout/coshape.md) | ||
| 1341 | + - [cosize](SIMD-API/tensor_api/layout/cosize.md) | ||
| 1342 | + - [crd2idx](SIMD-API/tensor_api/layout/crd2idx.md) | ||
| 1343 | + - [get](SIMD-API/tensor_api/layout/get.md) | ||
| 1344 | + - [get_shape](SIMD-API/tensor_api/layout/get_shape.md) | ||
| 1345 | + - [get_stride](SIMD-API/tensor_api/layout/get_stride.md) | ||
| 1346 | + - [layout](SIMD-API/tensor_api/layout/layout.md) | ||
| 1347 | + - [Layout和层次化表述法](SIMD-API/tensor_api/layout/layout_hierarchical_representation.md) | ||
| 1348 | + - [make_coord](SIMD-API/tensor_api/layout/make_coord.md) | ||
| 1349 | + - [make_frame_layout](SIMD-API/tensor_api/layout/make_frame_layout.md) | ||
| 1350 | + - [make_layout](SIMD-API/tensor_api/layout/make_layout.md) | ||
| 1351 | + - [make_pattern_layout](SIMD-API/tensor_api/layout/make_pattern_layout.md) | ||
| 1352 | + - [make_shape](SIMD-API/tensor_api/layout/make_shape.md) | ||
| 1353 | + - [make_stride](SIMD-API/tensor_api/layout/make_stride.md) | ||
| 1354 | + - [rank](SIMD-API/tensor_api/layout/rank.md) | ||
| 1355 | + - [select](SIMD-API/tensor_api/layout/select.md) | ||
| 1356 | + - [shape](SIMD-API/tensor_api/layout/shape.md) | ||
| 1357 | + - [size](SIMD-API/tensor_api/layout/size.md) | ||
| 1358 | + - [squeeze](SIMD-API/tensor_api/layout/squeeze.md) | ||
| 1359 | + - [stride](SIMD-API/tensor_api/layout/stride.md) | ||
| 1360 | + - [Tensor](SIMD-API/tensor_api/tensor/tensor_structure.md) | ||
| 1361 | + - [make_mem_ptr](SIMD-API/tensor_api/tensor/make_mem_ptr.md) | ||
| 1362 | + - [make_tensor](SIMD-API/tensor_api/tensor/make_tensor.md) | ||
| 1363 | + - [pointer](SIMD-API/tensor_api/tensor/pointer.md) | ||
| 1364 | + - [slice](SIMD-API/tensor_api/tensor/slice.md) | ||
| 1365 | + - [tensor](SIMD-API/tensor_api/tensor/tensor.md) | ||
| 1366 | + - [view_engine](SIMD-API/tensor_api/tensor/view_engine.md) | ||
| 1367 | + - [Algorithm](SIMD-API/tensor_api/algorithm.md) | ||
| 1368 | + - [矩阵计算](SIMD-API/tensor_api/matrix_compute/matrix_compute.md) | ||
| 1369 | + - [概述](SIMD-API/tensor_api/matrix_compute/overview.md) | ||
| 1370 | + - [矩阵计算分形介绍](SIMD-API/tensor_api/matrix_compute/cube_compute_fractal_intro.md) | ||
| 1371 | + - [矩阵计算的搬入](SIMD-API/tensor_api/matrix_compute/cube_compute_load/cube_compute_load.md) | ||
| 1372 | + - [总体说明](SIMD-API/tensor_api/matrix_compute/cube_compute_load/overall_description.md) | ||
| 1373 | + - [copy(Global Memory到L1 Buffer数据搬运)](SIMD-API/tensor_api/matrix_compute/cube_compute_load/copy_gm_to_l1.md) | ||
| 1374 | + - [copy(L1 Buffer到Unified Buffer数据搬运)](SIMD-API/tensor_api/matrix_compute/cube_compute_load/copy_l1_to_ub.md) | ||
| 1375 | + - [copy(L1 Buffer到L0A Buffer数据搬运)](SIMD-API/tensor_api/matrix_compute/cube_compute_load/copy_l1_to_l0a.md) | ||
| 1376 | + - [copy(L1 Buffer到L0B Buffer数据搬运)](SIMD-API/tensor_api/matrix_compute/cube_compute_load/copy_l1_to_l0b.md) | ||
| 1377 | + - [copy(L1 Buffer到L0ScaleA Buffer数据搬运)](SIMD-API/tensor_api/matrix_compute/cube_compute_load/copy_l1_to_l0scalea.md) | ||
| 1378 | + - [copy(L1 Buffer到L0ScaleB Buffer数据搬运)](SIMD-API/tensor_api/matrix_compute/cube_compute_load/copy_l1_to_l0scaleb.md) | ||
| 1379 | + - [copy(L1 Buffer到BiasTable Buffer数据搬运)](SIMD-API/tensor_api/matrix_compute/cube_compute_load/copy_l1_to_biastable.md) | ||
| 1380 | + - [copy(L1 Buffer到Fixpipe Buffer数据搬运)](SIMD-API/tensor_api/matrix_compute/cube_compute_load/copy_l1_to_fixbuf.md) | ||
| 1381 | + - [矩阵计算的搬出](SIMD-API/tensor_api/matrix_compute/cube_compute_store/cube_compute_store.md) | ||
| 1382 | + - [总体说明](SIMD-API/tensor_api/matrix_compute/cube_compute_store/overall_description.md) | ||
| 1383 | + - [copy(L0C Buffer到Global Memory数据搬运)](SIMD-API/tensor_api/matrix_compute/cube_compute_store/copy_l0c_to_gm.md) | ||
| 1384 | + - [copy(L0C Buffer到Unified Buffer数据搬运)](SIMD-API/tensor_api/matrix_compute/cube_compute_store/copy_l0c_to_ub.md) | ||
| 1385 | + - [copy(L0C Buffer到L1 Buffer数据搬运)](SIMD-API/tensor_api/matrix_compute/cube_compute_store/copy_l0c_to_l1.md) | ||
| 1386 | + - [mmad计算](SIMD-API/tensor_api/matrix_compute/mmad_compute/mmad_compute.md) | ||
| 1387 | + - [mmad](SIMD-API/tensor_api/matrix_compute/mmad_compute/mmad.md) | ||
| 1388 | + - [mmad计算关键特性说明](SIMD-API/tensor_api/matrix_compute/mmad_compute_key_features/mmad_compute_key_features.md) | ||
| 1389 | + - [GEMV](SIMD-API/tensor_api/matrix_compute/mmad_compute_key_features/gemv.md) | ||
| 1390 | + - [HF32](SIMD-API/tensor_api/matrix_compute/mmad_compute_key_features/hf32.md) | ||
| 1391 | + - [unit_flag](SIMD-API/tensor_api/matrix_compute/mmad_compute_key_features/unit_flag.md) | ||
| 1392 | + - [mmad计算辅助配置接口](SIMD-API/tensor_api/matrix_compute/mmad_compute_aux_config.md) | ||
| 1393 | + - [矩阵搬出关键特性说明](SIMD-API/tensor_api/matrix_compute/cube_store_key_features/cube_store_key_features.md) | ||
| 1394 | + - [F32 Channel Split](SIMD-API/tensor_api/matrix_compute/cube_store_key_features/f32_channel_split.md) | ||
| 1395 | + - [Int8 Channel Merge](SIMD-API/tensor_api/matrix_compute/cube_store_key_features/int8_channel_merge.md) | ||
| 1396 | + - [L0C Buffer到Unified Buffer双目标模式](SIMD-API/tensor_api/matrix_compute/cube_store_key_features/l0c_to_ub_dual_dst.md) | ||
| 1397 | + - [batch搬运](SIMD-API/tensor_api/matrix_compute/cube_store_key_features/batch_copy.md) | ||
| 1398 | + - [随路量化](SIMD-API/tensor_api/matrix_compute/cube_store_key_features/quant_pre.md) | ||
| 1399 | + - [随路ReLU](SIMD-API/tensor_api/matrix_compute/cube_store_key_features/relu_pre.md) | ||
| 1400 | + - [数据搬运](SIMD-API/tensor_api/data_move/data_move.md) | ||
| 1401 | + - [Global Memory与Unified Buffer数据搬运](SIMD-API/tensor_api/data_move/gm_ub_data_move/gm_ub_data_move.md) | ||
| 1402 | + - [copy(Global Memory到Unified Buffer数据搬运)](SIMD-API/tensor_api/data_move/gm_ub_data_move/copy_gm_to_ub.md) | ||
| 1403 | + - [copy(Unified Buffer到Global Memory数据搬运)](SIMD-API/tensor_api/data_move/gm_ub_data_move/copy_ub_to_gm.md) | ||
| 1404 | + - [Global Memory到L1 Buffer数据搬运](SIMD-API/tensor_api/data_move/gm_l1_data_move.md) | ||
| 1405 | + - [L1 Buffer与Unified Buffer数据搬运](SIMD-API/tensor_api/data_move/l1_ub_data_move/l1_ub_data_move.md) | ||
| 1406 | + - [copy(Unified Buffer到L1 Buffer数据搬运)](SIMD-API/tensor_api/data_move/l1_ub_data_move/copy_ub_to_l1.md) | ||
| 1407 | + - [L1 Buffer到L0 Buffer数据搬运](SIMD-API/tensor_api/data_move/l1_l0_data_move.md) | ||
| 1408 | + - [L0C Buffer到Global Memory数据搬运](SIMD-API/tensor_api/data_move/l0c_gm_data_move.md) | ||
| 1409 | + - [L0C Buffer到L1 Buffer数据搬运](SIMD-API/tensor_api/data_move/l0c_l1_data_move.md) | ||
| 1410 | + - [L0C Buffer到Unified Buffer数据搬运](SIMD-API/tensor_api/data_move/l0c_ub_data_move.md) | ||
| 1411 | + - [L1 Buffer到Fixpipe Buffer数据搬运](SIMD-API/tensor_api/data_move/l1_fixbuf_data_move.md) | ||
| 1412 | + - [L1 Buffer到BiasTable Buffer数据搬运](SIMD-API/tensor_api/data_move/l1_bias_table_data_move.md) | ||
| 1413 | + - [Unified Buffer内数据搬运](SIMD-API/tensor_api/data_move/ub_ub_data_move/ub_ub_data_move.md) | ||
| 1414 | + - [copy(Unified Buffer内数据搬运)](SIMD-API/tensor_api/data_move/ub_ub_data_move/copy_ub_to_ub.md) | ||
| 1415 | + - [工具接口](SIMD-API/tensor_api/utils/tool_functions.md) | ||
| 1416 | + - [编译期整型别名](SIMD-API/tensor_api/utils/compile_time_integer_aliases.md) | ||
| 1417 | + - [维度保留标记](SIMD-API/tensor_api/utils/dimension_keep_mark.md) | ||
| 1418 | + - [get_layout_pattern](SIMD-API/tensor_api/utils/get_layout_pattern.md) | ||
| 1419 | + - [类型判断与提取工具](SIMD-API/tensor_api/utils/type_traits.md) | ||
| 1420 | + - [废弃接口](SIMD-API/tensor_api/deprecated_interface/deprecated_interface.md) | ||
| 1421 | + - [layout::Capacity(废弃)](SIMD-API/tensor_api/deprecated_interface/layout_capacity_deprecated.md) | ||
| 1422 | + - [layout::Shape(废弃)](SIMD-API/tensor_api/deprecated_interface/layout_shape_deprecated.md) | ||
| 1423 | + - [layout::Stride(废弃)](SIMD-API/tensor_api/deprecated_interface/layout_stride_deprecated.md) | ||
| 1424 | + - [layout::Rank(废弃)](SIMD-API/tensor_api/deprecated_interface/layout_rank_deprecated.md) | ||
| 1425 | + - [layout::Size(废弃)](SIMD-API/tensor_api/deprecated_interface/layout_size_deprecated.md) | ||
| 1426 | + - [layout::Get(废弃)](SIMD-API/tensor_api/deprecated_interface/layout_get_deprecated.md) | ||
| 1427 | + - [base_tensor::Tensor(废弃)](SIMD-API/tensor_api/deprecated_interface/tensor_tensor_deprecated.md) | ||
| 1428 | + - [base_tensor::Engine(废弃)](SIMD-API/tensor_api/deprecated_interface/tensor_engine_deprecated.md) | ||
| 1429 | + - [base_tensor::Layout(废弃)](SIMD-API/tensor_api/deprecated_interface/tensor_layout_deprecated.md) | ||
| 1430 | + - [base_tensor::Data(废弃)](SIMD-API/tensor_api/deprecated_interface/tensor_data_deprecated.md) | ||
| 1431 | + - [base_tensor::Shape(废弃)](SIMD-API/tensor_api/deprecated_interface/tensor_shape_deprecated.md) | ||
| 1432 | + - [base_tensor::Stride(废弃)](SIMD-API/tensor_api/deprecated_interface/tensor_stride_deprecated.md) | ||
| 1433 | + - [base_tensor::Size(废弃)](SIMD-API/tensor_api/deprecated_interface/tensor_size_deprecated.md) | ||
| 1434 | + - [base_tensor::Capacity(废弃)](SIMD-API/tensor_api/deprecated_interface/tensor_capacity_deprecated.md) | ||
| 1435 | + - [base_tensor::Slice(废弃)](SIMD-API/tensor_api/deprecated_interface/tensor_slice_deprecated.md) | ||
| 1436 | + - [global_tensor::SetL2CacheHint(废弃)](SIMD-API/tensor_api/deprecated_interface/set_l2_cache_hint_deprecated.md) | ||
| 1437 | + | ||
| 1399 | - [高阶API](SIMD-API/adv_api/adv_api.md) | 1438 | - [高阶API](SIMD-API/adv_api/adv_api.md) |
| 1400 | - [高阶API列表](SIMD-API/adv_api/adv_api_list.md) | 1439 | - [高阶API列表](SIMD-API/adv_api/adv_api_list.md) |
| 1401 | - [数据结构](SIMD-API/adv_api/data_structures/data_structures.md) | 1440 | - [数据结构](SIMD-API/adv_api/data_structures/data_structures.md) |
| @@ -4,6 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | - **[基础API](basic_api/basic_api.md)** | 5 | - **[基础API](basic_api/basic_api.md)** |
| 6 | 6 | ||
| 7 | +- **[Tensor API](tensor_api/tensor_api.md)** | ||
| 8 | + | ||
| 7 | - **[高阶API](adv_api/adv_api.md)** | 9 | - **[高阶API](adv_api/adv_api.md)** |
| 8 | 10 | ||
| 9 | - **[C API](c_api/c_api.md)** | 11 | - **[C API](c_api/c_api.md)** |
| @@ -2,16 +2,12 @@ | |||
| 2 | 2 | ||
| 3 | - **[数据结构](data_structures/data_structures.md)** | 3 | - **[数据结构](data_structures/data_structures.md)** |
| 4 | 4 | ||
| 5 | -- **[数据结构(TensorAPI,试验特性)](data_structure_TensorAPI/data_structure_TensorAPI.md)** | ||
| 6 | - | ||
| 7 | - **[辅助数据结构](aux_data_structures/aux_data_structures.md)** | 5 | - **[辅助数据结构](aux_data_structures/aux_data_structures.md)** |
| 8 | 6 | ||
| 9 | - **[数据搬运导览](data_move_guide/data_move_guide.md)** | 7 | - **[数据搬运导览](data_move_guide/data_move_guide.md)** |
| 10 | 8 | ||
| 11 | - **[矩阵计算(ISASI)](cube_compute_ISASI/cube_compute_ISASI.md)** | 9 | - **[矩阵计算(ISASI)](cube_compute_ISASI/cube_compute_ISASI.md)** |
| 12 | 10 | ||
| 13 | -- **[矩阵计算(Tensor API,试验特性)](cube_compute_TensorAPI/cube_compute_TensorAPI.md)** | ||
| 14 | - | ||
| 15 | - **[Memory矢量计算](memory_vector_compute/memory_vector_compute.md)** | 11 | - **[Memory矢量计算](memory_vector_compute/memory_vector_compute.md)** |
| 16 | 12 | ||
| 17 | - **[Reg矢量计算](reg_vector_compute/reg_vector_compute.md)** | 13 | - **[Reg矢量计算](reg_vector_compute/reg_vector_compute.md)** |
| @@ -6,9 +6,6 @@ | |||
| 6 | | --- | --- | | 6 | | --- | --- | |
| 7 | | [LocalTensor](data_structures/LocalTensor/LocalTensor.md) | LocalTensor用于存放AI Core中Local Memory(内部存储)的数据,支持逻辑位置TPosition为VECIN、VECOUT、VECCALC、A1、A2、B1、B2、CO1、CO2。 | | 7 | | [LocalTensor](data_structures/LocalTensor/LocalTensor.md) | LocalTensor用于存放AI Core中Local Memory(内部存储)的数据,支持逻辑位置TPosition为VECIN、VECOUT、VECCALC、A1、A2、B1、B2、CO1、CO2。 | |
| 8 | | [GlobalTensor](data_structures/GlobalTensor/GlobalTensor.md) | GlobalTensor用来存放Global Memory(外部存储)的全局数据。 | | 8 | | [GlobalTensor](data_structures/GlobalTensor/GlobalTensor.md) | GlobalTensor用来存放Global Memory(外部存储)的全局数据。 | |
| 9 | -| [layout_structure](data_structure_TensorAPI/data_structure_TensorAPI.md) | Tensor API基础数据结构中Layout相关基础数据结构。 | | ||
| 10 | -| [tensor_structure](data_structure_TensorAPI/data_structure_TensorAPI.md) | Tensor API基础数据结构中Tensor相关数据结构。 | | ||
| 11 | -| [GetLayoutPattern](data_structure_TensorAPI/utils/GetLayoutPattern.md) | GetLayoutPattern用于从Layout类型中提取其LayoutPattern类型信息。 | | ||
| 12 | | [Coordinate](aux_data_structures/Coordinate/Coordinate.md) | Coordinate本质上是一个元组(tuple),用于表示张量在不同维度的位置信息,即坐标值。 | | 9 | | [Coordinate](aux_data_structures/Coordinate/Coordinate.md) | Coordinate本质上是一个元组(tuple),用于表示张量在不同维度的位置信息,即坐标值。 | |
| 13 | | [Layout](aux_data_structures/Layout/Layout.md) | Layout数据结构是描述多维张量内存布局的基础模板类,通过编译时的形状(Shape)和步长(Stride)信息,实现逻辑坐标空间到一维内存地址空间的映射。 | | 10 | | [Layout](aux_data_structures/Layout/Layout.md) | Layout数据结构是描述多维张量内存布局的基础模板类,通过编译时的形状(Shape)和步长(Stride)信息,实现逻辑坐标空间到一维内存地址空间的映射。 | |
| 14 | | [TensorTrait](aux_data_structures/TensorTrait/TensorTrait.md) | TensorTrait数据结构是描述Tensor相关信息的基础模板类,包含Tensor的数据类型、逻辑位置和Layout内存布局。 | | 11 | | [TensorTrait](aux_data_structures/TensorTrait/TensorTrait.md) | TensorTrait数据结构是描述Tensor相关信息的基础模板类,包含Tensor的数据类型、逻辑位置和Layout内存布局。 | |
| @@ -114,38 +111,6 @@ | |||
| 114 | | [SetFixPipeClipRelu](cube_compute_ISASI/cube_store_aux_config/SetFixPipeClipRelu.md) | DataCopy数据搬运(L0C-\>GM)过程中进行随路量化后,通过调用该接口设置ClipReLU操作的最大值。 | | 111 | | [SetFixPipeClipRelu](cube_compute_ISASI/cube_store_aux_config/SetFixPipeClipRelu.md) | DataCopy数据搬运(L0C-\>GM)过程中进行随路量化后,通过调用该接口设置ClipReLU操作的最大值。 | |
| 115 | | [SetFixPipeAddr](cube_compute_ISASI/cube_store_aux_config/SetFixPipeAddr.md) | DataCopy数据搬运(L0C-\>GM)过程中进行随路量化后,通过调用该接口设置Elementwise操作时LocalTensor的地址。 | | 112 | | [SetFixPipeAddr](cube_compute_ISASI/cube_store_aux_config/SetFixPipeAddr.md) | DataCopy数据搬运(L0C-\>GM)过程中进行随路量化后,通过调用该接口设置Elementwise操作时LocalTensor的地址。 | |
| 116 | 113 | ||
| 117 | -## 矩阵计算(TensorAPI,试验特性) | ||
| 118 | - | ||
| 119 | -### 矩阵数据搬入至L1 | ||
| 120 | - | ||
| 121 | -| 接口名 | 功能描述 | | ||
| 122 | -| --- | --- | | ||
| 123 | -| [Copy(Global Memory到L1 Buffer数据搬运)](cube_compute_TensorAPI/cube_compute_load/Copy_GMToL1.md) | Tensor API通过`Copy`接口统一执行不同通路数据搬运。该接口用于将Global Memory中的数据搬运到L1 Buffer。`Copy`接口根据源张量和目的张量的存储位置、数据类型和Layout选择具体搬运实现。搬运块数、搬运长度、源/目的侧步长以及格式转换相关信息由Tensor Layout推导,用户不需要在`Copy`调用中额外传入搬运参数。 | | ||
| 124 | - | ||
| 125 | -### 矩阵数据搬入至L0 | ||
| 126 | - | ||
| 127 | -| 接口名 | 功能描述 | | ||
| 128 | -| --- | --- | | ||
| 129 | -| [Copy(L1 Buffer到L0A Buffer数据搬运)](cube_compute_TensorAPI/cube_compute_load/Copy_L1ToL0A.md) | Tensor API通过`Copy`接口统一执行不同通路数据搬运。该接口用于将L1 Buffer中的左矩阵数据搬运到L0A Buffer。 | | ||
| 130 | -| [Copy(L1 Buffer到L0B Buffer数据搬运)](cube_compute_TensorAPI/cube_compute_load/Copy_L1ToL0B.md) | Tensor API通过`Copy`接口统一执行不同通路数据搬运。该接口用于将L1 Buffer中的右矩阵数据搬运到L0B Buffer。 | | ||
| 131 | -| [Copy(L1 Buffer到L0ScaleA Buffer数据搬运)](cube_compute_TensorAPI/cube_compute_load/Copy_L1ToL0ScaleA.md) | Tensor API通过`Copy`接口统一执行不同通路数据搬运。该接口用于将L1 Buffer中的左矩阵缩放数据搬运到L0ScaleA Buffer。左矩阵缩放数据在L0ScaleA Buffer上的首地址由左矩阵在L0A Buffer的首地址的1/16推导出来。 | | ||
| 132 | -| [Copy(L1 Buffer到L0ScaleB Buffer数据搬运)](cube_compute_TensorAPI/cube_compute_load/Copy_L1ToL0ScaleB.md) | Tensor API通过`Copy`接口统一执行不同通路数据搬运。该接口用于将L1 Buffer中的右矩阵缩放数据搬运到L0ScaleB Buffer。右矩阵缩放数据在L0ScaleB Buffer上的首地址由右矩阵在L0B Buffer的首地址的1/16推导出来。 | | ||
| 133 | -| [Copy(L1 Buffer到BiasTable Buffer数据搬运)](cube_compute_TensorAPI/cube_compute_load/Copy_L1ToBiasTable.md) | Tensor API通过`Copy`接口统一执行不同通路数据搬运。该接口用于将L1 Buffer中的bias数据搬运到BiasTable Buffer,作为Mmad计算中的bias输入。 | | ||
| 134 | -| [Copy(L1 Buffer到Fixpipe Buffer数据搬运)](cube_compute_TensorAPI/cube_compute_load/Copy_L1ToFixpipe.md) | Tensor API通过`Copy`接口统一执行不同通路数据搬运。该接口用于将L1 Buffer中的量化数据搬运到Fixpipe Buffer。量化数据可用于L0C输出到GM/UB时做随路量化。 | | ||
| 135 | - | ||
| 136 | -### Mmad计算 | ||
| 137 | - | ||
| 138 | -| 接口名 | 功能描述 | | ||
| 139 | -| --- | --- | | ||
| 140 | -| [Mmad](cube_compute_TensorAPI/mmad_compute/Mmad.md) | `Mmad`接口用于完成L0A Buffer上左矩阵A和L0B Buffer上右矩阵B的矩阵乘加,结果写入L0C Buffer上结果矩阵C。默认模式为普通矩阵计算。 | | ||
| 141 | - | ||
| 142 | -### 矩阵计算的搬出 | ||
| 143 | - | ||
| 144 | -| 接口名 | 功能描述 | | ||
| 145 | -| --- | --- | | ||
| 146 | -| [Copy(L0C Buffer到Global Memory数据搬运)](cube_compute_TensorAPI/cube_compute_store/Copy_L0CToGM.md) | Tensor API通过`Copy`接口统一执行不同通路数据搬运。该接口用于将L0C Buffer中的矩阵计算结果搬运到Global Memory。L0C Buffer中的数据通常为`Mmad`的输出,数据格式为`NZ`。搬运到Global Memory时,接口会根据目的张量布局自动选择`NZ`到`ND`、`NZ`到`DN`或`NZ`到`NZ`的随路格式转换。 | | ||
| 147 | -| [Copy(L0C Buffer到Unified Buffer数据搬运)](cube_compute_TensorAPI/cube_compute_store/Copy_L0CToUB.md) | Tensor API通过`Copy`接口统一执行不同通路数据搬运。该接口用于将L0C Buffer中的矩阵计算结果搬运到UB。L0C Buffer中的数据通常为`Mmad`的输出,数据格式为`NZ`。搬运到UB时,接口会根据目的张量格式自动选择`NZ`到`ND`、`NZ`到`DN`或`NZ`到`NZ`的随路格式转换。 | | ||
| 148 | - | ||
| 149 | ## Memory矢量计算 | 114 | ## Memory矢量计算 |
| 150 | 115 | ||
| 151 | ### 数据搬运 | 116 | ### 数据搬运 |
| @@ -149,7 +149,7 @@ | |||
| 149 | | mSize | 必选输入 | 源NZ矩阵在M方向上的大小。<br> •不开启随路NZ2ND功能([NZ2NZ搬运](../cube_store_key_features/NZ2NZ.md)),取值范围为mSize∈[0, 65535]。<br> •开启随路[NZ2ND](../cube_store_key_features/NZ2ND.md)功能,取值范围为mSize∈[0, 8192]。<br>**注:mSize=0表示不执行搬运,该接口将被视为NOP(空操作)。** | | 149 | | mSize | 必选输入 | 源NZ矩阵在M方向上的大小。<br> •不开启随路NZ2ND功能([NZ2NZ搬运](../cube_store_key_features/NZ2NZ.md)),取值范围为mSize∈[0, 65535]。<br> •开启随路[NZ2ND](../cube_store_key_features/NZ2ND.md)功能,取值范围为mSize∈[0, 8192]。<br>**注:mSize=0表示不执行搬运,该接口将被视为NOP(空操作)。** | |
| 150 | | srcStride | 必选输入 | 源NZ矩阵中相邻Z排布的起始地址偏移,取值范围为srcStride∈[0, 65535],单位为C0_Size(16*sizeof(T)),T为src的数据类型,其值应填成mSize对16向上取整。 | | 150 | | srcStride | 必选输入 | 源NZ矩阵中相邻Z排布的起始地址偏移,取值范围为srcStride∈[0, 65535],单位为C0_Size(16*sizeof(T)),T为src的数据类型,其值应填成mSize对16向上取整。 | |
| 151 | | dstStride | 必选输入 | • 不开启NZ2ND功能([NZ2NZ搬运](../cube_store_key_features/NZ2NZ.md)):目的NZ矩阵中相邻Z排布的起始地址偏移,取值不为0,单位为datablock(32字节)。<br> • 开启随路[NZ2ND](../cube_store_key_features/NZ2ND.md)功能:目的ND矩阵每一行中的元素个数,取值不为0,单位为element。 | | 151 | | dstStride | 必选输入 | • 不开启NZ2ND功能([NZ2NZ搬运](../cube_store_key_features/NZ2NZ.md)):目的NZ矩阵中相邻Z排布的起始地址偏移,取值不为0,单位为datablock(32字节)。<br> • 开启随路[NZ2ND](../cube_store_key_features/NZ2ND.md)功能:目的ND矩阵每一行中的元素个数,取值不为0,单位为element。 | |
| 152 | -| [quantPre](../../cube_compute_TensorAPI/cube_store_key_features/quant_pre.md) | 可选输入 | 用于控制量化模式,QuantMode_t类型,默认值为`QuantMode_t::NoQuant`,具体定义如下:<br> • float/int32_t输出此需配置为`QuantMode_t::NoQuant`;<br> • half/bfloat16_t输出,此参数需配置为`QuantMode_t::F322F16`/`QuantMode_t::F322BF16`;<br>注:此参数需要用户手动配置,不会自动推导配置对应量化模式。<br>enum QuantMode_t<br>{<br> NoQuant, // 不开启量化功能<br> F322F16, // Float32_2_Float16:float cast成half,cast mode为CAST_RINT模式<br> F322BF16, // Float32_2_BFloat16:float cast成bfloat16_t,cast mode为CAST_RINT模式<br> DEQF16, // DeQuant_Float16:int32_t量化成half,scalar量化<br> VDEQF16, // Vector_DeQuant_Float16:int32_t量化成half,tensor量化<br> QF322B8_PRE, // Quant_Float32_2_B8:float量化成int8_t/uint8_t,scalar量化<br> VQF322B8_PRE, // Vector_Quant_Float32_2_B8:float量化成int8_t/uint8_t,tensor量化<br> REQ8, // ReQuant_int8:int32_t量化成int8_t/uint8_t,scalar量化<br> VREQ8, // Vector_ReQuant_int8:int32_t量化成int8_t/uint8_t,tensor量化<br>}; | | 152 | +| quantPre | 可选输入 | 用于控制量化模式,QuantMode_t类型,默认值为`QuantMode_t::NoQuant`,具体定义如下:<br> • float/int32_t输出此需配置为`QuantMode_t::NoQuant`;<br> • half/bfloat16_t输出,此参数需配置为`QuantMode_t::F322F16`/`QuantMode_t::F322BF16`;<br>注:此参数需要用户手动配置,不会自动推导配置对应量化模式。<br>enum QuantMode_t<br>{<br> NoQuant, // 不开启量化功能<br> F322F16, // Float32_2_Float16:float cast成half,cast mode为CAST_RINT模式<br> F322BF16, // Float32_2_BFloat16:float cast成bfloat16_t,cast mode为CAST_RINT模式<br> DEQF16, // DeQuant_Float16:int32_t量化成half,scalar量化<br> VDEQF16, // Vector_DeQuant_Float16:int32_t量化成half,tensor量化<br> QF322B8_PRE, // Quant_Float32_2_B8:float量化成int8_t/uint8_t,scalar量化<br> VQF322B8_PRE, // Vector_Quant_Float32_2_B8:float量化成int8_t/uint8_t,tensor量化<br> REQ8, // ReQuant_int8:int32_t量化成int8_t/uint8_t,scalar量化<br> VREQ8, // Vector_ReQuant_int8:int32_t量化成int8_t/uint8_t,tensor量化<br>}; | |
| 153 | | deqScalar | 可选输入 | scalar量化参数,表示单个scale值,quantPre量化模式为[随路量化](../cube_store_key_features/accompanying_quantization.md)时需要设置该参数。支持的数据类型为`uint64_t`。 | | 153 | | deqScalar | 可选输入 | scalar量化参数,表示单个scale值,quantPre量化模式为[随路量化](../cube_store_key_features/accompanying_quantization.md)时需要设置该参数。支持的数据类型为`uint64_t`。 | |
| 154 | | [reluEn](../cube_store_key_features/accompanying_relu.md) | 可选输入 | 是否开启NormReLU的开关:<br> • `false`:不开启NormReLU功能,默认为`false`;<br> • `true`:开启NormReLU功能。 | | 154 | | [reluEn](../cube_store_key_features/accompanying_relu.md) | 可选输入 | 是否开启NormReLU的开关:<br> • `false`:不开启NormReLU功能,默认为`false`;<br> • `true`:开启NormReLU功能。 | |
| 155 | | unitFlag | 可选输入 | unitFlag是一种Mmad指令和Fixpipe指令细粒度的并行,开启该功能后,硬件每计算完一个分形,计算结果就会被搬出。取值说明如下:<br> • 0(2'b00):不开启unitFlag;<br> • 2(2'b10):开启unitFlag,硬件执行完指令之后,不复位单元标记位;<br> • 3(2'b11):开启unitFlag,硬件执行完指令之后,复位单元标记位。<br>开启该功能时,须将Mmad指令和Fixpipe指令的unitFlag值设置为2或3。<br>参数设置方案和特性细节可参考:Mmad计算中关键特性说明的[UnitFlag](../mmad_compute_key_features/UnitFlag.md)章节。 | | 155 | | unitFlag | 可选输入 | unitFlag是一种Mmad指令和Fixpipe指令细粒度的并行,开启该功能后,硬件每计算完一个分形,计算结果就会被搬出。取值说明如下:<br> • 0(2'b00):不开启unitFlag;<br> • 2(2'b10):开启unitFlag,硬件执行完指令之后,不复位单元标记位;<br> • 3(2'b11):开启unitFlag,硬件执行完指令之后,复位单元标记位。<br>开启该功能时,须将Mmad指令和Fixpipe指令的unitFlag值设置为2或3。<br>参数设置方案和特性细节可参考:Mmad计算中关键特性说明的[UnitFlag](../mmad_compute_key_features/UnitFlag.md)章节。 | |
| @@ -133,7 +133,7 @@ | |||
| 133 | | mSize | 必选输入 | 源NZ矩阵在M方向上的大小。取值范围为mSize∈[0, 65535]。<br>**注:mSize=0表示不执行搬运,该接口将被视为NOP(空操作)。** | | 133 | | mSize | 必选输入 | 源NZ矩阵在M方向上的大小。取值范围为mSize∈[0, 65535]。<br>**注:mSize=0表示不执行搬运,该接口将被视为NOP(空操作)。** | |
| 134 | | srcStride | 必选输入 | 源NZ矩阵中相邻Z排布的起始地址偏移,取值范围为srcStride∈[0, 65535],单位为C0_Size(16*sizeof(T)),T为src的数据类型,其值应填成mSize对16向上取整。 | | 134 | | srcStride | 必选输入 | 源NZ矩阵中相邻Z排布的起始地址偏移,取值范围为srcStride∈[0, 65535],单位为C0_Size(16*sizeof(T)),T为src的数据类型,其值应填成mSize对16向上取整。 | |
| 135 | | dstStride | 必选输入 | 目的NZ矩阵中相邻Z排布的起始地址偏移,取值不为0,单位为datablock(32字节)。 | | 135 | | dstStride | 必选输入 | 目的NZ矩阵中相邻Z排布的起始地址偏移,取值不为0,单位为datablock(32字节)。 | |
| 136 | -| [quantPre](../../cube_compute_TensorAPI/cube_store_key_features/quant_pre.md) | 可选输入 | 用于控制量化模式,QuantMode_t类型,默认值为`QuantMode_t::NoQuant`,具体定义如下:<br> • half/bfloat16_t输出,此参数需配置为`QuantMode_t::F322F16`/`QuantMode_t::F322BF16`。<br>注:此参数需要用户手动配置,不会自动推导配置对应量化模式。此通路不支持NoQuant模式。<br>enum QuantMode_t<br>{<br> NoQuant, // 不开启量化功能,此通路不支持<br> F322F16, // Float32_2_Float16:float cast成half,cast mode为CAST_RINT模式<br> F322BF16, // Float32_2_BFloat16:float cast成bfloat16_t,cast mode为CAST_RINT模式<br> DEQF16, // DeQuant_Float16:int32_t量化成half,scalar量化<br> VDEQF16, // Vector_DeQuant_Float16:int32_t量化成half,tensor量化<br> QF322B8_PRE, // Quant_Float32_2_B8:float量化成int8_t/uint8_t,scalar量化<br> VQF322B8_PRE, // Vector_Quant_Float32_2_B8:float量化成int8_t/uint8_t,tensor量化<br> REQ8, // ReQuant_int8:int32_t量化成int8_t/uint8_t,scalar量化<br> VREQ8, // Vector_ReQuant_int8:int32_t量化成int8_t/uint8_t,tensor量化<br>}; | | 136 | +| quantPre | 可选输入 | 用于控制量化模式,QuantMode_t类型,默认值为`QuantMode_t::NoQuant`,具体定义如下:<br> • half/bfloat16_t输出,此参数需配置为`QuantMode_t::F322F16`/`QuantMode_t::F322BF16`。<br>注:此参数需要用户手动配置,不会自动推导配置对应量化模式。此通路不支持NoQuant模式。<br>enum QuantMode_t<br>{<br> NoQuant, // 不开启量化功能,此通路不支持<br> F322F16, // Float32_2_Float16:float cast成half,cast mode为CAST_RINT模式<br> F322BF16, // Float32_2_BFloat16:float cast成bfloat16_t,cast mode为CAST_RINT模式<br> DEQF16, // DeQuant_Float16:int32_t量化成half,scalar量化<br> VDEQF16, // Vector_DeQuant_Float16:int32_t量化成half,tensor量化<br> QF322B8_PRE, // Quant_Float32_2_B8:float量化成int8_t/uint8_t,scalar量化<br> VQF322B8_PRE, // Vector_Quant_Float32_2_B8:float量化成int8_t/uint8_t,tensor量化<br> REQ8, // ReQuant_int8:int32_t量化成int8_t/uint8_t,scalar量化<br> VREQ8, // Vector_ReQuant_int8:int32_t量化成int8_t/uint8_t,tensor量化<br>}; | |
| 137 | | deqScalar | 可选输入 | scalar量化参数,表示单个scale值,quantPre量化模式为[随路量化](../cube_store_key_features/accompanying_quantization.md)时需要设置该参数。支持的数据类型为`uint64_t`。 | | 137 | | deqScalar | 可选输入 | scalar量化参数,表示单个scale值,quantPre量化模式为[随路量化](../cube_store_key_features/accompanying_quantization.md)时需要设置该参数。支持的数据类型为`uint64_t`。 | |
| 138 | | [reluEn](../cube_store_key_features/accompanying_relu.md) | 可选输入 | 是否开启NormReLU的开关:<br> • `false`:不开启NormReLU功能,默认为`false`;<br> • `true`:开启NormReLU功能。 | | 138 | | [reluEn](../cube_store_key_features/accompanying_relu.md) | 可选输入 | 是否开启NormReLU的开关:<br> • `false`:不开启NormReLU功能,默认为`false`;<br> • `true`:开启NormReLU功能。 | |
| 139 | | unitFlag | 可选输入 | unitFlag是一种Mmad指令和Fixpipe指令细粒度的并行,开启该功能后,硬件每计算完一个分形,计算结果就会被搬出。取值说明如下:<br> • 0(2'b00):不开启unitFlag;<br> • 2(2'b10):开启unitFlag,硬件执行完指令之后,不复位单元标记位;<br> • 3(2'b11):开启unitFlag,硬件执行完指令之后,复位单元标记位。<br>开启该功能时,须将Mmad指令和Fixpipe指令的unitFlag值设置为2或3。<br>参数设置方案和特性细节可参考:Mmad计算中关键特性说明的[UnitFlag](../mmad_compute_key_features/UnitFlag.md)章节。 | | 139 | | unitFlag | 可选输入 | unitFlag是一种Mmad指令和Fixpipe指令细粒度的并行,开启该功能后,硬件每计算完一个分形,计算结果就会被搬出。取值说明如下:<br> • 0(2'b00):不开启unitFlag;<br> • 2(2'b10):开启unitFlag,硬件执行完指令之后,不复位单元标记位;<br> • 3(2'b11):开启unitFlag,硬件执行完指令之后,复位单元标记位。<br>开启该功能时,须将Mmad指令和Fixpipe指令的unitFlag值设置为2或3。<br>参数设置方案和特性细节可参考:Mmad计算中关键特性说明的[UnitFlag](../mmad_compute_key_features/UnitFlag.md)章节。 | |
| @@ -1,7 +0,0 @@ | |||
| 1 | -# 矩阵计算分形介绍<a name="ZH-CN_TOPIC_0000002538071192"></a> | ||
| 2 | - | ||
| 3 | -- **[背景与核心概念](../../cube_compute_ISASI/cube_compute_fractal_intro/background_and_core_concepts.md)** | ||
| 4 | - | ||
| 5 | -- **[关键分形格式详解](../../cube_compute_ISASI/cube_compute_fractal_intro/key_fractal_format_details.md)** | ||
| 6 | - | ||
| 7 | -- **[辅助矩阵分形格式详解](../../cube_compute_ISASI/cube_compute_fractal_intro/aux_cube_fractal_format_details.md)** | ||
Ddocs/zh/api/SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_load/Copy_L1ToBiasTable.md+0-157
| @@ -1,157 +0,0 @@ | |||
| 1 | -# Copy(L1 Buffer到BiasTable Buffer数据搬运) | ||
| 2 | - | ||
| 3 | -> [!NOTE]说明 | ||
| 4 | ->本接口为试验接口,在后续版本中可能会调整或改进,不保证后续兼容性。请开发者在使用过程中关注后续版本更新。 | ||
| 5 | - | ||
| 6 | -## 产品支持情况 | ||
| 7 | - | ||
| 8 | -<!-- npu="950" id1 --> | ||
| 9 | -- Ascend 950PR/Ascend 950DT:支持 | ||
| 10 | -<!-- end id1 --> | ||
| 11 | -<!-- npu="A3" id2 --> | ||
| 12 | -- Atlas A3 训练系列产品/Atlas A3 推理系列产品:不支持 | ||
| 13 | -<!-- end id2 --> | ||
| 14 | -<!-- npu="910b" id3 --> | ||
| 15 | -- Atlas A2 训练系列产品/Atlas A2 推理系列产品:不支持 | ||
| 16 | -<!-- end id3 --> | ||
| 17 | -<!-- npu="310b" id4 --> | ||
| 18 | -- Atlas 200I/500 A2 推理产品:不支持 | ||
| 19 | -<!-- end id4 --> | ||
| 20 | -<!-- npu="310p" id5 --> | ||
| 21 | -- Atlas 推理系列产品AI Core:不支持 | ||
| 22 | -<!-- end id5 --> | ||
| 23 | -<!-- npu="310p" id6 --> | ||
| 24 | -- Atlas 推理系列产品Vector Core:不支持 | ||
| 25 | -<!-- end id6 --> | ||
| 26 | -<!-- npu="910" id7 --> | ||
| 27 | -- Atlas 训练系列产品:不支持 | ||
| 28 | -<!-- end id7 --> | ||
| 29 | - | ||
| 30 | -## 功能说明 | ||
| 31 | - | ||
| 32 | -头文件路径为:`tensor_api/tensor.h`。 | ||
| 33 | - | ||
| 34 | -Tensor API通过`Copy`接口统一执行不同通路数据搬运。该接口用于将L1 Buffer中的bias数据搬运到BiasTable Buffer,作为Mmad计算中的bias输入。 | ||
| 35 | - | ||
| 36 | -接口支持batch模式。batch模式用于一次完成多块bias数据的搬运。Layout在原Layout最外层增加Batch维度,可通过`MakeFrameLayout<NDLayoutPtn>(batch, 1, n)`或`MakeFrameLayout<NDExtLayoutPtn>(batch, 1, n)`构造。 | ||
| 37 | - | ||
| 38 | -## 函数原型 | ||
| 39 | - | ||
| 40 | -- 执行L1 Buffer到BiasTable Buffer的数据搬运。 | ||
| 41 | - | ||
| 42 | - ```cpp | ||
| 43 | - template <typename AtomType, typename DstTensor, typename SrcTensor> | ||
| 44 | - __aicore__ inline void Copy(const CopyAtom<AtomType>& atomCopy, const DstTensor& dst, const SrcTensor& src) | ||
| 45 | - ``` | ||
| 46 | - | ||
| 47 | -- 构造默认搬运原子对象。 | ||
| 48 | - | ||
| 49 | - ```cpp | ||
| 50 | - template <typename CopyOperationType> | ||
| 51 | - __aicore__ inline constexpr auto MakeCopy(const CopyOperationType& copyOperation) | ||
| 52 | - ``` | ||
| 53 | - | ||
| 54 | -- 构造指定Trait的搬运原子对象。 | ||
| 55 | - | ||
| 56 | - ```cpp | ||
| 57 | - template <typename CopyOperationType, typename CopyTraitType> | ||
| 58 | - __aicore__ inline constexpr auto MakeCopy(const CopyOperationType& copyOperation, const CopyTraitType& copyTrait) | ||
| 59 | - ``` | ||
| 60 | - | ||
| 61 | -## 参数说明 | ||
| 62 | - | ||
| 63 | -**表1** Copy接口参数说明 | ||
| 64 | - | ||
| 65 | -| 参数名 | 输入/输出 | 描述 | | ||
| 66 | -| :--- | :---: | :--- | | ||
| 67 | -| atomCopy | 输入 | 搬运原子对象,L1 Buffer到BiasTable Buffer通路可通过`MakeCopy(CopyL12BT{})`或`MakeCopy(CopyL12BT{}, CopyL12BTTraitDefault{})`构造。 | | ||
| 68 | -| dst | 输出 | 目的张量,存储位置为`Location::BIAS`,数据格式为ND。 | | ||
| 69 | -| src | 输入 | 源张量,存储位置为`Location::L1`,数据格式为ND。 | | ||
| 70 | - | ||
| 71 | -**表2** MakeCopy接口参数说明 | ||
| 72 | - | ||
| 73 | -| 参数名 | 输入/输出 | 描述 | | ||
| 74 | -| :--- | :---: | :--- | | ||
| 75 | -| copyOperation | 输入 | 搬运操作对象,L1 Buffer到BiasTable Buffer通路使用`CopyL12BT{}`。 | | ||
| 76 | -| copyTrait | 输入 | 搬运Trait对象,用于指定搬运特性。L1 Buffer到BiasTable Buffer通路默认Trait使用`CopyL12BTTraitDefault{}`。 | | ||
| 77 | - | ||
| 78 | -## 数据类型 | ||
| 79 | - | ||
| 80 | -支持的目的张量和源张量的数据类型组合如下: | ||
| 81 | - | ||
| 82 | -**表3** 支持的数据类型组合 | ||
| 83 | - | ||
| 84 | -| 目的张量数据类型 | 源张量数据类型 | | ||
| 85 | -| :--- | :--- | | ||
| 86 | -| `float` | `bfloat16_t` | | ||
| 87 | -| `float` | `half` | | ||
| 88 | -| `float` | `float` | | ||
| 89 | -| `int32_t` | `int32_t` | | ||
| 90 | - | ||
| 91 | -## 返回值说明 | ||
| 92 | - | ||
| 93 | -`Copy`无返回值。`MakeCopy`返回`CopyAtom`对象。 | ||
| 94 | - | ||
| 95 | -## 约束说明 | ||
| 96 | - | ||
| 97 | -- 源张量内存地址和大小需要满足32Byte对齐要求。 | ||
| 98 | -- 目的张量内存地址和大小需要满足64Byte对齐要求。 | ||
| 99 | -- 由于BiasTable Buffer大小为4KB,因此每次搬运最多4KB数据。 | ||
| 100 | -- batch模式要求源张量和目的张量Batch数量一致。 | ||
| 101 | -- batch模式下,如果Global Memory上的Shape大小非对齐,由于L1 Buffer和BiasTable Buffer上有数据对齐要求,源张量和目的张量列方向Shape大小必须按32Byte对齐。 | ||
| 102 | - | ||
| 103 | -## 调用示例 | ||
| 104 | - | ||
| 105 | -```cpp | ||
| 106 | -#include "tensor_api/tensor.h" | ||
| 107 | - | ||
| 108 | -using namespace AscendC::Te; | ||
| 109 | - | ||
| 110 | -__aicore__ inline void CopyL1ToBTExample() | ||
| 111 | -{ | ||
| 112 | - using SrcType = half; | ||
| 113 | - using DstType = float; | ||
| 114 | - constexpr uint32_t n = 16; | ||
| 115 | - | ||
| 116 | - __cbuf__ SrcType l1Buf[n]; | ||
| 117 | - __biasbuf__ DstType btBuf[n]; | ||
| 118 | - | ||
| 119 | - auto l1Tensor = MakeTensor(MakeMemPtr(l1Buf), MakeFrameLayout<NDExtLayoutPtn>(1, n)); | ||
| 120 | - | ||
| 121 | - auto btTensor = MakeTensor(MakeMemPtr(btBuf), MakeFrameLayout<NDExtLayoutPtn>(1, n)); | ||
| 122 | - | ||
| 123 | - auto copyAtom = MakeCopy(CopyL12BT{}, CopyL12BTTraitDefault{}); | ||
| 124 | - Copy(copyAtom, btTensor, l1Tensor); | ||
| 125 | -} | ||
| 126 | -``` | ||
| 127 | - | ||
| 128 | -batch模式调用示例: | ||
| 129 | - | ||
| 130 | -```cpp | ||
| 131 | -#include "tensor_api/tensor.h" | ||
| 132 | - | ||
| 133 | -using namespace AscendC::Te; | ||
| 134 | - | ||
| 135 | -__aicore__ inline void CopyBatchL1ToBTExample() | ||
| 136 | -{ | ||
| 137 | - using SrcType = half; | ||
| 138 | - using DstType = float; | ||
| 139 | - constexpr uint32_t batch = 2; | ||
| 140 | - constexpr uint32_t n = 15; | ||
| 141 | - | ||
| 142 | - // batch模式下源/目的张量列方向Shape需按C0_SIZE(32Byte)对齐, | ||
| 143 | - // 分别向上对齐到C0_ELEMENT<srcType> 和C0_ELEMENT<dstType>。 | ||
| 144 | - constexpr uint32_t srcN = Std::ceil_align(n, Std::Int<C0_ELEMENT<SrcType>>{}); | ||
| 145 | - constexpr uint32_t dstN = Std::ceil_align(n, Std::Int<C0_ELEMENT<DstType>>{}); | ||
| 146 | - | ||
| 147 | - __cbuf__ SrcType l1Buf[batch * srcN]; | ||
| 148 | - __biasbuf__ DstType btBuf[batch * dstN]; | ||
| 149 | - | ||
| 150 | - auto l1Tensor = MakeTensor(MakeMemPtr(l1Buf), MakeFrameLayout<NDExtLayoutPtn>(batch, 1, srcN)); | ||
| 151 | - | ||
| 152 | - auto btTensor = MakeTensor(MakeMemPtr(btBuf), MakeFrameLayout<NDExtLayoutPtn>(batch, 1, dstN)); | ||
| 153 | - | ||
| 154 | - auto copyAtom = MakeCopy(CopyL12BT{}, CopyL12BTTraitDefault{}); | ||
| 155 | - Copy(copyAtom, btTensor, l1Tensor); | ||
| 156 | -} | ||
| 157 | -``` | ||
| @@ -1,113 +0,0 @@ | |||
| 1 | -# Copy(L1 Buffer到Fixpipe Buffer数据搬运) | ||
| 2 | - | ||
| 3 | -> [!NOTE]说明 | ||
| 4 | ->本接口为试验接口,在后续版本中可能会调整或改进,不保证后续兼容性。请开发者在使用过程中关注后续版本更新。 | ||
| 5 | - | ||
| 6 | -## 产品支持情况 | ||
| 7 | - | ||
| 8 | -<!-- npu="950" id1 --> | ||
| 9 | -- Ascend 950PR/Ascend 950DT:支持 | ||
| 10 | -<!-- end id1 --> | ||
| 11 | -<!-- npu="A3" id2 --> | ||
| 12 | -- Atlas A3 训练系列产品/Atlas A3 推理系列产品:不支持 | ||
| 13 | -<!-- end id2 --> | ||
| 14 | -<!-- npu="910b" id3 --> | ||
| 15 | -- Atlas A2 训练系列产品/Atlas A2 推理系列产品:不支持 | ||
| 16 | -<!-- end id3 --> | ||
| 17 | -<!-- npu="310b" id4 --> | ||
| 18 | -- Atlas 200I/500 A2 推理产品:不支持 | ||
| 19 | -<!-- end id4 --> | ||
| 20 | -<!-- npu="310p" id5 --> | ||
| 21 | -- Atlas 推理系列产品AI Core:不支持 | ||
| 22 | -<!-- end id5 --> | ||
| 23 | -<!-- npu="310p" id6 --> | ||
| 24 | -- Atlas 推理系列产品Vector Core:不支持 | ||
| 25 | -<!-- end id6 --> | ||
| 26 | -<!-- npu="910" id7 --> | ||
| 27 | -- Atlas 训练系列产品:不支持 | ||
| 28 | -<!-- end id7 --> | ||
| 29 | - | ||
| 30 | -## 功能说明 | ||
| 31 | - | ||
| 32 | -头文件路径为:`tensor_api/tensor.h`。 | ||
| 33 | - | ||
| 34 | -Tensor API通过`Copy`接口统一执行不同通路数据搬运。该接口用于将L1 Buffer中的量化数据搬运到Fixpipe Buffer。量化数据可用于L0C输出到GM/Unified Buffer(UB)时做随路量化。 | ||
| 35 | - | ||
| 36 | -## 函数原型 | ||
| 37 | - | ||
| 38 | -- 执行L1 Buffer到Fixpipe Buffer的数据搬运。 | ||
| 39 | - | ||
| 40 | - ```cpp | ||
| 41 | - template <typename AtomType, typename DstTensor, typename SrcTensor> | ||
| 42 | - __aicore__ inline void Copy(const CopyAtom<AtomType>& atomCopy, const DstTensor& dst, const SrcTensor& src) | ||
| 43 | - ``` | ||
| 44 | - | ||
| 45 | -- 构造默认搬运原子对象。 | ||
| 46 | - | ||
| 47 | - ```cpp | ||
| 48 | - template <typename CopyOperationType> | ||
| 49 | - __aicore__ inline constexpr auto MakeCopy(const CopyOperationType& copyOperation) | ||
| 50 | - ``` | ||
| 51 | - | ||
| 52 | -- 构造指定Trait的搬运原子对象。 | ||
| 53 | - | ||
| 54 | - ```cpp | ||
| 55 | - template <typename CopyOperationType, typename CopyTraitType> | ||
| 56 | - __aicore__ inline constexpr auto MakeCopy( | ||
| 57 | - const CopyOperationType& copyOperation, const CopyTraitType& copyTrait) | ||
| 58 | - ``` | ||
| 59 | - | ||
| 60 | -## 参数说明 | ||
| 61 | - | ||
| 62 | -**表1** `Copy`接口参数说明 | ||
| 63 | - | ||
| 64 | -| 参数名 | 输入/输出 | 描述 | | ||
| 65 | -| :--- | :---: | :--- | | ||
| 66 | -| atomCopy | 输入 | 搬运原子对象。L1 Buffer到Fixpipe Buffer通路可通过`MakeCopy(CopyL12FB{})`或`MakeCopy(CopyL12FB{}, CopyL12FBTraitDefault{})`构造。 | | ||
| 67 | -| dst | 输出 | 目的张量,存储位置为`Location::FIXBUF`,数据格式为`ND`。 | | ||
| 68 | -| src | 输入 | 源张量,存储位置为`Location::L1`,数据格式为`ND`。 | | ||
| 69 | - | ||
| 70 | -**表2** `MakeCopy`接口参数说明 | ||
| 71 | - | ||
| 72 | -| 参数名 | 输入/输出 | 描述 | | ||
| 73 | -| :--- | :---: | :--- | | ||
| 74 | -| copyOperation | 输入 | 搬运操作对象。L1 Buffer到Fixpipe Buffer通路使用`CopyL12FB{}`。 | | ||
| 75 | -| copyTrait | 输入 | 搬运Trait对象,用于指定搬运特性。L1 Buffer到Fixpipe Buffer通路默认Trait使用`CopyL12FBTraitDefault{}`。 | | ||
| 76 | - | ||
| 77 | -## 数据类型 | ||
| 78 | - | ||
| 79 | -源张量和目的张量的数据类型要求是`uint64_t`。 | ||
| 80 | - | ||
| 81 | -## 返回值说明 | ||
| 82 | - | ||
| 83 | -`Copy`无返回值。`MakeCopy`返回`CopyAtom`对象。 | ||
| 84 | - | ||
| 85 | -## 约束说明 | ||
| 86 | - | ||
| 87 | -- 源Tensor内存地址和大小需要满足32Byte对齐要求。 | ||
| 88 | -- 目的Tensor内存地址和大小需要满足128Byte对齐要求。 | ||
| 89 | -- 由于Fixpipe Buffer大小为4KB,因此每次搬运最多4KB数据。 | ||
| 90 | - | ||
| 91 | -## 调用示例 | ||
| 92 | - | ||
| 93 | -```cpp | ||
| 94 | -#include "tensor_api/tensor.h" | ||
| 95 | - | ||
| 96 | -using namespace AscendC::Te; | ||
| 97 | - | ||
| 98 | -__aicore__ inline void CopyL1ToFixpipeExample() | ||
| 99 | -{ | ||
| 100 | - using DataType = uint64_t; | ||
| 101 | - constexpr uint32_t n = 16; | ||
| 102 | - | ||
| 103 | - __cbuf__ DataType l1Buf[n]; | ||
| 104 | - __fbuf__ DataType fixbuf[n]; | ||
| 105 | - | ||
| 106 | - auto l1Tensor = MakeTensor(MakeMemPtr(l1Buf), MakeFrameLayout<NDExtLayoutPtn>(1, n)); | ||
| 107 | - | ||
| 108 | - auto fixbufTensor = MakeTensor(MakeMemPtr(fixbuf), MakeFrameLayout<NDExtLayoutPtn>(1, n)); | ||
| 109 | - | ||
| 110 | - auto copyAtom = MakeCopy(CopyL12FB{}, CopyL12FBTraitDefault{}); | ||
| 111 | - Copy(copyAtom, fixbufTensor, l1Tensor); | ||
| 112 | -} | ||
| 113 | -``` | ||
| @@ -1,307 +0,0 @@ | |||
| 1 | -# Copy(L1 Buffer到L0A Buffer数据搬运) | ||
| 2 | - | ||
| 3 | -> [!NOTE]说明 | ||
| 4 | ->本接口为试验接口,在后续版本中可能会调整或改进,不保证后续兼容性。请开发者在使用过程中关注后续版本更新。 | ||
| 5 | - | ||
| 6 | -## 产品支持情况 | ||
| 7 | - | ||
| 8 | -<!-- npu="950" id1 --> | ||
| 9 | -- Ascend 950PR/Ascend 950DT:支持 | ||
| 10 | -<!-- end id1 --> | ||
| 11 | -<!-- npu="A3" id2 --> | ||
| 12 | -- Atlas A3 训练系列产品/Atlas A3 推理系列产品:不支持 | ||
| 13 | -<!-- end id2 --> | ||
| 14 | -<!-- npu="910b" id3 --> | ||
| 15 | -- Atlas A2 训练系列产品/Atlas A2 推理系列产品:不支持 | ||
| 16 | -<!-- end id3 --> | ||
| 17 | -<!-- npu="310b" id4 --> | ||
| 18 | -- Atlas 200I/500 A2 推理产品:不支持 | ||
| 19 | -<!-- end id4 --> | ||
| 20 | -<!-- npu="310p" id5 --> | ||
| 21 | -- Atlas 推理系列产品AI Core:不支持 | ||
| 22 | -<!-- end id5 --> | ||
| 23 | -<!-- npu="310p" id6 --> | ||
| 24 | -- Atlas 推理系列产品Vector Core:不支持 | ||
| 25 | -<!-- end id6 --> | ||
| 26 | -<!-- npu="910" id7 --> | ||
| 27 | -- Atlas 训练系列产品:不支持 | ||
| 28 | -<!-- end id7 --> | ||
| 29 | - | ||
| 30 | -## 功能说明 | ||
| 31 | - | ||
| 32 | -头文件路径为:`tensor_api/tensor.h`。 | ||
| 33 | - | ||
| 34 | -Tensor API通过`Copy`接口统一执行不同通路数据搬运。该接口用于将L1 Buffer中的左矩阵数据搬运到L0A Buffer。 | ||
| 35 | - | ||
| 36 | -该通路以512Byte数据分形为基本搬运单位。不同数据类型对应的分形矩阵形态如下: | ||
| 37 | - | ||
| 38 | -| 数据位宽 | 分形矩阵形态 | | ||
| 39 | -| :--- | :--- | | ||
| 40 | -| b4 | 16 * 64 | | ||
| 41 | -| b8 | 16 * 32 | | ||
| 42 | -| b16 | 16 * 16 | | ||
| 43 | -| b32 | 16 * 8 | | ||
| 44 | - | ||
| 45 | -接口支持非转置搬运、转置搬运和Img2Col卷积数据搬运。源张量和目的张量的Layout需要匹配当前通路支持的格式组合。Img2Col场景中,源张量为`NC1HWC0`格式,目的张量为`NZ`格式,搬运过程中将卷积特征图展开为矩阵。 | ||
| 46 | - | ||
| 47 | -接口支持Batch模式。Batch模式下,源张量和目的张量的Layout需要在原有分形Layout最前面增加Batch维,Shape形态为`(B, 单矩阵Shape)`,其中`B`表示Batch数量。用户可使用`MakeFrameLayout<NZLayoutPtn, DataType>(B, m, k)`或`MakeFrameLayout<ZNLayoutPtn, DataType>(B, m, k)`构造带Batch维的Layout。 | ||
| 48 | - | ||
| 49 | -## 函数原型 | ||
| 50 | - | ||
| 51 | -- 执行L1 Buffer到L0A Buffer的数据搬运。 | ||
| 52 | - | ||
| 53 | - ```cpp | ||
| 54 | - template <typename AtomType, typename DstTensor, typename SrcTensor> | ||
| 55 | - __aicore__ inline void Copy(const CopyAtom<AtomType>& atomCopy, const DstTensor& dst, const SrcTensor& src) | ||
| 56 | - ``` | ||
| 57 | - | ||
| 58 | -- 构造默认搬运原子对象。 | ||
| 59 | - | ||
| 60 | - ```cpp | ||
| 61 | - template <typename CopyOperationType> | ||
| 62 | - __aicore__ inline constexpr auto MakeCopy(const CopyOperationType& copyOperation) | ||
| 63 | - ``` | ||
| 64 | - | ||
| 65 | -- 构造指定Trait的搬运原子对象。 | ||
| 66 | - | ||
| 67 | - ```cpp | ||
| 68 | - template <typename CopyOperationType, typename CopyTraitType> | ||
| 69 | - __aicore__ inline constexpr auto MakeCopy( | ||
| 70 | - const CopyOperationType& copyOperation, const CopyTraitType& copyTrait) | ||
| 71 | - ``` | ||
| 72 | - | ||
| 73 | -Img2Col搬运通过`CopyAtom::with`绑定`Img2ColParams`后,使用相同的`Copy(atomCopy, dst, src)`函数原型执行。 | ||
| 74 | - | ||
| 75 | -## 参数说明 | ||
| 76 | - | ||
| 77 | -**表1** `Copy`接口参数说明 | ||
| 78 | - | ||
| 79 | -| 参数名 | 输入/输出 | 描述 | | ||
| 80 | -| :--- | :---: | :--- | | ||
| 81 | -| atomCopy | 输入 | 搬运原子对象。L1 Buffer到L0A Buffer通路可通过`MakeCopy(CopyL12L0A{})`或`MakeCopy(CopyL12L0A{}, CopyL12L0ATraitDefault{})`构造。 | | ||
| 82 | -| dst | 输出 | 目的张量,存储位置为`Location::L0A`。 | | ||
| 83 | -| src | 输入 | 源张量,存储位置为`Location::L1`。 | | ||
| 84 | - | ||
| 85 | -**表2** `MakeCopy`接口参数说明 | ||
| 86 | - | ||
| 87 | -| 参数名 | 输入/输出 | 描述 | | ||
| 88 | -| :--- | :---: | :--- | | ||
| 89 | -| copyOperation | 输入 | 搬运操作对象。L1 Buffer到L0A Buffer通路使用`CopyL12L0A{}`。 | | ||
| 90 | -| copyTrait | 输入 | 搬运Trait对象,用于指定搬运特性。L1 Buffer到L0A Buffer默认Trait使用`CopyL12L0ATraitDefault{}`。 | | ||
| 91 | - | ||
| 92 | -### Img2ColParams说明 | ||
| 93 | - | ||
| 94 | -`Img2ColParams<T>`用于配置Img2Col搬运的目的矩阵范围、卷积核、滑动步长、膨胀和padding。源特征图的H、W和通道数由`NC1HWC0`源Layout推导。 | ||
| 95 | - | ||
| 96 | -```cpp | ||
| 97 | -template <typename T> | ||
| 98 | -struct Img2ColParams { | ||
| 99 | - uint16_t mExtension = 0; | ||
| 100 | - uint16_t kExtension = 0; | ||
| 101 | - uint16_t mStartPt = 0; | ||
| 102 | - uint16_t kStartPt = 0; | ||
| 103 | - uint8_t padList[4] = {0, 0, 0, 0}; | ||
| 104 | - uint8_t strideW = 1; | ||
| 105 | - uint8_t strideH = 1; | ||
| 106 | - uint8_t filterW = 1; | ||
| 107 | - uint8_t filterH = 1; | ||
| 108 | - uint8_t dilationFilterW = 1; | ||
| 109 | - uint8_t dilationFilterH = 1; | ||
| 110 | - bool filterSizeW = false; | ||
| 111 | - bool filterSizeH = false; | ||
| 112 | - bool transpose = false; | ||
| 113 | - bool fMatrixCtrl = false; | ||
| 114 | - T padValue = 0; | ||
| 115 | -}; | ||
| 116 | -``` | ||
| 117 | - | ||
| 118 | -**表3** `Img2ColParams`成员说明 | ||
| 119 | - | ||
| 120 | -| 成员 | 默认值 | 描述 | | ||
| 121 | -| :--- | :--- | :--- | | ||
| 122 | -| mExtension | `0` | 目的矩阵M轴的搬运元素数,取值范围为[0, 65535],为0时不执行搬运。搬运范围未覆盖目的矩阵最下侧分形时,b8和b16数据类型要求取值为16的倍数,b32数据类型无倍数要求;覆盖最下侧分形时无倍数要求。 | | ||
| 123 | -| kExtension | `0` | 目的矩阵K轴的搬运元素数,取值范围为[0, 65535],为0时不执行搬运。搬运范围未覆盖目的矩阵最右侧分形时,b8、b16和b32数据类型分别要求取值为32、16和8的倍数;覆盖最右侧分形时无倍数要求。 | | ||
| 124 | -| mStartPt | `0` | 目的矩阵M轴的搬运起点,取值范围[0, 32767]。默认为0。 | | ||
| 125 | -| kStartPt | `0` | 该指令在目的操作数width维度的起点,对于b32类型,应为8的倍数;对于b16类型,应为16的倍数;对于b8类型,应为32的倍数;对于b4类型,应为64的倍数。取值范围[0, 65535]。默认为0。| | ||
| 126 | -| padList | `{0, 0, 0, 0}` | padding大小,依次为左、右、上、下,每个值的取值范围为[0, 255]。 | | ||
| 127 | -| strideW | `1` | 卷积核在源特征图W轴的滑动步长,取值范围为[0, 63]。 | | ||
| 128 | -| strideH | `1` | 卷积核在源特征图H轴的滑动步长,取值范围为[0, 63]。 | | ||
| 129 | -| filterW | `1` | 卷积核的宽度,取值范围为[0, 255]。 | | ||
| 130 | -| filterH | `1` | 卷积核的高度,取值范围为[0, 255]。 | | ||
| 131 | -| dilationFilterW | `1` | 卷积核W轴的膨胀系数,取值范围为[0, 255]。 | | ||
| 132 | -| dilationFilterH | `1` | 卷积核H轴的膨胀系数,取值范围为[0, 255]。 | | ||
| 133 | -| filterSizeW | `false` | 是否在`filterW`基础上将卷积核宽度增加256。 | | ||
| 134 | -| filterSizeH | `false` | 是否在`filterH`基础上将卷积核高度增加256。 | | ||
| 135 | -| transpose | `false` | 是否对展开后的目的矩阵进行转置。 | | ||
| 136 | -| fMatrixCtrl | `false` | FeatureMap属性选择标识,当前仅支持`false`。 | | ||
| 137 | -| padValue | `0` | padding区域的填充值。模板参数T需要与目的张量的元素类型一致。 | | ||
| 138 | - | ||
| 139 | -## 数据类型 | ||
| 140 | - | ||
| 141 | -非Img2Col搬运支持的数据类型包括: | ||
| 142 | - | ||
| 143 | -`fp4x2_e2m1_t`、`fp4x2_e1m2_t`、`int8_t`、`uint8_t`、`hifloat8_t`、`fp8_e5m2_t`、`fp8_e4m3fn_t`、`half`、`bfloat16_t`、`int16_t`、`uint16_t`、`int32_t`、`uint32_t`、`float`。 | ||
| 144 | - | ||
| 145 | -源张量和目的张量的数据类型需要保持一致。 | ||
| 146 | - | ||
| 147 | -Img2Col搬运不支持b4数据类型,即不支持`fp4x2_e2m1_t`和`fp4x2_e1m2_t`。 | ||
| 148 | - | ||
| 149 | -## 返回值说明 | ||
| 150 | - | ||
| 151 | -`Copy`无返回值。`MakeCopy`返回`CopyAtom`对象。 | ||
| 152 | - | ||
| 153 | -## 约束说明 | ||
| 154 | - | ||
| 155 | -- 目的地址位于L0A Buffer时,起始地址需要满足512Byte对齐要求。 | ||
| 156 | -- 源地址位于L1 Buffer时,起始地址需要满足32Byte对齐要求。 | ||
| 157 | -- 特殊数据类型约束:L1 Buffer到L0A Buffer通路使能转置时,即`ZN2NZ`,支持的数据类型约束如下: | ||
| 158 | - - b32数据类型要求源矩阵Shape在K轴方向16对齐。 | ||
| 159 | - - b8数据类型要求源矩阵Shape在M轴方向32对齐。 | ||
| 160 | - - b4数据类型要求源矩阵Shape在M轴方向64对齐。 | ||
| 161 | -- Batch模式要求源张量和目的张量的Batch数量一致,且在L1 Buffer和L0A Buffer上张量数据连续排布。 | ||
| 162 | -- Img2Col搬运当前仅支持N为1的`NC1HWC0`源张量,目的张量需要为`NZ`格式。 | ||
| 163 | -- `Img2ColParams<T>`的T需要与L0A Buffer目的张量的元素类型一致。 | ||
| 164 | - | ||
| 165 | -## 关键特性说明 | ||
| 166 | - | ||
| 167 | -### 非转置搬运 | ||
| 168 | - | ||
| 169 | -当源张量和目的张量数据格式为`NZ`时,接口按非转置方式从L1 Buffer搬运到L0A Buffer。 | ||
| 170 | - | ||
| 171 | -**图1** 非转置搬运示意图 | ||
| 172 | - | ||
| 173 | - | ||
| 174 | - | ||
| 175 | -### 转置搬运 | ||
| 176 | - | ||
| 177 | -当源张量数据格式为`ZN`、目的张量数据格式为`NZ`时,接口按转置方式搬运。转置搬运会对源张量中每个分形矩阵进行转置。 | ||
| 178 | - | ||
| 179 | -不同数据位宽的转置搬运示意如下。 | ||
| 180 | - | ||
| 181 | -#### b4转置搬运 | ||
| 182 | - | ||
| 183 | -**图2** b4转置搬运示意图 | ||
| 184 | - | ||
| 185 | - | ||
| 186 | - | ||
| 187 | -#### b8转置搬运 | ||
| 188 | - | ||
| 189 | -**图3** b8转置搬运示意图 | ||
| 190 | - | ||
| 191 | - | ||
| 192 | - | ||
| 193 | -#### b16转置搬运 | ||
| 194 | - | ||
| 195 | -**图4** b16转置搬运示意图 | ||
| 196 | - | ||
| 197 | - | ||
| 198 | - | ||
| 199 | -#### b32转置搬运 | ||
| 200 | - | ||
| 201 | -**图5** b32转置搬运示意图 | ||
| 202 | - | ||
| 203 | - | ||
| 204 | - | ||
| 205 | -### Batch搬运 | ||
| 206 | - | ||
| 207 | -当源张量和目的张量均使用带Batch维的Layout时,`Copy`接口会按照Batch维描述的数据范围完成L1 Buffer到L0A Buffer的数据搬运。非转置搬运时源张量、目的张量均为`NZ`格式,转置搬运时源张量为`ZN`格式,目的张量为`NZ`格式。 | ||
| 208 | - | ||
| 209 | -### Img2Col搬运 | ||
| 210 | - | ||
| 211 | -Img2Col搬运将`NC1HWC0`格式特征图按卷积核窗口展开为`NZ`格式矩阵。展开后矩阵的M轴对应输出特征图的空间位置,K轴对应卷积核的H、W和输入通道。用户通过`Img2ColParams`配置展开范围和卷积参数,再通过`copyAtom.with(params)`将参数绑定到搬运原子对象。 | ||
| 212 | - | ||
| 213 | -## 调用示例 | ||
| 214 | - | ||
| 215 | -```cpp | ||
| 216 | -#include "tensor_api/tensor.h" | ||
| 217 | - | ||
| 218 | -using namespace AscendC::Te; | ||
| 219 | - | ||
| 220 | -__aicore__ inline void CopyL1ToL0AExample() | ||
| 221 | -{ | ||
| 222 | - using AType = half; | ||
| 223 | - constexpr uint32_t m = 16; | ||
| 224 | - constexpr uint32_t k = 16; | ||
| 225 | - | ||
| 226 | - __cbuf__ AType l1Buf[m * k]; | ||
| 227 | - __ca__ AType l0aBuf[m * k]; | ||
| 228 | - | ||
| 229 | - auto l1Tensor = MakeTensor(MakeMemPtr(l1Buf), MakeFrameLayout<NZLayoutPtn, AType>(m, k)); | ||
| 230 | - | ||
| 231 | - auto l0aTensor = MakeTensor(MakeMemPtr(l0aBuf), MakeFrameLayout<NZLayoutPtn, AType>(m, k)); | ||
| 232 | - | ||
| 233 | - auto copyAtom = MakeCopy(CopyL12L0A{}, CopyL12L0ATraitDefault{}); | ||
| 234 | - Copy(copyAtom, l0aTensor, l1Tensor); | ||
| 235 | -} | ||
| 236 | -``` | ||
| 237 | - | ||
| 238 | -Batch模式示例如下。 | ||
| 239 | - | ||
| 240 | -```cpp | ||
| 241 | -#include "tensor_api/tensor.h" | ||
| 242 | - | ||
| 243 | -using namespace AscendC::Te; | ||
| 244 | - | ||
| 245 | -__aicore__ inline void CopyL1ToL0ABatchExample() | ||
| 246 | -{ | ||
| 247 | - using AType = half; | ||
| 248 | - constexpr uint32_t batch = 2; | ||
| 249 | - constexpr uint32_t m = 16; | ||
| 250 | - constexpr uint32_t k = 16; | ||
| 251 | - | ||
| 252 | - __cbuf__ AType l1Buf[batch * m * k]; | ||
| 253 | - __ca__ AType l0aBuf[batch * m * k]; | ||
| 254 | - | ||
| 255 | - auto layout = MakeFrameLayout<NZLayoutPtn, AType>(batch, m, k); | ||
| 256 | - auto l1Tensor = MakeTensor(MakeMemPtr(l1Buf), layout); | ||
| 257 | - auto l0aTensor = MakeTensor(MakeMemPtr(l0aBuf), layout); | ||
| 258 | - | ||
| 259 | - auto copyAtom = MakeCopy(CopyL12L0A{}, CopyL12L0ATraitDefault{}); | ||
| 260 | - Copy(copyAtom, l0aTensor, l1Tensor); | ||
| 261 | -} | ||
| 262 | -``` | ||
| 263 | - | ||
| 264 | -Img2Col搬运示例如下。输入特征图Shape为`(1, 2, 5, 5, 16)`,卷积核为3×3,stride为1,padding为1,展开后矩阵的逻辑Shape为`(25, 288)`。 | ||
| 265 | - | ||
| 266 | -```cpp | ||
| 267 | -#include "tensor_api/tensor.h" | ||
| 268 | - | ||
| 269 | -using namespace AscendC::Te; | ||
| 270 | - | ||
| 271 | -__aicore__ inline void CopyImg2ColL1ToL0A() | ||
| 272 | -{ | ||
| 273 | - constexpr uint32_t N = 1; | ||
| 274 | - constexpr uint32_t C1 = 2; | ||
| 275 | - constexpr uint32_t H = 5; | ||
| 276 | - constexpr uint32_t W = 5; | ||
| 277 | - constexpr uint32_t C0 = 16; | ||
| 278 | - constexpr uint32_t M = 25; | ||
| 279 | - constexpr uint32_t K = 3 * 3 * C1 * C0; | ||
| 280 | - constexpr uint32_t M_ALIGN = 32; | ||
| 281 | - | ||
| 282 | - __cbuf__ half l1Buf[N * C1 * H * W * C0]; | ||
| 283 | - __ca__ half l0aBuf[M_ALIGN * K]; | ||
| 284 | - | ||
| 285 | - auto l1Feature = MakeTensor( | ||
| 286 | - MakeMemPtr(l1Buf), MakeFrameLayout<NC1HWC0LayoutPtn>(N, C1, H, W, C0)); | ||
| 287 | - auto l0aMatrix = MakeTensor( | ||
| 288 | - MakeMemPtr(l0aBuf), MakeFrameLayout<NZLayoutPtn, half>(M, K)); | ||
| 289 | - | ||
| 290 | - Img2ColParams<half> params; | ||
| 291 | - params.mExtension = M; | ||
| 292 | - params.kExtension = K; | ||
| 293 | - prams.mStartPt = 0; | ||
| 294 | - prams.kStartPt = 0; | ||
| 295 | - params.filterW = 3; | ||
| 296 | - params.filterH = 3; | ||
| 297 | - params.strideW = 1; | ||
| 298 | - params.strideH = 1; | ||
| 299 | - params.padList[0] = 1; | ||
| 300 | - params.padList[1] = 1; | ||
| 301 | - params.padList[2] = 1; | ||
| 302 | - params.padList[3] = 1; | ||
| 303 | - | ||
| 304 | - auto copyL1ToL0A = MakeCopy(CopyL12L0A{}, CopyL12L0ATraitDefault{}); | ||
| 305 | - Copy(copyL1ToL0A.with(params), l0aMatrix, l1Feature); | ||
| 306 | -} | ||
| 307 | -``` | ||
| @@ -1,19 +0,0 @@ | |||
| 1 | -# 矩阵计算的搬入 | ||
| 2 | - | ||
| 3 | -- **[总体说明](overall_description.md)** | ||
| 4 | - | ||
| 5 | -- **[L1-L0A-L0B Buffer内存结构介绍](../../cube_compute_ISASI/cube_compute_load/L1_L0A_B_memory_structure_intro.md)** | ||
| 6 | - | ||
| 7 | -- **[Copy(Global Memory到L1 Buffer数据搬运)](Copy_GMToL1.md)** | ||
| 8 | - | ||
| 9 | -- **[Copy(L1 Buffer到L0A Buffer数据搬运)](Copy_L1ToL0A.md)** | ||
| 10 | - | ||
| 11 | -- **[Copy(L1 Buffer到L0B Buffer数据搬运)](Copy_L1ToL0B.md)** | ||
| 12 | - | ||
| 13 | -- **[Copy(L1 Buffer到L0ScaleA Buffer数据搬运)](Copy_L1ToL0ScaleA.md)** | ||
| 14 | - | ||
| 15 | -- **[Copy(L1 Buffer到L0ScaleB Buffer数据搬运)](Copy_L1ToL0ScaleB.md)** | ||
| 16 | - | ||
| 17 | -- **[Copy(L1 Buffer到BiasTable Buffer数据搬运)](Copy_L1ToBiasTable.md)** | ||
| 18 | - | ||
| 19 | -- **[Copy(L1 Buffer到Fixpipe Buffer数据搬运)](Copy_L1ToFixpipe.md)** | ||
| @@ -1,9 +0,0 @@ | |||
| 1 | -# 矩阵计算的搬出 | ||
| 2 | - | ||
| 3 | -- **[总体说明](overall_description.md)** | ||
| 4 | - | ||
| 5 | -- **[L0C Buffer内存结构介绍](../../cube_compute_ISASI/cube_compute_store/L0C_memory_structure_intro.md)** | ||
| 6 | - | ||
| 7 | -- **[Copy(L0C Buffer到Global Memory数据搬运)](Copy_L0CToGM.md)** | ||
| 8 | - | ||
| 9 | -- **[Copy(L0C Buffer到Unified Buffer数据搬运)](Copy_L0CToUB.md)** | ||
| @@ -1,54 +0,0 @@ | |||
| 1 | -# 随路Relu | ||
| 2 | - | ||
| 3 | -随路Relu是矩阵计算结果从L0C Buffer搬出到Global Memory或Unified Buffer(UB)过程中的随路激活能力。Tensor API通过`CopyL0C2GMTrait::enableRelu`或`CopyL0C2UBTrait::enableRelu`控制是否使能该能力。 | ||
| 4 | - | ||
| 5 | -## 功能说明 | ||
| 6 | - | ||
| 7 | -`enableRelu`默认值为`false`,表示不使能随路Relu。设置为`true`时,搬出过程中对输出数据执行Normal Relu激活。 | ||
| 8 | - | ||
| 9 | -```cpp | ||
| 10 | -constexpr CopyL0C2GMTrait l0c2gmTrait = { | ||
| 11 | - RoundMode::DEFAULT, | ||
| 12 | - true, | ||
| 13 | - false | ||
| 14 | -}; | ||
| 15 | - | ||
| 16 | -struct CopyL0C2GMTraitCustom { | ||
| 17 | - using TraitType = CopyL0C2GMTrait; | ||
| 18 | - static constexpr const TraitType value = l0c2gmTrait; | ||
| 19 | -}; | ||
| 20 | - | ||
| 21 | -FixpipeParams params; | ||
| 22 | -auto atom = MakeCopy(CopyL0C2GM{}, CopyL0C2GMTraitCustom{}).with(params); | ||
| 23 | -Copy(atom, gm, l0c); | ||
| 24 | -``` | ||
| 25 | - | ||
| 26 | -L0C Buffer到UB搬运同样通过`CopyL0C2UBTrait::enableRelu`控制: | ||
| 27 | - | ||
| 28 | -```cpp | ||
| 29 | -constexpr CopyL0C2UBTrait l0c2ubTrait = { | ||
| 30 | - RoundMode::DEFAULT, | ||
| 31 | - true, | ||
| 32 | - false, | ||
| 33 | - DUAL_DST_DISABLE | ||
| 34 | -}; | ||
| 35 | - | ||
| 36 | -struct CopyL0C2UBTraitCustom { | ||
| 37 | - using TraitType = CopyL0C2UBTrait; | ||
| 38 | - static constexpr const TraitType value = l0c2ubTrait; | ||
| 39 | -}; | ||
| 40 | - | ||
| 41 | -FixpipeParams params; | ||
| 42 | -auto atom = MakeCopy(CopyL0C2UB{}, CopyL0C2UBTraitCustom{}).with(params); | ||
| 43 | -Copy(atom, ub, l0c); | ||
| 44 | -``` | ||
| 45 | - | ||
| 46 | -## 支持范围 | ||
| 47 | - | ||
| 48 | -根据底层Fixpipe的能力,随路Relu包含Normal Relu、Leaky Relu和PRelu等模式。当前Tensor API的L0C Buffer到Global Memory/UB搬运通过`enableRelu`暴露Normal Relu能力,当前不支持随路PRelu。 | ||
| 49 | - | ||
| 50 | -## 约束说明 | ||
| 51 | - | ||
| 52 | -- `enableRelu`为编译期trait配置,默认不使能。 | ||
| 53 | -- 量化和Relu参数不能为`inf`、`nan`或非规格化数。 | ||
| 54 | -- 当前Tensor API不支持随路PRelu。 | ||
| @@ -1,3 +0,0 @@ | |||
| 1 | -# 矩阵计算 | ||
| 2 | - | ||
| 3 | -- **[Mmad](Mmad.md)** | ||
| @@ -1,9 +0,0 @@ | |||
| 1 | -# Mmad计算辅助配置接口<a name="ZH-CN_TOPIC_00000025121725632"></a> | ||
| 2 | - | ||
| 3 | -Mmad计算辅助配置接口列表如下: | ||
| 4 | - | ||
| 5 | -- **[SetMMColumnMajor/SetMMRowMajor](../../cube_compute_ISASI/mmad_compute_aux_config/SetMMColumnMajor-SetMMRowMajor.md)** | ||
| 6 | - | ||
| 7 | -- **[SetHF32Mode](../../cube_compute_ISASI/mmad_compute_aux_config/SetHF32Mode.md)** | ||
| 8 | - | ||
| 9 | -- **[SetHF32TransMode](../../cube_compute_ISASI/mmad_compute_aux_config/SetHF32TransMode.md)** | ||
| @@ -1,87 +0,0 @@ | |||
| 1 | -# UnitFlag | ||
| 2 | - | ||
| 3 | -## 特性说明 | ||
| 4 | - | ||
| 5 | -unitFlag的核心功能体现为:Mmad和Copy接口引入了单元标志(unit-flag)机制,通过以内存块为粒度实现精细化的数据同步,从而有效降低同步延迟,提升系统整体性能。当UnitFlag开关打开后,对于L0C Buffer中的每个内存块(512B),提供一个单元标志位,用于指示该块是否可读或可写。 | ||
| 6 | - | ||
| 7 | -Mmad和Copy接口设置unitFlag值为2/3后,系统会启动单元标志位。 | ||
| 8 | - | ||
| 9 | -当`mmadParams.unitFlag`为`2(0b10)`时,使能unitFlag功能,在硬件执行完指令后,不改变单元标志位。 | ||
| 10 | - | ||
| 11 | -- 对于写操作(Mmad接口),如果单元标志位0,则硬件直接写入L0C Buffer,否则,如果单元标志位为1,则写操作会等待直到单元标志变为0,执行完成后将单元标志位保持为0。 | ||
| 12 | -- 对于读操作(Copy接口),如果单元标志位1,则硬件直接读取L0C Buffer,否则,如果单元标志位为0,则读操作为等待直到单元标志变为1,执行完成后将单元标志位保持为1。 | ||
| 13 | - | ||
| 14 | -当`mmadParams.unitFlag`为`3(0b11)`时,使能unitFlag功能,在硬件执行完指令后,改变单元标志位。 | ||
| 15 | - | ||
| 16 | -- 对于写操作(Mmad接口),如果单元标志位0,则硬件直接写入L0C Buffer,否则,如果单元标志位为1,则写操作会等待直到单元标志变为0,执行完成后将单元标志位设置成1。 | ||
| 17 | -- 对于读操作(Copy接口),如果单元标志位1,则硬件直接读取L0C Buffer,否则,如果单元标志位为0,则读操作为等待直到单元标志变为1,执行完成后将单元标志位设置成0。 | ||
| 18 | - | ||
| 19 | -根据上述特性,如果用户在进行A矩阵维度为128×1024、B矩阵维度为1024×128的矩阵乘计算时,需要沿着K轴进行迭代循环,假设每次迭代K长度为128,则需要迭代8次,此时8次Mmad指令对应1次Fixpipe指令。 | ||
| 20 | - | ||
| 21 | -- 前7次Mmad的unitFlag都设置成2,写入后将单元标志位始终为0,保证后续Mmad可以写入L0C Buffer。 | ||
| 22 | -- 最后1次Mmad设置成3,写入后将单元标志位设置成1,保证Fixpipe可以读取L0C Buffer。 | ||
| 23 | -- Fixpipe的unitFlag设置为3,读取后将单元标志位设置为0,保证后续Mmad接口可以顺利写入L0C Buffer数据。 | ||
| 24 | - | ||
| 25 | -如果用户需要单次Mmad的结果分多次搬出时,譬如Mmad计算结果的L0C Buffer为M\(128\) × N\(256\),沿N轴分两次搬出,这样一次Mmad会对应两次Fixpipe。 | ||
| 26 | - | ||
| 27 | -- Mmad的时候需要设置unitFlag = 3,保证Fixpipe可以读取L0C Buffer数据。 | ||
| 28 | -- 每一次Fixpipe的unitFlag都设置为3,读取后将单元标志位设置为0,保证后续其他Mmad接口在复用这块L0C Buffer地址时可以顺利写入数据。 | ||
| 29 | - | ||
| 30 | -当开启unitFlag后,Mmad和Fixpipe会对同一块分形的L0C Buffer进行读写操作,因此Mmad计算和Fixpipe保持一致的读写顺序,有助于获得更优的性能表现。 | ||
| 31 | - | ||
| 32 | -在调用Mmad接口时,需要通过[SetMMColumnMajor/SetMMRowMajor](../../cube_compute_ISASI/mmad_compute_aux_config/SetMMColumnMajor-SetMMRowMajor.md)接口设置Mmad的计算方向。当Fixpipe使能了NZ2ND或ChannelMerge等layout变换时,需将Mmad的计算方向设置为N方向优先,即调用`SetMMRowMajor`。反之,若未使用这些特性,则应将计算方向设置为M方向优先,即调用`SetMMColumnMajor`。 | ||
| 33 | - | ||
| 34 | -**图1** Mmad和Fixpipe同时沿M方向写/读 | ||
| 35 | - | ||
| 36 | - | ||
| 37 | - | ||
| 38 | -## 特性约束 | ||
| 39 | - | ||
| 40 | -- Mmad和Copy接口均提供了unitFlag参数来控制该功能的启用,需确保两者同步开启,才能正常生效。 | ||
| 41 | -- 当希望控制同一块L0C Buffer内存空间能持续只被多条Mmad或多条Fixpipe指令操作时,需将对应的前n-1条指令的unitFlag值设置为2,维持被操作内存空间的持续占用状态,最后一条指令设置为3,解除被占用状态。 | ||
| 42 | -- 当启用unitFlag功能后,建议Mmad的计算数据量与Fixpipe搬出的数据量保持一致。若Mmad计算了大块数据(M × N = 128 × 128),但Fixpipe只搬出了其中一部分数据(M × N = 64 × 64),则可能会导致执行异常,可以通过`SetFixPipeConfig`接口重置L0C Buffer的状态。 | ||
| 43 | - | ||
| 44 | -## 相关接口 | ||
| 45 | - | ||
| 46 | -- [Mmad](../mmad_compute/Mmad.md) | ||
| 47 | -- [Copy(L0C到GM数据搬运)](../cube_compute_store/Copy_L0CToGM.md) | ||
| 48 | -- [Copy(L0C到UB数据搬运)](../cube_compute_store/Copy_L0CToUB.md) | ||
| 49 | -- [SetFixPipeConfig](../../cube_compute_ISASI/cube_store_aux_config/SetFixPipeConfig.md) | ||
| 50 | -- [SetMMColumnMajor/SetMMRowMajor](../../cube_compute_ISASI/mmad_compute_aux_config/SetMMColumnMajor-SetMMRowMajor.md) | ||
| 51 | - | ||
| 52 | -## 沿K轴迭代循环使用示例片段 | ||
| 53 | - | ||
| 54 | -以下示例仅展示`unitFlag`在K轴迭代循环中的设置方式,省略张量构造和参数初始化。 | ||
| 55 | - | ||
| 56 | -```cpp | ||
| 57 | -using namespace AscendC::Te; | ||
| 58 | - | ||
| 59 | -// 调用kRound次Mmad。 | ||
| 60 | -for (auto kIndex = 0; kIndex < kRound; ++kIndex) { | ||
| 61 | - if (kIndex != kRound - 1) { | ||
| 62 | - // 前kRound-1次迭代设置为2,保证Mmad在K迭代循环中可以一直写入L0C Buffer。 | ||
| 63 | - mmadParams.unitFlag = 2; | ||
| 64 | - } else { | ||
| 65 | - // 最后一次迭代设置为3,将单元标志位设成1,保证Fixpipe可以读L0C Buffer。 | ||
| 66 | - mmadParams.unitFlag = 3; | ||
| 67 | - } | ||
| 68 | - auto mmadAtom = MakeMmad(MmadOperation{}).with(mmadParams); | ||
| 69 | - Mmad(mmadAtom, l0C, l0A, l0B); | ||
| 70 | -} | ||
| 71 | -// Fixpipe一次搬出。 | ||
| 72 | -// Fixpipe的unitFlag设置为3,读取后将单元标志位设置为0,保证后续Mmad接口可以顺利写入L0C Buffer数据。 | ||
| 73 | -FixpipeParams fixpipeParams; | ||
| 74 | -fixpipeParams.unitFlag = 3; | ||
| 75 | -auto fixpipeAtom = MakeCopy(CopyL0C2GM{}).with(fixpipeParams); | ||
| 76 | -Copy(fixpipeAtom, gm, l0C); | ||
| 77 | - | ||
| 78 | -``` | ||
| 79 | - | ||
| 80 | -**表1** 性能示例说明(以输入数据类型half为例,无业务实测表示忽略指令的前后序操作,只考虑单指令性能,包含带宽延迟等开销) | ||
| 81 | - | ||
| 82 | -| M | N | K | UnitFlag | LOOP_COUNT | Mmad理论值(cycle) | Mmad无业务实测值(cycle) | | ||
| 83 | -| --- | --- | --- | --- | --- | --- | --- | | ||
| 84 | -| 128 | 256 | 512 | Enable | 8 | 4156 | 4209 | | ||
| 85 | -| 128 | 256 | 512 | Disable | 8 | 4156 | 4225 | | ||
| 86 | -| 128 | 128 | 512 | Enable | 8 | 2108 | 2172 | | ||
| 87 | -| 128 | 128 | 512 | Disable | 8 | 2108 | 2172 | | ||
| @@ -1,11 +0,0 @@ | |||
| 1 | -# Mmad计算关键特性说明<a name="ZH-CN_TOPIC_00000025121725631"></a> | ||
| 2 | - | ||
| 3 | -本节介绍Mmad矩阵乘计算中的GEMV、HF32和UnitFlag等关键特性,帮助理解不同计算模式、精度模式和细粒度同步机制。 | ||
| 4 | - | ||
| 5 | -阅读本节前,建议先了解[Mmad](../mmad_compute/Mmad.md)接口和[矩阵计算分形介绍](../cube_compute_fractal_intro/cube_compute_fractal_intro.md)。 | ||
| 6 | - | ||
| 7 | -- **[GEMV](GEMV.md)** | ||
| 8 | - | ||
| 9 | -- **[HF32](HF32.md)** | ||
| 10 | - | ||
| 11 | -- **[UnitFlag](UnitFlag.md)** | ||
| @@ -1,40 +0,0 @@ | |||
| 1 | -# 数据结构(TensorAPI,试验特性) | ||
| 2 | - | ||
| 3 | -- **[内置数据类型](../data_structures/builtin_data_types.md)** | ||
| 4 | - | ||
| 5 | -- **[精度转换](../data_structures/precision_conversion.md)** | ||
| 6 | - | ||
| 7 | -- **Layout相关基础数据结构** | ||
| 8 | - - **[Layout和层次化表述法](layout_structure/Layout_hierarchical_representation.md)** | ||
| 9 | - - **[Layout](layout_structure/Layout.md)** | ||
| 10 | - - **[Shape](layout_structure/Shape.md)** | ||
| 11 | - - **[Stride](layout_structure/Stride.md)** | ||
| 12 | - - **[Coord](layout_structure/Coord.md)** | ||
| 13 | - - **Layout相关接口** | ||
| 14 | - - **[MakeLayout](layout_structure/MakeLayout.md)** | ||
| 15 | - - **[MakeFrameLayout](layout_structure/MakeFrameLayout.md)** | ||
| 16 | - - **[MakeShape](layout_structure/MakeShape.md)** | ||
| 17 | - - **[MakeStride](layout_structure/MakeStride.md)** | ||
| 18 | - - **[MakeCoord](layout_structure/MakeCoord.md)** | ||
| 19 | - - **[GetShape](layout_structure/GetShape.md)** | ||
| 20 | - - **[GetStride](layout_structure/GetStride.md)** | ||
| 21 | - - **[Get](layout_structure/Get.md)** | ||
| 22 | - - **[Select](layout_structure/Select.md)** | ||
| 23 | - - **[Squeeze](layout_structure/Squeeze.md)** | ||
| 24 | - - **[Capacity](layout_structure/Capacity.md)** | ||
| 25 | - - **[Size](layout_structure/Size.md)** | ||
| 26 | - - **[Coshape](layout_structure/Coshape.md)** | ||
| 27 | - - **[Cosize](layout_structure/Cosize.md)** | ||
| 28 | - - **[Rank](layout_structure/Rank.md)** | ||
| 29 | - | ||
| 30 | -- **Tensor相关数据结构** | ||
| 31 | - - **[Tensor](tensor_structure/Tensor.md)** | ||
| 32 | - - **[Pointer](tensor_structure/Pointer.md)** | ||
| 33 | - - **[ViewEngine](tensor_structure/ViewEngine.md)** | ||
| 34 | - - **Tensor相关接口** | ||
| 35 | - - **[MakeTensor](tensor_structure/MakeTensor.md)** | ||
| 36 | - - **[MakeMemPtr](tensor_structure/MakeMemPtr.md)** | ||
| 37 | - - **[Slice](tensor_structure/Slice.md)** | ||
| 38 | - | ||
| 39 | -- **工具接口** | ||
| 40 | - - **[GetLayoutPattern](utils/GetLayoutPattern.md)** | ||
| @@ -1,29 +0,0 @@ | |||
| 1 | -# Coord | ||
| 2 | - | ||
| 3 | -> [!NOTE]说明 | ||
| 4 | ->本接口为试验接口,在后续版本中可能会调整或改进,不保证后续兼容性。请开发者在使用过程中关注后续版本更新。 | ||
| 5 | - | ||
| 6 | -Coord用于定义张量的坐标,用于访问张量中特定位置的元素。 | ||
| 7 | - | ||
| 8 | -## 需要包含的头文件 | ||
| 9 | - | ||
| 10 | -```cpp | ||
| 11 | -#include "tensor_api/tensor.h" | ||
| 12 | -``` | ||
| 13 | - | ||
| 14 | -## 原型定义 | ||
| 15 | - | ||
| 16 | -```cpp | ||
| 17 | -template <typename... Coords> | ||
| 18 | -using Coord = Std::tuple<Coords...>; | ||
| 19 | -``` | ||
| 20 | - | ||
| 21 | -## 参数说明 | ||
| 22 | - | ||
| 23 | -| 参数名 | 输入/输出 | 描述 | | ||
| 24 | -|--------|----------|------| | ||
| 25 | -| Coords... | 输入 | 可变参数模板,表示各维度的坐标。| | ||
| 26 | - | ||
| 27 | -## API映射关系 | ||
| 28 | - | ||
| 29 | -Coord通过[MakeCoord](MakeCoord.md)函数创建,可通过[Crd2Idx](../../aux_data_structures/Coordinate/Crd2Idx.md)函数进行多维坐标到线性坐标的转换,可作为参数传入到Layout的[operator()](Layout.md)成员函数,Tensor的[Slice](../tensor_structure/Tensor.md)成员函数以及[Slice](../tensor_structure/Slice.md)接口中进行张量的偏移以及切片操作。 | ||
| @@ -1,323 +0,0 @@ | |||
| 1 | -# Layout和层次化表述法 | ||
| 2 | - | ||
| 3 | -## Layout | ||
| 4 | - | ||
| 5 | -我们使用Shape和Stride来表示Layout排布格式,例如下图中的行优先和列优先排布。 | ||
| 6 | - | ||
| 7 | -Shape用于表达Tensor形状,Stride则用于区分不同的排布方式。 | ||
| 8 | - | ||
| 9 | -- 行优先:Shape(2, 4),Stride(4, 1) | ||
| 10 | -- 列优先:Shape(2, 4),Stride(1, 2) | ||
| 11 | - | ||
| 12 | -图中每个方格中的数字表示该位置元素在内存中按顺序排列时的下标。对于相同的矩阵位置,排布方式不同时,其在内存中的顺序可能不同。例如,矩阵坐标(1, 0)在行优先和列优先的情况下,对应元素在内存中的顺序分别是4和1。 | ||
| 13 | - | ||
| 14 | -**图1** 行优先排布 | ||
| 15 | - | ||
| 16 | - | ||
| 17 | - | ||
| 18 | -**图2** 列优先排布 | ||
| 19 | - | ||
| 20 | - | ||
| 21 | - | ||
| 22 | -## 层次化表述法 | ||
| 23 | - | ||
| 24 | -通常Shape或Stride中的元素是一个单独的整数,但遇到一些复杂的内存排布情况时,普通二维表述可能无法准确表达,因此这里采用[层次化表述法](https://mgarland.org/papers/2023/graphene/)。在这种方式中,元素也可以是一个元组。元组的第一个元素用于描述不同行层次中的矩阵行数,第二个元素用于描述不同层次中的矩阵列数。 | ||
| 25 | - | ||
| 26 | -例如在下图中,Layout的Shape和Stride分别为: | ||
| 27 | - | ||
| 28 | -- Shape((2, 3), (2, 4)) | ||
| 29 | -- Stride((1, 4), (2, 12)) | ||
| 30 | - | ||
| 31 | -**图3** 层次化表述法 | ||
| 32 | - | ||
| 33 | - | ||
| 34 | - | ||
| 35 | -图中展示了两层矩阵:内层矩阵为内部用灰色线包裹的矩阵,外层矩阵为将内层矩阵视为一个元素时,用黑色线包裹的矩阵。 | ||
| 36 | - | ||
| 37 | -Shape的第一个元素描述行方向的形状,(2,3)表示内层矩阵和外层矩阵的行数分别为2和3;Shape的第二个元素描述列方向的形状,(2,4)表示内层矩阵和外层矩阵的列数分别为2和4。 | ||
| 38 | - | ||
| 39 | -Stride中的每个元素与Shape中的元素对应,表示该对应维度下,相邻元素首地址在内存地址上的间隔。图片中用箭头表示了每个维度相邻元素的首地址间隔。 | ||
| 40 | - | ||
| 41 | -## 常见的Layout分形 | ||
| 42 | - | ||
| 43 | -在基于Ascend C进行矩阵编程的场景中,会用到以下几种常用的Layout。这些格式都采用如上文介绍的层次化表述法来表达,要求有内外层两层矩阵,具体表达方式如下,其中_x是`Std::Int<x>`的简写形式,比如_16表示类型`Std::Int<16>`,值16保存在类型中: | ||
| 44 | - | ||
| 45 | -```cpp | ||
| 46 | -Layout = ((Shape): (Stride)) | ||
| 47 | -Shape = ((ShapeRow0, ShapeRow1), (ShapeColumn0, ShapeColumn1)) | ||
| 48 | -Stride = ((StrideRow0, StrideRow1), (StrideColumn0, StrideColumn1)) | ||
| 49 | -``` | ||
| 50 | - | ||
| 51 | -- NZ Layout | ||
| 52 | - | ||
| 53 | - NZ Layout格式的ShapeRow0、ShapeColumn0为固定值。内层分形的Shape为16 * (32Byte / sizeof(T)),StrideRow0、StrideColumn0也为固定值,即内层分形按Z字形组织,外层分形按N字形组织,因此StrideColumn1需要满足按整块对齐的要求。 | ||
| 54 | - | ||
| 55 | - ```cpp | ||
| 56 | - Layout = ((Shape) : (Stride)) | ||
| 57 | - Shape = ((_16{}, ShapeRow1), (_32{} / sizeof(T), ShapeColumn1)) | ||
| 58 | - Stride = ((_32{} / sizeof(T), StrideRow1), (_1{}, StrideColumn1)) | ||
| 59 | - // StrideColumn1应满足: | ||
| 60 | - // StrideColumn1 % (ShapeRow0 * ShapeColumn0) == 0 | ||
| 61 | - ``` | ||
| 62 | - | ||
| 63 | - **图4** NZ Layout | ||
| 64 | -  | ||
| 65 | - | ||
| 66 | - 下面是一个连续的NZ Layout示例,其中C0_ELEMENT =_32{} / sizeof(T)。 | ||
| 67 | - | ||
| 68 | - ```cpp | ||
| 69 | - Layout = ((Shape) : (Stride)) | ||
| 70 | - Shape = ((_16{}, ceil_div(row, _16{})), (C0_ELEMENT, ceil_div(column, C0_ELEMENT))) | ||
| 71 | - Stride = ((C0_ELEMENT, C0_ELEMENT * _16{}), (_1{}, C0_ELEMENT * ceil_align(row, _16{}))) | ||
| 72 | - ``` | ||
| 73 | - | ||
| 74 | -- ZN Layout | ||
| 75 | - | ||
| 76 | - ZN Layout格式的ShapeRow0、ShapeColumn0为固定值。内层分形的Shape为(32Byte / sizeof(T))* 16,StrideRow0、StrideColumn0也为固定值,即内层分形按N字形组织,外层分形按Z字形组织,因此StrideRow1需要满足按整块对齐的要求。 | ||
| 77 | - | ||
| 78 | - ```cpp | ||
| 79 | - Layout = ((Shape) : (Stride)) | ||
| 80 | - Shape = ((C0_ELEMENT, ShapeRow1), (_16{}, ShapeColumn1)) | ||
| 81 | - Stride = ((_1{}, StrideRow1), (C0_ELEMENT, StrideColumn1)) | ||
| 82 | - // StrideRow1应满足: | ||
| 83 | - // StrideRow1 % (ShapeRow0 * ShapeColumn0) == 0 | ||
| 84 | - ``` | ||
| 85 | - | ||
| 86 | - **图5** ZN Layout | ||
| 87 | -  | ||
| 88 | - | ||
| 89 | - 下面是一个连续的ZN Layout示例,其中C0_ELEMENT =_32{} / sizeof(T)。 | ||
| 90 | - | ||
| 91 | - ```cpp | ||
| 92 | - Layout = ((Shape) : (Stride)) | ||
| 93 | - Shape = ((C0_ELEMENT, ceil_div(row, C0_ELEMENT)), (_16{}, ceil_div(column, _16{}))) | ||
| 94 | - Stride = ((_1{}, C0_ELEMENT * ceil_align(column, _16{})), (C0_ELEMENT, C0_ELEMENT * _16{})) | ||
| 95 | - ``` | ||
| 96 | - | ||
| 97 | -- DNExt Layout | ||
| 98 | - | ||
| 99 | - DNExt Layout格式的ShapeRow0、ShapeColumn0为固定值,即内层分形固定为1 * 1。StrideRow0、StrideColumn0也固定为0,表示内层只有一个元素,没有额外的步长概念。外层按列优先方式连续存储,因此StrideColumn1等于行数。 | ||
| 100 | - | ||
| 101 | - ```cpp | ||
| 102 | - Layout = ((Shape) : (Stride)) | ||
| 103 | - Shape = ((_1{}, ShapeRow1), (_1{}, ShapeColumn1)) | ||
| 104 | - Stride = ((_0{}, _1{}), (_0{}, StrideColumn1)) | ||
| 105 | - ``` | ||
| 106 | - | ||
| 107 | - **图6** DNExt Layout | ||
| 108 | -  | ||
| 109 | - | ||
| 110 | - 下面是一个连续的DNExt Layout示例。 | ||
| 111 | - | ||
| 112 | - ```cpp | ||
| 113 | - Layout = ((Shape) : (Stride)) | ||
| 114 | - Shape = ((_1{}, row), (_1{}, column)) | ||
| 115 | - Stride = ((_0{}, _1{}), (_0{}, row)) | ||
| 116 | - ``` | ||
| 117 | - | ||
| 118 | -- NDExt Layout | ||
| 119 | - | ||
| 120 | - NDExt Layout格式的ShapeRow0、ShapeColumn0为固定值,即内层分形固定为1 * 1。StrideRow0、StrideColumn0也固定为0,表示内层只有一个元素,没有额外的步长概念。外层按行优先方式连续存储,因此StrideRow1等于列数,StrideColumn1固定为1。 | ||
| 121 | - | ||
| 122 | - ```cpp | ||
| 123 | - Layout = ((Shape) : (Stride)) | ||
| 124 | - Shape = ((_1{}, ShapeRow1), (_1{}, ShapeColumn1)) | ||
| 125 | - Stride = ((_0{}, StrideRow1), (_0{}, _1{})) | ||
| 126 | - ``` | ||
| 127 | - | ||
| 128 | - **图7** NDExt Layout | ||
| 129 | -  | ||
| 130 | - | ||
| 131 | - 下面是一个连续的NDExt Layout示例。 | ||
| 132 | - | ||
| 133 | - ```cpp | ||
| 134 | - Layout = ((Shape) : (Stride)) | ||
| 135 | - Shape = ((_1{}, row), (_1{}, column)) | ||
| 136 | - Stride = ((_0{}, column), (_0{}, _1{})) | ||
| 137 | - ``` | ||
| 138 | - | ||
| 139 | -- DN Layout | ||
| 140 | - | ||
| 141 | - DN Layout是一种二维列优先排布格式。从层次化表述法角度看,它可以视为只有外层矩阵的特例,其中行方向步长固定为1,列方向步长等于行数。 | ||
| 142 | - | ||
| 143 | - ```cpp | ||
| 144 | - Layout = ((Shape) : (Stride)) | ||
| 145 | - Shape = (ShapeRow, ShapeColumn) | ||
| 146 | - Stride = (_1{}, ShapeRow) | ||
| 147 | - ``` | ||
| 148 | - | ||
| 149 | - 下面是一个连续的DN Layout示例。 | ||
| 150 | - | ||
| 151 | - ```cpp | ||
| 152 | - Layout = ((Shape) : (Stride)) | ||
| 153 | - Shape = (row, column) | ||
| 154 | - Stride = (_1{}, row) | ||
| 155 | - ``` | ||
| 156 | - | ||
| 157 | -- ND Layout | ||
| 158 | - | ||
| 159 | - ND Layout是一种二维行优先排布格式。从层次化表述法角度看,它可以视为只有外层矩阵的特例,其中列方向步长固定为1,行方向步长等于列数。 | ||
| 160 | - | ||
| 161 | - ```cpp | ||
| 162 | - Layout = ((Shape) : (Stride)) | ||
| 163 | - Shape = (ShapeRow, ShapeColumn) | ||
| 164 | - Stride = (ShapeColumn, _1{}) | ||
| 165 | - ``` | ||
| 166 | - | ||
| 167 | - 下面是一个连续的ND Layout示例。 | ||
| 168 | - | ||
| 169 | - ```cpp | ||
| 170 | - Layout = ((Shape) : (Stride)) | ||
| 171 | - Shape = (row, column) | ||
| 172 | - Stride = (column, _1{}) | ||
| 173 | - ``` | ||
| 174 | - | ||
| 175 | -- ZZ Layout | ||
| 176 | - | ||
| 177 | - ZZ Layout格式的ShapeRow0、ShapeColumn0为固定值。内层分形的Shape与NZ Layout一致,StrideRow0、StrideColumn0也为固定值,即内层分形按Z字形组织,外层分形同样按Z字形组织,因此列方向连续,行方向跨度由整行分形块数决定。 | ||
| 178 | - | ||
| 179 | - ```cpp | ||
| 180 | - Layout = ((Shape) : (Stride)) | ||
| 181 | - Shape = ((_16{}, ShapeRow1), (C0_ELEMENT, ShapeColumn1)) | ||
| 182 | - Stride = ((C0_ELEMENT, StrideRow1), (_1{}, C0_ELEMENT * _16{})) | ||
| 183 | - ``` | ||
| 184 | - | ||
| 185 | - 下面是一个连续的ZZ Layout示例,其中C0_ELEMENT =_32{} / sizeof(T)。 | ||
| 186 | - | ||
| 187 | - ```cpp | ||
| 188 | - Layout = ((Shape) : (Stride)) | ||
| 189 | - Shape = ((_16{}, ceil_div(row, _16{})), (C0_ELEMENT, ceil_div(column, C0_ELEMENT))) | ||
| 190 | - Stride = ((C0_ELEMENT, _16{} * ceil_align(column, C0_ELEMENT)), (_1{}, C0_ELEMENT * _16{})) | ||
| 191 | - ``` | ||
| 192 | - | ||
| 193 | -- NN Layout | ||
| 194 | - | ||
| 195 | - NN Layout格式的ShapeRow0、ShapeColumn0为固定值,仅用于fp8_e8m0_t场景。内层分形固定为2 * 16,StrideRow0、StrideColumn0也为固定值,即内层分形按N字形组织。外层分形同样按N字形组织。 | ||
| 196 | - | ||
| 197 | - ```cpp | ||
| 198 | - Layout = ((Shape) : (Stride)) | ||
| 199 | - Shape = ((_2{}, ShapeRow1), (_16{}, ShapeColumn1)) | ||
| 200 | - Stride = ((_1{}, _32{}), (_2{}, StrideColumn1)) | ||
| 201 | - ``` | ||
| 202 | - | ||
| 203 | - 下面是一个连续的NN Layout示例。 | ||
| 204 | - | ||
| 205 | - ```cpp | ||
| 206 | - Layout = ((Shape) : (Stride)) | ||
| 207 | - Shape = ((_2{}, row / _2{}), (_16{}, ceil_div(column, _16{}))) | ||
| 208 | - Stride = ((_1{}, _32{}), (_2{}, row * _16{})) | ||
| 209 | - ``` | ||
| 210 | - | ||
| 211 | -- ScaleAND Layout | ||
| 212 | - | ||
| 213 | - ScaleAND Layout格式的ShapeRow0、ShapeColumn0为固定值,仅支持fp8_e8m0_t的scaleA数据,且要求C0_ELEMENT == 2。其物理布局与连续的NDExt Layout一致,即内层固定为1 * 1,外层按行优先方式连续存储,语义上用于描述scaleA不转置的场景。 | ||
| 214 | - | ||
| 215 | - ```cpp | ||
| 216 | - Layout = ((Shape) : (Stride)) | ||
| 217 | - Shape = ((_1{}, ShapeRow1), (_1{}, ShapeColumn1)) | ||
| 218 | - Stride = ((_0{}, StrideRow1), (_0{}, _1{})) | ||
| 219 | - ``` | ||
| 220 | - | ||
| 221 | - 下面是一个连续的ScaleAND Layout示例。 | ||
| 222 | - | ||
| 223 | - ```cpp | ||
| 224 | - Layout = ((Shape) : (Stride)) | ||
| 225 | - Shape = ((_1{}, row), (_1{}, column)) | ||
| 226 | - Stride = ((_0{}, column), (_0{}, _1{})) | ||
| 227 | - ``` | ||
| 228 | - | ||
| 229 | -- ScaleADN Layout | ||
| 230 | - | ||
| 231 | - ScaleADN Layout格式的ShapeRow0、ShapeColumn0为固定值,仅支持fp8_e8m0_t的scaleA数据,且要求C0_ELEMENT == 2。其列方向内层分形固定为2,行方向内层固定为1,外层按列优先方式组织。语义上用于描述scaleA转置的场景。 | ||
| 232 | - | ||
| 233 | - ```cpp | ||
| 234 | - Layout = ((Shape) : (Stride)) | ||
| 235 | - Shape = ((_1{}, ShapeRow1), (_2{}, ShapeColumn1)) | ||
| 236 | - Stride = ((_0{}, _2{}), (_1{}, StrideColumn1)) | ||
| 237 | - ``` | ||
| 238 | - | ||
| 239 | - 下面是一个连续的ScaleADN Layout示例。 | ||
| 240 | - | ||
| 241 | - ```cpp | ||
| 242 | - Layout = ((Shape) : (Stride)) | ||
| 243 | - Shape = ((_1{}, row), (_2{}, column / _2{})) | ||
| 244 | - Stride = ((_0{}, _2{}), (_1{}, _2{} * row)) | ||
| 245 | - ``` | ||
| 246 | - | ||
| 247 | -- ScaleBND Layout | ||
| 248 | - | ||
| 249 | - ScaleBND Layout格式的ShapeRow0、ShapeColumn0为固定值,仅支持fp8_e8m0_t的scaleB数据,且要求C0_ELEMENT == 2。其行方向内层分形固定为2,列方向内层固定为1,外层按行优先方式组织。语义上用于描述scaleB转置的场景。 | ||
| 250 | - | ||
| 251 | - ```cpp | ||
| 252 | - Layout = ((Shape) : (Stride)) | ||
| 253 | - Shape = ((_2{}, ShapeRow1), (_1{}, ShapeColumn1)) | ||
| 254 | - Stride = ((_1{}, StrideRow1), (_0{}, _2{})) | ||
| 255 | - ``` | ||
| 256 | - | ||
| 257 | - 下面是一个连续的ScaleBND Layout示例。 | ||
| 258 | - | ||
| 259 | - ```cpp | ||
| 260 | - Layout = ((Shape) : (Stride)) | ||
| 261 | - Shape = ((_2{}, row / _2{}), (_1{}, column)) | ||
| 262 | - Stride = ((_1{}, _2{} * column), (_0{}, _2{})) | ||
| 263 | - ``` | ||
| 264 | - | ||
| 265 | -- ScaleBDN Layout | ||
| 266 | - | ||
| 267 | - ScaleBDN Layout格式的ShapeRow0、ShapeColumn0为固定值,仅支持fp8_e8m0_t的scaleB数据,且要求C0_ELEMENT == 2。其物理布局与连续的DNExt Layout一致,即内层固定为1 * 1,外层按列优先方式连续存储,语义上用于描述scaleB不转置的场景。 | ||
| 268 | - | ||
| 269 | - ```cpp | ||
| 270 | - Layout = ((Shape) : (Stride)) | ||
| 271 | - Shape = ((_1{}, ShapeRow1), (_1{}, ShapeColumn1)) | ||
| 272 | - Stride = ((_0{}, _1{}), (_0{}, StrideColumn1)) | ||
| 273 | - ``` | ||
| 274 | - | ||
| 275 | - 下面是一个连续的ScaleBDN Layout示例。 | ||
| 276 | - | ||
| 277 | - ```cpp | ||
| 278 | - Layout = ((Shape) : (Stride)) | ||
| 279 | - Shape = ((_1{}, row), (_1{}, column)) | ||
| 280 | - Stride = ((_0{}, _1{}), (_0{}, row)) | ||
| 281 | - ``` | ||
| 282 | - | ||
| 283 | -MX scaleA要求在矩阵GM上按照ScaleAND Layout或ScaleADN Layout格式排布,在L1上需满足按行读取需求,即按照ZZ Layout格式排布。如下图所示,若GM上scaleA矩阵为ScaleAND或者ScaleADN分形排布,搬运到L1后分形为ZZ排布。 | ||
| 284 | - | ||
| 285 | -**图8** scaleA矩阵在不同位置上的排布格式 | ||
| 286 | - | ||
| 287 | - | ||
| 288 | -MX scaleB要求在矩阵GM上按照ScaleBND Layout或ScaleBDN Layout格式排布,在L1上需满足按列读取需求,即按照NN Layout格式排布。如下图所示,若GM上scaleB矩阵为ScaleBND或者ScaleBDN分形排布,搬运到L1后分形为NN排布。 | ||
| 289 | - | ||
| 290 | -**图9** scaleB矩阵在不同位置上的排布格式 | ||
| 291 | - | ||
| 292 | - | ||
| 293 | -## 卷积特征图Layout | ||
| 294 | - | ||
| 295 | -卷积特征图Layout使用扁平的多维Shape和行主序Stride表示,不使用矩阵分形的层次化Shape。支持的LayoutPattern如下。 | ||
| 296 | - | ||
| 297 | -| LayoutPattern | Shape | Stride | | ||
| 298 | -| :--- | :--- | :--- | | ||
| 299 | -| `NCHWLayoutPtn` | `(N, C, H, W)` | `(C * H * W, H * W, W, 1)` | | ||
| 300 | -| `NHWCLayoutPtn` | `(N, H, W, C)` | `(H * W * C, W * C, C, 1)` | | ||
| 301 | -| `NC1HWC0LayoutPtn` | `(N, C1, H, W, C0)` | `(C1 * H * W * C0, H * W * C0, W * C0, C0, 1)` | | ||
| 302 | - | ||
| 303 | -`NC1HWC0LayoutPtn`将通道维C拆分为C1和C0,需要满足`C = C1 * C0`。上述Layout可通过[MakeFrameLayout](MakeFrameLayout.md)构造。 | ||
| 304 | - | ||
| 305 | -## Layout分形结构数据表 | ||
| 306 | - | ||
| 307 | -每种分形对应的Layout格式如下表所示,其中T指的是支持的数据类型中除fp8_e8m0_t之外的数据类型,C0_ELEMENT =_32{} / sizeof(T);特殊情况下当T为fp4x2_e2m1_t或fp4x2_e1m2_t时,C0_ELEMENT =_64{}。 | ||
| 308 | - | ||
| 309 | -| LayoutFormatPattern | 类型 | ShapeRow0 | ShapeRow1 | ShapeColumn0 | ShapeColumn1 | StrideRow0 | StrideRow1 | StrideColumn0 | StrideColumn1 | | ||
| 310 | -|-------------|------|-----------|-----------|--------------|--------------|------------|------------|---------------|---------------| | ||
| 311 | -| NZLayoutPtn | T | _16{} | ceil_div(row,_16{}) | C0_ELEMENT | ceil_div(column, C0_ELEMENT) | C0_ELEMENT | C0_ELEMENT *_16{} | _1{} | C0_ELEMENT * ceil_align(row, _16{}) | | ||
| 312 | -| ZNLayoutPtn | T | C0_ELEMENT | ceil_div(row, C0_ELEMENT) | _16{} | ceil_div(column,_16{}) | _1{} | C0_ELEMENT * ceil_align(column, _16{}) | C0_ELEMENT | C0_ELEMENT *_16{} | | ||
| 313 | -| DNExtLayoutPtn | T | _1{} | row | _1{} | column | _0{} | _1{} | _0{} | row | | ||
| 314 | -| NDExtLayoutPtn | T | _1{} | row | _1{} | column | _0{} | column | _0{} | _1{} | | ||
| 315 | -| DNLayoutPtn | T | row | - | column | - | _1{} | - | row | - | | ||
| 316 | -| NDLayoutPtn | T | row | - | column | - | column | - | _1{} | - | | ||
| 317 | -| ZZLayoutPtn | T | _16{} | ceil_div(row,_16{}) | C0_ELEMENT | ceil_div(column, C0_ELEMENT) | C0_ELEMENT | _16{} * ceil_align(column, C0_ELEMENT) | _1{} | C0_ELEMENT *_16{} | | ||
| 318 | -| ZZLayoutPtn | fp8_e8m0_t | _16{} | ceil_div(row,_16{}) | _2{} | column / _2{} | _2{} | column * _16{} | _1{} | _32{} | | ||
| 319 | -| NNLayoutPtn | fp8_e8m0_t | _2{} | row / _2{} | _16{} | ceil_div(column,_16{}) | _1{} | _32{} | _2{} | row * _16{} | | ||
| 320 | -| ScaleANDLayoutPtn | fp8_e8m0_t | _1{} | row | _1{} | column | _0{} | column | _0{} | _1{} | | ||
| 321 | -| ScaleADNLayoutPtn | fp8_e8m0_t | _1{} | row | _2{} | column / _2{} | _0{} | _2{} | _1{} | _2{} * row | | ||
| 322 | -| ScaleBNDLayoutPtn | fp8_e8m0_t | _2{} | row / _2{} | _1{} | column | _1{} | _2{} * column | _0{} | _2{} | | ||
| 323 | -| ScaleBDNLayoutPtn | fp8_e8m0_t | _1{} | row | _1{} | column | _0{} | _1{} | _0{} | row | | ||
| @@ -1,163 +0,0 @@ | |||
| 1 | -# MakeFrameLayout | ||
| 2 | - | ||
| 3 | -> [!NOTE]说明 | ||
| 4 | ->本接口为试验接口,在后续版本中可能会调整或改进,不保证后续兼容性。请开发者在使用过程中关注后续版本更新。 | ||
| 5 | - | ||
| 6 | -## 产品支持情况 | ||
| 7 | - | ||
| 8 | -<!-- npu="950" id1 --> | ||
| 9 | -- Ascend 950PR/Ascend 950DT:支持 | ||
| 10 | -<!-- end id1 --> | ||
| 11 | -<!-- npu="A3" id2 --> | ||
| 12 | -- Atlas A3 训练系列产品/Atlas A3 推理系列产品:不支持 | ||
| 13 | -<!-- end id2 --> | ||
| 14 | -<!-- npu="910b" id3 --> | ||
| 15 | -- Atlas A2 训练系列产品/Atlas A2 推理系列产品:不支持 | ||
| 16 | -<!-- end id3 --> | ||
| 17 | -<!-- npu="310b" id4 --> | ||
| 18 | -- Atlas 200I/500 A2 推理产品:不支持 | ||
| 19 | -<!-- end id4 --> | ||
| 20 | -<!-- npu="310p" id5 --> | ||
| 21 | -- Atlas 推理系列产品AI Core:不支持 | ||
| 22 | -<!-- end id5 --> | ||
| 23 | -<!-- npu="310p" id6 --> | ||
| 24 | -- Atlas 推理系列产品Vector Core:不支持 | ||
| 25 | -<!-- end id6 --> | ||
| 26 | -<!-- npu="910" id7 --> | ||
| 27 | -- Atlas 训练系列产品:不支持 | ||
| 28 | -<!-- end id7 --> | ||
| 29 | - | ||
| 30 | -## 功能说明 | ||
| 31 | - | ||
| 32 | -需要包含的头文件为:#include "tensor_api/tensor.h"。 | ||
| 33 | - | ||
| 34 | -MakeFrameLayout用于根据标准分形排布模式构造带类型信息的Layout对象。该接口根据构造参数,结合指定的LayoutPattern(排布模式)和LayoutTrait(布局特征参数)计算Shape和Stride,构造Layout对象。除矩阵Layout外,该接口还支持构造卷积场景中的NCHW、NHWC和NC1HWC0格式Layout。该接口也支持在矩阵维度前传入Batch维度,用于构造多Batch矩阵的Layout。 | ||
| 35 | - | ||
| 36 | -LayoutPattern决定数据在内存中的分形排列方式,不同存储位置间的搬运和计算操作要求源/目的张量满足特定的LayoutPattern组合。 | ||
| 37 | - | ||
| 38 | -## 函数原型 | ||
| 39 | - | ||
| 40 | -```cpp | ||
| 41 | -template <typename LayoutPattern, typename TraitType, typename... Args> | ||
| 42 | -__aicore__ inline constexpr decltype(auto) MakeFrameLayout(const Args&... args) | ||
| 43 | -``` | ||
| 44 | - | ||
| 45 | -常用调用形式如下。 | ||
| 46 | - | ||
| 47 | -```cpp | ||
| 48 | -// 构造单个矩阵Layout,m为行数,n为列数。 | ||
| 49 | -auto layout = MakeFrameLayout<LayoutPattern, TraitType>(m, n); | ||
| 50 | - | ||
| 51 | -// 构造Batch矩阵Layout,batch为矩阵个数,m为单个矩阵的行数,n为单个矩阵的列数。 | ||
| 52 | -auto batchLayout = MakeFrameLayout<LayoutPattern, TraitType>(batch, m, n); | ||
| 53 | - | ||
| 54 | -// 构造卷积输入或输出Layout。 | ||
| 55 | -auto nchwLayout = MakeFrameLayout<NCHWLayoutPtn>(n, c, h, w); | ||
| 56 | -auto nhwcLayout = MakeFrameLayout<NHWCLayoutPtn>(n, h, w, c); | ||
| 57 | -auto nc1hwc0Layout = MakeFrameLayout<NC1HWC0LayoutPtn>(n, c1, h, w, c0); | ||
| 58 | -``` | ||
| 59 | - | ||
| 60 | -### 卷积LayoutPattern | ||
| 61 | - | ||
| 62 | -| LayoutPattern | 构造参数 | Shape | Stride | 描述 | | ||
| 63 | -| :--- | :--- | :--- | :--- | :--- | | ||
| 64 | -| `NCHWLayoutPtn` | `n, c, h, w` | `(N, C, H, W)` | `(C * H * W, H * W, W, 1)` | 通道维C位于高度维H和宽度维W之前。 | | ||
| 65 | -| `NHWCLayoutPtn` | `n, h, w, c` | `(N, H, W, C)` | `(H * W * C, W * C, C, 1)` | 通道维C位于最内层。 | | ||
| 66 | -| `NC1HWC0LayoutPtn` | `n, c1, h, w, c0` | `(N, C1, H, W, C0)` | `(C1 * H * W * C0, H * W * C0, W * C0, C0, 1)` | 将通道维C拆分为C1和C0,其中`C = C1 * C0`。 | | ||
| 67 | - | ||
| 68 | -上述Layout均为行主序连续排布,Stride的单位为元素。`NC1HWC0LayoutPtn`的C0由函数参数显式指定,不通过LayoutTrait推导。 | ||
| 69 | - | ||
| 70 | -### LayoutTrait的指定方式 | ||
| 71 | - | ||
| 72 | -LayoutTrait用于指定C0维度基数。MakeFrameLayout支持以下四种传递方式: | ||
| 73 | - | ||
| 74 | -1. **`LayoutTraitDefault<T>`**:根据数据类型T自动计算C0。T仅参与C0推导,不作为LayoutTrait中的数据类型信息保存。 | ||
| 75 | - | ||
| 76 | - ```cpp | ||
| 77 | - MakeFrameLayout<NZLayoutPtn, LayoutTraitDefault<float>>(m, n) | ||
| 78 | - ``` | ||
| 79 | - | ||
| 80 | -2. **C0常量类型**:直接指定C0维度的元素个数。`_8`、`_16`等类型是[Std::Int](../../../../Utils-API/cpp_stdlib/type_traits/integral_constant.md)的简写形式,例如`_16`表示`Std::Int<16>`。 | ||
| 81 | - | ||
| 82 | - ```cpp | ||
| 83 | - MakeFrameLayout<NZLayoutPtn, _16>(m, n) | ||
| 84 | - ``` | ||
| 85 | - | ||
| 86 | -3. **省略第二个模板参数**:在分形构造不需要用户指定C0,或C0由布局模式固定的场景下,可以只传入LayoutPattern。此时接口会根据LayoutPattern使用内置的C0取值。这样的分形有NDLayoutPtn、DNLayoutPtn、DNExtLayoutPtn、NDExtLayoutPtn、ScaleANDLayoutPtn、ScaleADNLayoutPtn、ScaleBNDLayoutPtn、ScaleBDNLayoutPtn。 | ||
| 87 | - | ||
| 88 | - ```cpp | ||
| 89 | - MakeFrameLayout<NDLayoutPtn>(m, n) | ||
| 90 | - ``` | ||
| 91 | - | ||
| 92 | -4. **自定义Trait类型**:当根据数据类型推导C0、直接传入C0常量类型、省略第二个模板参数这三种方式都无法表达目标布局时,可以传入自定义Trait类型。自定义Trait需要提供`C0_ELEMENT`成员,用于表示C0维度的元素个数。 | ||
| 93 | - | ||
| 94 | - ```cpp | ||
| 95 | - struct MyLayoutTrait { | ||
| 96 | - static constexpr auto C0_ELEMENT = Std::Int<16>{}; | ||
| 97 | - }; | ||
| 98 | - | ||
| 99 | - MakeFrameLayout<NZLayoutPtn, MyLayoutTrait>(m, n) | ||
| 100 | - ``` | ||
| 101 | - | ||
| 102 | -为兼容已有代码,也支持`LayoutTrait<T, C0>`写法,其中T仅用于保持源码兼容,实际LayoutTrait只使用C0作为布局特征。 | ||
| 103 | - | ||
| 104 | -## 参数说明 | ||
| 105 | - | ||
| 106 | -| 参数名 | 输入/输出 | 描述 | | ||
| 107 | -| :--- | :---: | :--- | | ||
| 108 | -| LayoutPattern | 输入 | 布局模式模板参数。支持的LayoutPattern及数据排布格式见[Layout和层次化表述法](Layout_hierarchical_representation.md)。 | | ||
| 109 | -| TraitType | 输入 | 第二个模板参数,用于描述C0取值。可传入`LayoutTraitDefault<T>`、C0常量类型、带`C0_ELEMENT`成员的自定义Trait类型或具体数据类型;省略时接口按LayoutPattern使用内置的C0取值。 | | ||
| 110 | -| Args | 输入 | 构造参数。矩阵场景常见为m和n,Batch矩阵场景为batch、m和n。卷积场景根据LayoutPattern传入n、c、h、w或n、c1、h、w、c0。 | | ||
| 111 | - | ||
| 112 | -## 返回值说明 | ||
| 113 | - | ||
| 114 | -返回Layout<ShapeType, StrideType, Std::tuple<LayoutPattern, TraitType>>类型的对象,其中ShapeType和StrideType由LayoutPattern和构造参数在编译期推导。 | ||
| 115 | - | ||
| 116 | -## 约束说明 | ||
| 117 | - | ||
| 118 | -- LayoutPattern必须是已支持的排布模式之一,不支持的模式会触发编译期报错。 | ||
| 119 | -- 构造参数的个数和含义由LayoutPattern决定。常见二维场景传入(m, n)即可。 | ||
| 120 | -- 使用`NC1HWC0LayoutPtn`时,用户需要根据数据类型和后续运算要求显式传入C0,并保证C轴数据符合`C = C1 * C0`。 | ||
| 121 | -- Batch模式传入(batch, m, n),其中m和n表示单个矩阵的行数和列数,batch表示连续排布的矩阵个数。 | ||
| 122 | -- TraitType必须为整型常量、带`C0_ELEMENT`成员的Trait类型或具体数据类型,不支持的类型会触发编译期报错。传入具体数据类型时,该类型仅用于推导C0;Tensor的真实数据类型由`MakeTensor`绑定的内存指针类型决定。 | ||
| 123 | - | ||
| 124 | -## 调用示例 | ||
| 125 | - | ||
| 126 | -```cpp | ||
| 127 | -using namespace AscendC::Te; | ||
| 128 | - | ||
| 129 | -// 构造GM端ND布局张量 | ||
| 130 | -auto layoutGM = MakeFrameLayout<NDExtLayoutPtn, LayoutTraitDefault<float>>(m, n); | ||
| 131 | -auto gmTensor = MakeTensor(MakeMemPtr<Location::GM>(gmAddr), layoutGM); | ||
| 132 | - | ||
| 133 | -// 构造L1端NZ布局张量(L0A/L0B搬运的标准格式) | ||
| 134 | -auto layoutL1 = MakeFrameLayout<NZLayoutPtn, float>(m, n); | ||
| 135 | -auto l1Tensor = MakeTensor(MakeMemPtr<Location::L1>(l1Addr), layoutL1); | ||
| 136 | - | ||
| 137 | -// 省略第二个模板参数构造NZ布局 | ||
| 138 | -auto layoutNZ = MakeFrameLayout<NZLayoutPtn>(m, n); | ||
| 139 | -auto l1TensorNZ = MakeTensor(MakeMemPtr<Location::L1>(l1Addr), layoutNZ); | ||
| 140 | - | ||
| 141 | -// 指定C0元素数构造 | ||
| 142 | -auto layoutC0 = MakeFrameLayout<NZLayoutPtn, _16>(m, n); | ||
| 143 | -auto l1TensorC0 = MakeTensor(MakeMemPtr<Location::L1>(l1Addr), layoutC0); | ||
| 144 | - | ||
| 145 | -// 自定义Trait构造 | ||
| 146 | -struct MyLayoutTrait { | ||
| 147 | - static constexpr auto C0_ELEMENT = Std::Int<16>{}; | ||
| 148 | -}; | ||
| 149 | -auto layoutCustom = MakeFrameLayout<NZLayoutPtn, MyLayoutTrait>(m, n); | ||
| 150 | - | ||
| 151 | -// 构造Batch矩阵布局 | ||
| 152 | -auto layoutBatchNZ = MakeFrameLayout<NZLayoutPtn, float>(batch, m, n); | ||
| 153 | -auto l1BatchTensor = MakeTensor(MakeMemPtr<Location::L1>(l1Addr), layoutBatchNZ); | ||
| 154 | - | ||
| 155 | -// 构造MX场景的scale Batch布局 | ||
| 156 | -auto layoutBatchScaleA = MakeFrameLayout<ScaleANDLayoutPtn>(batch, scaleM, scaleK); | ||
| 157 | -auto gmScaleTensor = MakeTensor(MakeMemPtr<Location::GM>(scaleAddr), layoutBatchScaleA); | ||
| 158 | - | ||
| 159 | -// 构造卷积特征图Layout | ||
| 160 | -auto layoutNCHW = MakeFrameLayout<NCHWLayoutPtn>(n, c, h, w); | ||
| 161 | -auto layoutNHWC = MakeFrameLayout<NHWCLayoutPtn>(n, h, w, c); | ||
| 162 | -auto layoutNC1HWC0 = MakeFrameLayout<NC1HWC0LayoutPtn>(n, c1, h, w, c0); | ||
| 163 | -``` | ||
| @@ -1,91 +0,0 @@ | |||
| 1 | -# MakePatternLayout | ||
| 2 | - | ||
| 3 | -> [!NOTE]说明 | ||
| 4 | ->本接口为试验接口,在后续版本中可能会调整或改进,不保证后续兼容性。请开发者在使用过程中关注后续版本更新。 | ||
| 5 | - | ||
| 6 | -## 产品支持情况 | ||
| 7 | - | ||
| 8 | -<!-- npu="950" id1 --> | ||
| 9 | -- Ascend 950PR/Ascend 950DT:支持 | ||
| 10 | -<!-- end id1 --> | ||
| 11 | -<!-- npu="A3" id2 --> | ||
| 12 | -- Atlas A3 训练系列产品/Atlas A3 推理系列产品:不支持 | ||
| 13 | -<!-- end id2 --> | ||
| 14 | -<!-- npu="910b" id3 --> | ||
| 15 | -- Atlas A2 训练系列产品/Atlas A2 推理系列产品:不支持 | ||
| 16 | -<!-- end id3 --> | ||
| 17 | -<!-- npu="310b" id4 --> | ||
| 18 | -- Atlas 200I/500 A2 推理产品:不支持 | ||
| 19 | -<!-- end id4 --> | ||
| 20 | -<!-- npu="310p" id5 --> | ||
| 21 | -- Atlas 推理系列产品AI Core:不支持 | ||
| 22 | -<!-- end id5 --> | ||
| 23 | -<!-- npu="310p" id6 --> | ||
| 24 | -- Atlas 推理系列产品Vector Core:不支持 | ||
| 25 | -<!-- end id6 --> | ||
| 26 | -<!-- npu="910" id7 --> | ||
| 27 | -- Atlas 训练系列产品:不支持 | ||
| 28 | -<!-- end id7 --> | ||
| 29 | - | ||
| 30 | -## 功能说明 | ||
| 31 | - | ||
| 32 | -需要包含的头文件为:#include "tensor_api/tensor.h"。 | ||
| 33 | - | ||
| 34 | -MakePatternLayout用于根据Shape、Stride、LayoutPattern和TraitType构造带布局模式信息的Layout对象。 | ||
| 35 | - | ||
| 36 | -与[MakeLayout](./MakeLayout.md)相比,MakePatternLayout除了保存Shape和Stride外,还会在Layout类型中附加布局模式LayoutPattern和Trait信息。 | ||
| 37 | - | ||
| 38 | -TraitType用于描述C0粒度等布局特征。若使用`LayoutTrait<T, C0>`或`LayoutTraitDefault<T>`写法,T仅作为兼容占位或C0推导依据,不作为Tensor的数据类型信息保存。 | ||
| 39 | - | ||
| 40 | -## 函数原型 | ||
| 41 | - | ||
| 42 | -```cpp | ||
| 43 | -template <typename LayoutPattern, typename TraitType, typename ShapeType, typename StrideType> | ||
| 44 | -__aicore__ inline constexpr auto MakePatternLayout(const ShapeType& shape, const StrideType& stride) | ||
| 45 | -``` | ||
| 46 | - | ||
| 47 | -## 参数说明 | ||
| 48 | - | ||
| 49 | -**表1** 模板参数说明 | ||
| 50 | - | ||
| 51 | -| 参数名称 | 类型 | 描述 | | ||
| 52 | -| :------- | :--- | :--- | | ||
| 53 | -| LayoutPattern | 输入 | 布局模式类型,用于标记Layout的格式信息。 | | ||
| 54 | -| TraitType | 输入 | 布局trait类型,用于标记C0粒度等布局特征。 | | ||
| 55 | -| ShapeType | 输入 | shape的类型,要求为元组(tuple)类型。 | | ||
| 56 | -| StrideType | 输入 | stride的类型,要求为元组(tuple)类型。 | | ||
| 57 | - | ||
| 58 | -**表2** 参数说明 | ||
| 59 | - | ||
| 60 | -| 参数名称 | 输入/输出 | 描述 | | ||
| 61 | -| :------- | :-------- | :--- | | ||
| 62 | -| shape | 输入 | 描述逻辑形状的元组对象,可由[MakeShape](./MakeShape.md)构造。 | | ||
| 63 | -| stride | 输入 | 描述各维步长的元组对象,可由[MakeStride](./MakeStride.md)构造。 | | ||
| 64 | - | ||
| 65 | -## 返回值说明 | ||
| 66 | - | ||
| 67 | -返回Layout<ShapeType, StrideType, Std::tuple<LayoutPattern, TraitType>>类型对象。 | ||
| 68 | - | ||
| 69 | -## 约束说明 | ||
| 70 | - | ||
| 71 | -- shape和stride必须满足Layout构造要求,即都为元组类型。 | ||
| 72 | -- LayoutPattern应为合法的布局模式类型,例如NZLayoutPtn、ZNLayoutPtn、NDLayoutPtn、DNLayoutPtn等。 | ||
| 73 | -- TraitType应与LayoutPattern及后续使用场景匹配,否则可能导致后续格式检查或路由失败。 | ||
| 74 | - | ||
| 75 | -## 调用示例 | ||
| 76 | - | ||
| 77 | -```cpp | ||
| 78 | -using namespace AscendC::Te; | ||
| 79 | - | ||
| 80 | -// 示例1:构造带NZ布局模式的Layout | ||
| 81 | -auto layout1 = MakePatternLayout<NZLayoutPtn, LayoutTraitDefault<>>( | ||
| 82 | - MakeShape(MakeShape(16, 2), MakeShape(16, 4)), | ||
| 83 | - MakeStride(MakeStride(16, 256), MakeStride(1, 512)) | ||
| 84 | -); | ||
| 85 | - | ||
| 86 | -// 示例2:构造带ND布局模式的Layout | ||
| 87 | -auto layout2 = MakePatternLayout<NDLayoutPtn, LayoutTrait<Std::ignore_t, _1>>( | ||
| 88 | - MakeShape(32, 64), | ||
| 89 | - MakeStride(64, 1) | ||
| 90 | -); | ||
| 91 | -``` | ||
| @@ -1,27 +0,0 @@ | |||
| 1 | -# Layout数据结构 | ||
| 2 | - | ||
| 3 | -## Layout数据结构 | ||
| 4 | - | ||
| 5 | -- **[Layout和层次化表述法](Layout_hierarchical_representation.md)** | ||
| 6 | -- **[Layout](Layout.md)** | ||
| 7 | -- **[Shape](Shape.md)** | ||
| 8 | -- **[Stride](Stride.md)** | ||
| 9 | -- **[Coord](Coord.md)** | ||
| 10 | - | ||
| 11 | -## Layout相关接口 | ||
| 12 | - | ||
| 13 | -- **[MakeLayout](MakeLayout.md)** | ||
| 14 | -- **[MakeFrameLayout](MakeFrameLayout.md)** | ||
| 15 | -- **[MakeShape](MakeShape.md)** | ||
| 16 | -- **[MakeStride](MakeStride.md)** | ||
| 17 | -- **[MakeCoord](MakeCoord.md)** | ||
| 18 | -- **[GetShape](GetShape.md)** | ||
| 19 | -- **[GetStride](GetStride.md)** | ||
| 20 | -- **[Get](Get.md)** | ||
| 21 | -- **[Select](Select.md)** | ||
| 22 | -- **[Squeeze](Squeeze.md)** | ||
| 23 | -- **[Capacity](Capacity.md)** | ||
| 24 | -- **[Size](Size.md)** | ||
| 25 | -- **[Coshape](Coshape.md)** | ||
| 26 | -- **[Cosize](Cosize.md)** | ||
| 27 | -- **[Rank](Rank.md)** | ||
| @@ -1,49 +0,0 @@ | |||
| 1 | -# Pointer | ||
| 2 | - | ||
| 3 | -> [!NOTE]说明 | ||
| 4 | ->本接口为试验接口,在后续版本中可能会调整或改进,不保证后续兼容性。请开发者在使用过程中关注后续版本更新。 | ||
| 5 | - | ||
| 6 | -## 功能说明 | ||
| 7 | - | ||
| 8 | -Pointer定义指针迭代器,用于遍历和访问张量数据。 | ||
| 9 | - | ||
| 10 | -## 结构体定义 | ||
| 11 | - | ||
| 12 | -```cpp | ||
| 13 | -template <typename T, typename P> | ||
| 14 | -struct Pointer { | ||
| 15 | - T* ptr; | ||
| 16 | - P position; | ||
| 17 | -}; | ||
| 18 | -``` | ||
| 19 | - | ||
| 20 | -## 字段说明 | ||
| 21 | - | ||
| 22 | -| 字段名 | 类型 | 描述 | | ||
| 23 | -|--------|------|------| | ||
| 24 | -| ptr | T* | 指向数据的指针。 | | ||
| 25 | -| position | P | 指针的位置信息。 | | ||
| 26 | - | ||
| 27 | -## 约束说明 | ||
| 28 | - | ||
| 29 | -- ptr指针必须指向有效的内存空间。 | ||
| 30 | -- position必须正确描述指针的当前位置。 | ||
| 31 | -- Pointer支持多种内存空间的指针类型。 | ||
| 32 | - | ||
| 33 | -## 调用示例 | ||
| 34 | - | ||
| 35 | -```cpp | ||
| 36 | -constexpr int32_t size = 256; | ||
| 37 | -__ubuf__ float ubData[size]; | ||
| 38 | -__cbuf__ float l1Data[size]; | ||
| 39 | -__ca__ float l0AData[size]; | ||
| 40 | - | ||
| 41 | -// 创建Unified Buffer(UB)指针 | ||
| 42 | -auto ubPtr = AscendC::Te::MakeMemPtr(ubData); | ||
| 43 | - | ||
| 44 | -// 创建L1 Buffer指针 | ||
| 45 | -auto l1Ptr = AscendC::Te::MakeMemPtr(l1Data); | ||
| 46 | - | ||
| 47 | -// 创建L0A Buffer指针 | ||
| 48 | -auto caPtr = AscendC::Te::MakeMemPtr(l0AData); | ||
| 49 | -``` | ||
| @@ -1,13 +0,0 @@ | |||
| 1 | -# Tensor数据结构 | ||
| 2 | - | ||
| 3 | -## Tensor相关数据结构 | ||
| 4 | - | ||
| 5 | -- **[Tensor](Tensor.md)** | ||
| 6 | -- **[Pointer](Pointer.md)** | ||
| 7 | -- **[ViewEngine](ViewEngine.md)** | ||
| 8 | - | ||
| 9 | -## Tensor相关接口 | ||
| 10 | - | ||
| 11 | -- **[MakeTensor](MakeTensor.md)** | ||
| 12 | -- **[MakeMemPtr](MakeMemPtr.md)** | ||
| 13 | -- **[Slice](Slice.md)** | ||
| @@ -1,3 +0,0 @@ | |||
| 1 | -# 工具函数 | ||
| 2 | - | ||
| 3 | -- **[GetLayoutPattern](GetLayoutPattern.md)** | ||
| @@ -0,0 +1,230 @@ | |||
| 1 | +# Algorithm | ||
| 2 | + | ||
| 3 | +Tensor API的Algorithm层为基于Tensor的数据搬运和矩阵计算提供统一的调用入口。其中,`copy`和`mmad`接口分别用于执行数据搬运和矩阵计算,`make_copy`和`make_mmad`接口用于构造对应的Atom原子对象。 | ||
| 4 | + | ||
| 5 | +## Operation、Traits和Atom | ||
| 6 | + | ||
| 7 | +Tensor API将Trait(编译期特性)和可选Params(运行时参数)组合为Traits,Operation和Traits组合为Atom,并通过Atom提供数据搬运和矩阵计算能力: | ||
| 8 | + | ||
| 9 | +- Operation是一个C++结构体,用于封装特定通路的指令级数据搬运或矩阵计算行为。 | ||
| 10 | +- Traits是一个与Operation关联的模板特化结构体,为Operation提供所必须的信息。 | ||
| 11 | +- Atom是数据搬运或矩阵计算的原子对象,由Operation和Traits组成。 | ||
| 12 | + | ||
| 13 | +### copy_traits | ||
| 14 | + | ||
| 15 | +`copy_traits`用于描述数据搬运Operation、Trait以及绑定运行时参数后形成的类型组合。`copy_traits`的基础结构定义如下: | ||
| 16 | + | ||
| 17 | +```cpp | ||
| 18 | +template <typename CopyOperation, typename... CopyOpArgs> | ||
| 19 | +struct copy_traits {}; | ||
| 20 | + | ||
| 21 | +template <typename CopyOperation, typename CopyTrait, | ||
| 22 | + typename CopyOperationWith, typename CopyTraitWith> | ||
| 23 | +struct copy_traits<CopyOperation, CopyTrait, CopyOperationWith, CopyTraitWith> { | ||
| 24 | + using trait_type = typename CopyTrait::trait_type; | ||
| 25 | + static constexpr const trait_type default_trait = CopyTrait::value; | ||
| 26 | + | ||
| 27 | + template <typename Params> | ||
| 28 | + __aicore__ inline constexpr copy_traits<CopyOperationWith, CopyTraitWith> | ||
| 29 | + with(const Params& params) const; | ||
| 30 | + | ||
| 31 | + template <const trait_type& trait = default_trait, typename... Args> | ||
| 32 | + __aicore__ inline void copy_unpack(const Args&... args) const; | ||
| 33 | +}; | ||
| 34 | +``` | ||
| 35 | + | ||
| 36 | +例如,`copy_gm_to_l1`表示从Global Memory到L1 Buffer的数据搬运Operation,可通过以下方式为其绑定对应的Trait。 | ||
| 37 | + | ||
| 38 | +```cpp | ||
| 39 | +// 绑定可配置Trait | ||
| 40 | +template <typename Trait> | ||
| 41 | +struct copy_traits<copy_l0c_to_gm, Trait> : public copy_traits<copy_l0c_to_gm, Trait, copy_l0c_to_gm_with, Trait> {}; | ||
| 42 | + | ||
| 43 | +// 绑定默认Trait | ||
| 44 | +template <> | ||
| 45 | +struct copy_traits<copy_gm_to_l1> : public copy_traits<copy_gm_to_l1, gm_to_l1_trait_default> {}; | ||
| 46 | +``` | ||
| 47 | + | ||
| 48 | +#### 模板参数说明 | ||
| 49 | + | ||
| 50 | +**表1** `copy_traits`模板参数说明 | ||
| 51 | + | ||
| 52 | +| 参数名 | 描述 | | ||
| 53 | +| :--- | :--- | | ||
| 54 | +| CopyOperation | 数据搬运Operation类型,用于指定执行的搬运通路。 | | ||
| 55 | +| CopyOpArgs... | `copy_traits`的可变模板参数。基础模板中用于接收不同组合参数;在偏特化中依次对应`CopyTrait`、`CopyOperationWith`和`CopyTraitWith`。 | | ||
| 56 | +| CopyTrait | 未绑定运行时参数时使用的Trait类型。 | | ||
| 57 | +| CopyOperationWith | 绑定运行时参数后使用的Operation类型。 | | ||
| 58 | +| CopyTraitWith | 绑定运行时参数后使用的Trait包装类型。 | | ||
| 59 | + | ||
| 60 | +#### 成员说明 | ||
| 61 | + | ||
| 62 | +**表2** `copy_traits`成员说明 | ||
| 63 | + | ||
| 64 | +| 成员 | 描述 | | ||
| 65 | +| :--- | :--- | | ||
| 66 | +| `trait_type` | 通路使用的具体Trait类型。 | | ||
| 67 | +| `default_trait` | Trait包装类型提供的默认Trait值。 | | ||
| 68 | +| `with` | 绑定运行时参数,返回包含对应Operation和Trait的`copy_traits`对象。 | | ||
| 69 | +| `copy_unpack` | 展开已绑定参数并调用Operation的静态`copy`成员,完成数据搬运。 | | ||
| 70 | + | ||
| 71 | +### copy_atom | ||
| 72 | + | ||
| 73 | +`copy_atom`是数据搬运的原子对象,其定义如下: | ||
| 74 | + | ||
| 75 | +```cpp | ||
| 76 | +template <typename... Args> | ||
| 77 | +struct copy_atom; | ||
| 78 | + | ||
| 79 | +template <typename CopyOperation> | ||
| 80 | +struct copy_atom<CopyOperation> : copy_atom<copy_traits<CopyOperation>> {}; | ||
| 81 | + | ||
| 82 | +template <typename... Args> | ||
| 83 | +struct copy_atom<copy_traits<Args...>> : copy_traits<Args...> { | ||
| 84 | + using copy_traits_type = copy_traits<Args...>; | ||
| 85 | + using trait_type = typename copy_traits_type::trait_type; | ||
| 86 | + static constexpr const trait_type default_trait = copy_traits_type::default_trait; | ||
| 87 | + | ||
| 88 | + template <const trait_type& traits = default_trait, typename... Params> | ||
| 89 | + __aicore__ inline void call(const Params&... params) const; | ||
| 90 | + | ||
| 91 | + template <typename... TraitArgs> | ||
| 92 | + __aicore__ inline auto with(TraitArgs&&... args) const; | ||
| 93 | +}; | ||
| 94 | +``` | ||
| 95 | + | ||
| 96 | +#### 模板参数说明 | ||
| 97 | + | ||
| 98 | +**表3** `copy_atom`模板参数说明 | ||
| 99 | + | ||
| 100 | +| 参数名 | 描述 | | ||
| 101 | +| :--- | :--- | | ||
| 102 | +| Args... | `copy_atom`的可变模板参数。当传入Operation类型时,生成对应的`copy_traits`并构造Atom;当传入`copy_traits<Args...>`类型时,生成基于该Traits的Atom。 | | ||
| 103 | +| CopyOperation | 数据搬运Operation类型,用于指定Atom执行的搬运通路。 | | ||
| 104 | + | ||
| 105 | +#### 成员说明 | ||
| 106 | + | ||
| 107 | +**表4** `copy_atom`成员说明 | ||
| 108 | + | ||
| 109 | +| 成员 | 描述 | | ||
| 110 | +| :--- | :--- | | ||
| 111 | +| `copy_traits_type` | `copy_traits`类型。 | | ||
| 112 | +| `trait_type` | 通路使用的具体Trait类型。 | | ||
| 113 | +| `default_trait` | 通路使用的默认Trait值。 | | ||
| 114 | +| `call` | 使用Atom中的Operation执行数据搬运。 | | ||
| 115 | +| `with` | 绑定运行时参数并返回新的Atom,不修改原Atom。 | | ||
| 116 | + | ||
| 117 | +### mmad_traits | ||
| 118 | + | ||
| 119 | +`mmad_traits`用于描述矩阵计算Operation、Trait及运行时参数绑定后的类型组合,其定义如下: | ||
| 120 | + | ||
| 121 | +```cpp | ||
| 122 | +template <typename MmadOperation, typename... MmadOpArgs> | ||
| 123 | +struct mmad_traits {}; | ||
| 124 | + | ||
| 125 | +template <typename MmadOperation, typename MmadTrait, | ||
| 126 | + typename MmadOperationWith, typename MmadTraitWith> | ||
| 127 | +struct mmad_traits<MmadOperation, MmadTrait, MmadOperationWith, MmadTraitWith> { | ||
| 128 | + using trait_type = typename MmadTrait::trait_type; | ||
| 129 | + static constexpr const trait_type default_trait = MmadTrait::value; | ||
| 130 | + | ||
| 131 | + template <typename Params> | ||
| 132 | + __aicore__ inline constexpr mmad_traits<MmadOperationWith, MmadTraitWith> | ||
| 133 | + with(const Params& params) const; | ||
| 134 | + | ||
| 135 | + template <const trait_type& trait = default_trait, typename... Args> | ||
| 136 | + __aicore__ inline void mmad_unpack(const Args&... args) const; | ||
| 137 | +}; | ||
| 138 | +``` | ||
| 139 | + | ||
| 140 | +#### 模板参数说明 | ||
| 141 | + | ||
| 142 | +**表5** `mmad_traits`模板参数说明 | ||
| 143 | + | ||
| 144 | +| 参数名 | 描述 | | ||
| 145 | +| :--- | :--- | | ||
| 146 | +| MmadOperation | 矩阵计算Operation类型,用于指定执行的矩阵计算。 | | ||
| 147 | +| MmadOpArgs... | `mmad_traits`的可变模板参数。基础模板中用于接收不同组合参数;在偏特化中依次对应`MmadTrait`、`MmadOperationWith`和`MmadTraitWith`。 | | ||
| 148 | +| MmadTrait | 未绑定运行时参数时使用的Trait类型。 | | ||
| 149 | +| MmadOperationWith | 绑定运行时参数后使用的Operation类型。 | | ||
| 150 | +| MmadTraitWith | 绑定运行时参数后使用的Trait包装类型。 | | ||
| 151 | + | ||
| 152 | +#### 成员说明 | ||
| 153 | + | ||
| 154 | +**表6** `mmad_traits`成员说明 | ||
| 155 | + | ||
| 156 | +| 成员 | 描述 | | ||
| 157 | +| :--- | :--- | | ||
| 158 | +| `trait_type` | 矩阵计算使用的具体Trait类型。 | | ||
| 159 | +| `default_trait` | Trait包装类型提供的默认Trait值。 | | ||
| 160 | +| `with` | 绑定运行时参数,返回包含对应Operation和Trait的`mmad_traits`对象。 | | ||
| 161 | +| `mmad_unpack` | 展开已绑定参数并调用Operation的静态`mmad`成员,完成矩阵计算。 | | ||
| 162 | + | ||
| 163 | +### mmad_atom | ||
| 164 | + | ||
| 165 | +`mmad_atom`是矩阵计算的原子对象,其定义如下: | ||
| 166 | + | ||
| 167 | +```cpp | ||
| 168 | +template <typename... Args> | ||
| 169 | +struct mmad_atom; | ||
| 170 | + | ||
| 171 | +template <typename MmadOperation> | ||
| 172 | +struct mmad_atom<MmadOperation> : mmad_atom<mmad_traits<MmadOperation>> {}; | ||
| 173 | + | ||
| 174 | +template <typename MmadOperation, typename... Args> | ||
| 175 | +struct mmad_atom<mmad_traits<MmadOperation, Args...>> : mmad_traits<MmadOperation, Args...> { | ||
| 176 | + using mmad_traits_type = mmad_traits<MmadOperation, Args...>; | ||
| 177 | + using trait_type = typename mmad_traits_type::trait_type; | ||
| 178 | + static constexpr const trait_type default_trait = mmad_traits_type::default_trait; | ||
| 179 | + | ||
| 180 | + template <const trait_type& traits = default_trait, typename... Params> | ||
| 181 | + __aicore__ inline void call(const Params&... params) const; | ||
| 182 | + | ||
| 183 | + template <typename... TraitArgs> | ||
| 184 | + __aicore__ inline auto with(TraitArgs&&... args) const; | ||
| 185 | +}; | ||
| 186 | +``` | ||
| 187 | + | ||
| 188 | +#### 模板参数说明 | ||
| 189 | + | ||
| 190 | +**表7** `mmad_atom`模板参数说明 | ||
| 191 | + | ||
| 192 | +| 参数名 | 描述 | | ||
| 193 | +| :--- | :--- | | ||
| 194 | +| Args... | `mmad_atom`的可变模板参数。当传入Operation类型时,生成对应的`mmad_traits`并构造Atom;当传入`mmad_traits<Args...>`类型时,生成基于该Traits的Atom。 | | ||
| 195 | +| MmadOperation | 矩阵计算Operation类型,用于指定Atom执行的矩阵计算通路。 | | ||
| 196 | + | ||
| 197 | +#### 成员说明 | ||
| 198 | + | ||
| 199 | +**表8** `mmad_atom`成员说明 | ||
| 200 | + | ||
| 201 | +| 成员 | 描述 | | ||
| 202 | +| :--- | :--- | | ||
| 203 | +| `mmad_traits_type` | `mmad_traits`类型。 | | ||
| 204 | +| `trait_type` | 矩阵计算使用的具体Trait类型。 | | ||
| 205 | +| `default_trait` | 矩阵计算使用的默认Trait值。 | | ||
| 206 | +| `call` | 使用Atom中的Operation执行矩阵计算。 | | ||
| 207 | +| `with` | 绑定运行时参数并返回新的Atom,不修改原Atom。 | | ||
| 208 | + | ||
| 209 | +### Operation和Traits组合列表 | ||
| 210 | + | ||
| 211 | +**表9** Operation和Traits组合列表 | ||
| 212 | + | ||
| 213 | +| 功能 | Operation | Traits | Trait | Params | | ||
| 214 | +| :--- | :--- | :--- | :--- | :--- | | ||
| 215 | +| [Global Memory到Unified Buffer的数据搬运](data_move/gm_ub_data_move/copy_gm_to_ub.md) | `copy_gm_to_ub` | `copy_traits<copy_gm_to_ub, ...>` | `gm_to_ub_trait` | `gm_to_ub_params` | | ||
| 216 | +| [Unified Buffer到Global Memory的数据搬运](data_move/gm_ub_data_move/copy_ub_to_gm.md) | `copy_ub_to_gm` | `copy_traits<copy_ub_to_gm, ...>` | `ub_to_gm_trait` | 无 | | ||
| 217 | +| [Global Memory到L1 Buffer的数据搬运](matrix_compute/cube_compute_load/copy_gm_to_l1.md) | `copy_gm_to_l1` | `copy_traits<copy_gm_to_l1, ...>` | `gm_to_l1_trait` | 无 | | ||
| 218 | +| [Unified Buffer到L1 Buffer的数据搬运](data_move/l1_ub_data_move/copy_ub_to_l1.md) | `copy_ub_to_l1` | `copy_traits<copy_ub_to_l1, ...>` | `ub_to_l1_trait` | 无 | | ||
| 219 | +| [L1 Buffer到Unified Buffer的数据搬运](matrix_compute/cube_compute_load/copy_l1_to_ub.md) | `copy_l1_to_ub` | `copy_traits<copy_l1_to_ub, ...>` | `l1_to_ub_trait` | 无 | | ||
| 220 | +| [L1 Buffer到L0A Buffer的数据搬运](matrix_compute/cube_compute_load/copy_l1_to_l0a.md) | `copy_l1_to_l0a` | `copy_traits<copy_l1_to_l0a, ...>` | `l1_to_l0a_trait` | `img2col_params<PadType>`,仅Img2Col场景使用 | | ||
| 221 | +| [L1 Buffer到L0B Buffer的数据搬运](matrix_compute/cube_compute_load/copy_l1_to_l0b.md) | `copy_l1_to_l0b` | `copy_traits<copy_l1_to_l0b, ...>` | `l1_to_l0b_trait` | 无 | | ||
| 222 | +| [L1 Buffer到L0ScaleA Buffer的数据搬运](matrix_compute/cube_compute_load/copy_l1_to_l0scalea.md) | `copy_l1_to_l0scalea` | `copy_traits<copy_l1_to_l0scalea, ...>` | `l1_to_l0scalea_trait` | 无 | | ||
| 223 | +| [L1 Buffer到L0ScaleB Buffer的数据搬运](matrix_compute/cube_compute_load/copy_l1_to_l0scaleb.md) | `copy_l1_to_l0scaleb` | `copy_traits<copy_l1_to_l0scaleb, ...>` | `l1_to_l0scaleb_trait` | 无 | | ||
| 224 | +| [L1 Buffer到Fixpipe Buffer的数据搬运](matrix_compute/cube_compute_load/copy_l1_to_fixbuf.md) | `copy_l1_to_fixbuf` | `copy_traits<copy_l1_to_fixbuf, ...>` | `l1_to_fixbuf_trait` | 无 | | ||
| 225 | +| [L1 Buffer到BiasTable Buffer的数据搬运](matrix_compute/cube_compute_load/copy_l1_to_biastable.md) | `copy_l1_to_biastable` | `copy_traits<copy_l1_to_biastable, ...>` | `l1_to_biastable_trait` | 无 | | ||
| 226 | +| [L0C Buffer到Global Memory的数据搬运](matrix_compute/cube_compute_store/copy_l0c_to_gm.md) | `copy_l0c_to_gm` | `copy_traits<copy_l0c_to_gm, ...>` | `l0c_to_gm_trait` | `l0c_to_gm_params` | | ||
| 227 | +| [L0C Buffer到Unified Buffer的数据搬运](matrix_compute/cube_compute_store/copy_l0c_to_ub.md) | `copy_l0c_to_ub` | `copy_traits<copy_l0c_to_ub, ...>` | `l0c_to_ub_trait` | `l0c_to_ub_params` | | ||
| 228 | +| [L0C Buffer到L1 Buffer的数据搬运](matrix_compute/cube_compute_store/copy_l0c_to_l1.md) | `copy_l0c_to_l1` | `copy_traits<copy_l0c_to_l1, ...>` | `l0c_to_l1_trait` | `l0c_to_l1_params` | | ||
| 229 | +| [Unified Buffer到Unified Buffer的数据搬运](data_move/ub_ub_data_move/copy_ub_to_ub.md) | `copy_ub_to_ub` | `copy_traits<copy_ub_to_ub, ...>` | `ub_to_ub_trait` | 无 | | ||
| 230 | +| [矩阵乘计算](matrix_compute/mmad_compute/mmad.md) | `mmad_operation` | `mmad_traits<mmad_operation, ...>` | `mmad_trait` | `mmad_params` | | ||
| @@ -0,0 +1,16 @@ | |||
| 1 | +# 数据搬运 | ||
| 2 | + | ||
| 3 | +Tensor API通过`copy`统一执行不同存储位置之间的数据搬运。Tensor表达不同存储位置和类型的数据,Layout表达Tensor的尺寸大小和排列规则。 | ||
| 4 | + | ||
| 5 | +- [Global Memory与Unified Buffer数据搬运](gm_ub_data_move/gm_ub_data_move.md) | ||
| 6 | +- [Global Memory到L1 Buffer数据搬运](gm_l1_data_move.md) | ||
| 7 | +- [L1 Buffer与Unified Buffer数据搬运](l1_ub_data_move/l1_ub_data_move.md) | ||
| 8 | +- [L1 Buffer到L0 Buffer数据搬运](l1_l0_data_move.md) | ||
| 9 | +- [L0C Buffer到Global Memory数据搬运](l0c_gm_data_move.md) | ||
| 10 | +- [L0C Buffer到L1 Buffer数据搬运](l0c_l1_data_move.md) | ||
| 11 | +- [L0C Buffer到Unified Buffer数据搬运](l0c_ub_data_move.md) | ||
| 12 | +- [L1 Buffer到Fixpipe Buffer数据搬运](l1_fixbuf_data_move.md) | ||
| 13 | +- [L1 Buffer到BiasTable Buffer数据搬运](l1_bias_table_data_move.md) | ||
| 14 | +- [Unified Buffer内部数据搬运](ub_ub_data_move/ub_ub_data_move.md) | ||
| 15 | + | ||
| 16 | +`copy`、`make_copy`、Copy Operation、Trait和Atom的统一说明参见[Algorithm](../algorithm.md)。 | ||
| @@ -0,0 +1,3 @@ | |||
| 1 | +# Global Memory到L1 Buffer数据搬运 | ||
| 2 | + | ||
| 3 | +- [copy(Global Memory到L1 Buffer数据搬运)](../matrix_compute/cube_compute_load/copy_gm_to_l1.md) | ||
| @@ -0,0 +1,156 @@ | |||
| 1 | +# copy(Global Memory到Unified Buffer数据搬运) | ||
| 2 | + | ||
| 3 | +## 产品支持情况 | ||
| 4 | + | ||
| 5 | +<!-- npu="950" id1 --> | ||
| 6 | +- Ascend 950PR/Ascend 950DT:支持 | ||
| 7 | +<!-- end id1 --> | ||
| 8 | +<!-- npu="A3" id2 --> | ||
| 9 | +- Atlas A3训练系列产品/Atlas A3推理系列产品:不支持 | ||
| 10 | +<!-- end id2 --> | ||
| 11 | +<!-- npu="910b" id3 --> | ||
| 12 | +- Atlas A2训练系列产品/Atlas A2推理系列产品:不支持 | ||
| 13 | +<!-- end id3 --> | ||
| 14 | +<!-- npu="310b" id4 --> | ||
| 15 | +- Atlas 200I/500 A2推理产品:不支持 | ||
| 16 | +<!-- end id4 --> | ||
| 17 | +<!-- npu="310p" id5 --> | ||
| 18 | +- Atlas推理系列产品AI Core:不支持 | ||
| 19 | +<!-- end id5 --> | ||
| 20 | +<!-- npu="310p" id6 --> | ||
| 21 | +- Atlas推理系列产品Vector Core:不支持 | ||
| 22 | +<!-- end id6 --> | ||
| 23 | +<!-- npu="910" id7 --> | ||
| 24 | +- Atlas训练系列产品:不支持 | ||
| 25 | +<!-- end id7 --> | ||
| 26 | + | ||
| 27 | +## 功能说明 | ||
| 28 | + | ||
| 29 | +头文件路径为:`tensor_api/tensor.h`。 | ||
| 30 | + | ||
| 31 | +本接口将源Tensor的数据从Global Memory搬运到Unified Buffer。接口支持完整Tensor搬运,也支持通过`dst_coord`、`src_coord`和`copy_shape`指定目的Tensor中的起始坐标、源Tensor中的起始坐标和搬运区域的形状,执行区域搬运。用户还可以通过`gm_to_ub_params`配置目的端左右两侧的Padding。 | ||
| 32 | + | ||
| 33 | +## 函数原型 | ||
| 34 | + | ||
| 35 | +- 执行Global Memory到Unified Buffer搬运。 | ||
| 36 | + | ||
| 37 | + ```cpp | ||
| 38 | + template <typename Atom, typename DstTensor, typename SrcTensor> | ||
| 39 | + __aicore__ inline void copy(const copy_atom<Atom>& atom, | ||
| 40 | + const DstTensor& dst, const SrcTensor& src) | ||
| 41 | + ``` | ||
| 42 | + | ||
| 43 | +- 按指定源坐标、目的坐标和搬运形状执行Global Memory到Unified Buffer搬运。 | ||
| 44 | + | ||
| 45 | + ```cpp | ||
| 46 | + template <typename Atom, typename DstTensor, typename SrcTensor, typename DstCoord, | ||
| 47 | + typename SrcCoord, typename CopyShape> | ||
| 48 | + __aicore__ inline void copy(const copy_atom<Atom>& atom, const DstTensor& dst, | ||
| 49 | + const SrcTensor& src, const DstCoord& dst_coord, const SrcCoord& src_coord, | ||
| 50 | + const CopyShape& copy_shape) | ||
| 51 | + ``` | ||
| 52 | + | ||
| 53 | +- 使用默认trait构造搬运原子对象。 | ||
| 54 | + | ||
| 55 | + ```cpp | ||
| 56 | + template <typename CopyOperation> | ||
| 57 | + __aicore__ inline constexpr auto make_copy(const CopyOperation& operation) | ||
| 58 | + ``` | ||
| 59 | + | ||
| 60 | +- 使用指定trait构造搬运原子对象。 | ||
| 61 | + | ||
| 62 | + ```cpp | ||
| 63 | + template <typename CopyOperation, typename CopyTrait> | ||
| 64 | + __aicore__ inline constexpr auto make_copy(const CopyOperation& operation, | ||
| 65 | + const CopyTrait& trait) | ||
| 66 | + ``` | ||
| 67 | + | ||
| 68 | +## 参数说明 | ||
| 69 | + | ||
| 70 | +**表1** 模板参数说明 | ||
| 71 | + | ||
| 72 | +| 参数名 | 描述 | | ||
| 73 | +| :--- | :--- | | ||
| 74 | +| Atom | `copy_atom`的模板参数,由`make_copy`接口推导得到。 | | ||
| 75 | +| DstTensor | 目的张量类型,需为Tensor API Tensor类型。 | | ||
| 76 | +| SrcTensor | 源张量类型,需为Tensor API Tensor类型。 | | ||
| 77 | +| DstCoord | 目的张量起始坐标类型,也可为`zero_coord`。 | | ||
| 78 | +| SrcCoord | 源张量起始坐标类型,也可为`zero_coord`。 | | ||
| 79 | +| CopyShape | 搬运区域形状的类型。 | | ||
| 80 | +| CopyOperation | 搬运操作对象类型。 | | ||
| 81 | +| CopyTrait | 搬运trait对象类型。 | | ||
| 82 | + | ||
| 83 | +**表2** `copy`接口参数说明 | ||
| 84 | + | ||
| 85 | +| 参数名 | 输入/输出 | 描述 | | ||
| 86 | +| :--- | :---: | :--- | | ||
| 87 | +| atom | 输入 | 搬运原子对象,可由`make_copy`接口构造。 | | ||
| 88 | +| dst | 输出 | 目的Tensor,必须位于Unified Buffer。 | | ||
| 89 | +| src | 输入 | 源Tensor,必须位于Global Memory。 | | ||
| 90 | +| dst_coord | 输入 | 搬运区域在目的Tensor中的起始坐标。 | | ||
| 91 | +| src_coord | 输入 | 搬运区域在源Tensor中的起始坐标。 | | ||
| 92 | +| copy_shape | 输入 | 搬运区域的形状,用于指定搬运区域的大小。 | | ||
| 93 | + | ||
| 94 | +**表3** `make_copy`接口参数说明 | ||
| 95 | + | ||
| 96 | +| 参数名 | 输入/输出 | 描述 | | ||
| 97 | +| :--- | :---: | :--- | | ||
| 98 | +| operation | 输入 | 搬运操作对象。Global Memory到Unified Buffer搬运取`copy_gm_to_ub{}`。 | | ||
| 99 | +| trait | 输入 | 搬运trait对象。Global Memory到Unified Buffer默认取`gm_to_ub_trait_default{}`。 | | ||
| 100 | + | ||
| 101 | +### copy_gm_to_ub说明 | ||
| 102 | + | ||
| 103 | +`copy_gm_to_ub`用于标识Global Memory到Unified Buffer的数据搬运通路,其静态`copy`成员负责分发该通路的数据搬运。 | ||
| 104 | + | ||
| 105 | +```cpp | ||
| 106 | +struct copy_gm_to_ub { | ||
| 107 | + template <typename Trait, const Trait& trait, typename... Args> | ||
| 108 | + __aicore__ inline static void copy(const Args&... args); | ||
| 109 | +}; | ||
| 110 | +``` | ||
| 111 | + | ||
| 112 | +### gm_to_ub_trait说明 | ||
| 113 | + | ||
| 114 | +`gm_to_ub_trait`表示Global Memory到Unified Buffer搬运的编译期特性,当前不包含可配置成员。`gm_to_ub_trait_default`提供该通路的默认Trait类型和默认值。 | ||
| 115 | + | ||
| 116 | +```cpp | ||
| 117 | +struct gm_to_ub_trait {}; | ||
| 118 | + | ||
| 119 | +struct gm_to_ub_trait_default { | ||
| 120 | + using trait_type = gm_to_ub_trait; | ||
| 121 | + static constexpr const trait_type value = {}; | ||
| 122 | +}; | ||
| 123 | +``` | ||
| 124 | + | ||
| 125 | +### gm_to_ub_params说明 | ||
| 126 | + | ||
| 127 | +`gm_to_ub_params`用于配置Global Memory到Unified Buffer搬运的运行时参数。 | ||
| 128 | + | ||
| 129 | +```cpp | ||
| 130 | +struct gm_to_ub_params { | ||
| 131 | + uint8_t left_padding_count = 0; | ||
| 132 | + uint8_t right_padding_count = 0; | ||
| 133 | + bool enable_constant_pad = true; | ||
| 134 | +}; | ||
| 135 | +``` | ||
| 136 | + | ||
| 137 | +`left_padding_count`和`right_padding_count`分别表示每个搬运块写入Unified Buffer时,在有效数据左侧和右侧保留的Padding元素数量。`enable_constant_pad`为`true`时写入Padding值,为`false`时不写入Padding区域。运行时参数通过`make_copy(copy_gm_to_ub{}).with(params)`绑定。 | ||
| 138 | + | ||
| 139 | +## 约束说明 | ||
| 140 | + | ||
| 141 | +- 源和目的Tensor的元素类型必须一致,元素类型大小支持1、2、4或8字节。 | ||
| 142 | +- 支持相同格式间搬运:`ND`、`DN`、`NZ`和`ZN`。 | ||
| 143 | +- Padding元素数量和目的Stride需要满足底层Global Memory到Unified Buffer搬运指令约束。 | ||
| 144 | +- 区域搬运的坐标、搬运区域大小及范围必须合法。 | ||
| 145 | + | ||
| 146 | +## 调用示例 | ||
| 147 | + | ||
| 148 | +```cpp | ||
| 149 | +#include "tensor_api/tensor.h" | ||
| 150 | + | ||
| 151 | +using namespace asc::te; | ||
| 152 | + | ||
| 153 | +gm_to_ub_params params{0, 0, true}; | ||
| 154 | +auto atom = make_copy(copy_gm_to_ub{}).with(params); | ||
| 155 | +copy(atom, ub_tensor, gm_tensor); | ||
| 156 | +``` | ||
| @@ -0,0 +1,141 @@ | |||
| 1 | +# copy(Unified Buffer到Global Memory数据搬运) | ||
| 2 | + | ||
| 3 | +## 产品支持情况 | ||
| 4 | + | ||
| 5 | +<!-- npu="950" id1 --> | ||
| 6 | +- Ascend 950PR/Ascend 950DT:支持 | ||
| 7 | +<!-- end id1 --> | ||
| 8 | +<!-- npu="A3" id2 --> | ||
| 9 | +- Atlas A3训练系列产品/Atlas A3推理系列产品:不支持 | ||
| 10 | +<!-- end id2 --> | ||
| 11 | +<!-- npu="910b" id3 --> | ||
| 12 | +- Atlas A2训练系列产品/Atlas A2推理系列产品:不支持 | ||
| 13 | +<!-- end id3 --> | ||
| 14 | +<!-- npu="310b" id4 --> | ||
| 15 | +- Atlas 200I/500 A2推理产品:不支持 | ||
| 16 | +<!-- end id4 --> | ||
| 17 | +<!-- npu="310p" id5 --> | ||
| 18 | +- Atlas推理系列产品AI Core:不支持 | ||
| 19 | +<!-- end id5 --> | ||
| 20 | +<!-- npu="310p" id6 --> | ||
| 21 | +- Atlas推理系列产品Vector Core:不支持 | ||
| 22 | +<!-- end id6 --> | ||
| 23 | +<!-- npu="910" id7 --> | ||
| 24 | +- Atlas训练系列产品:不支持 | ||
| 25 | +<!-- end id7 --> | ||
| 26 | + | ||
| 27 | +## 功能说明 | ||
| 28 | + | ||
| 29 | +头文件路径为:`tensor_api/tensor.h`。 | ||
| 30 | + | ||
| 31 | +本接口将源Tensor的数据从Unified Buffer搬运到Global Memory。接口支持完整Tensor搬运,也支持通过`dst_coord`、`src_coord`和`copy_shape`指定目的Tensor中的起始坐标、源Tensor中的起始坐标和搬运区域的形状,执行区域搬运。 | ||
| 32 | + | ||
| 33 | +## 函数原型 | ||
| 34 | + | ||
| 35 | +- 执行Unified Buffer到Global Memory搬运。 | ||
| 36 | + | ||
| 37 | + ```cpp | ||
| 38 | + template <typename Atom, typename DstTensor, typename SrcTensor> | ||
| 39 | + __aicore__ inline void copy(const copy_atom<Atom>& atom, | ||
| 40 | + const DstTensor& dst, const SrcTensor& src) | ||
| 41 | + ``` | ||
| 42 | + | ||
| 43 | +- 按指定源坐标、目的坐标和搬运形状执行Unified Buffer到Global Memory搬运。 | ||
| 44 | + | ||
| 45 | + ```cpp | ||
| 46 | + template <typename Atom, typename DstTensor, typename SrcTensor, typename DstCoord, | ||
| 47 | + typename SrcCoord, typename CopyShape> | ||
| 48 | + __aicore__ inline void copy(const copy_atom<Atom>& atom, const DstTensor& dst, | ||
| 49 | + const SrcTensor& src, const DstCoord& dst_coord, const SrcCoord& src_coord, | ||
| 50 | + const CopyShape& copy_shape) | ||
| 51 | + ``` | ||
| 52 | + | ||
| 53 | +- 使用默认trait构造搬运原子对象。 | ||
| 54 | + | ||
| 55 | + ```cpp | ||
| 56 | + template <typename CopyOperation> | ||
| 57 | + __aicore__ inline constexpr auto make_copy(const CopyOperation& operation) | ||
| 58 | + ``` | ||
| 59 | + | ||
| 60 | +- 使用指定trait构造搬运原子对象。 | ||
| 61 | + | ||
| 62 | + ```cpp | ||
| 63 | + template <typename CopyOperation, typename CopyTrait> | ||
| 64 | + __aicore__ inline constexpr auto make_copy(const CopyOperation& operation, | ||
| 65 | + const CopyTrait& trait) | ||
| 66 | + ``` | ||
| 67 | + | ||
| 68 | +## 参数说明 | ||
| 69 | + | ||
| 70 | +**表1** 模板参数说明 | ||
| 71 | + | ||
| 72 | +| 参数名 | 描述 | | ||
| 73 | +| :--- | :--- | | ||
| 74 | +| Atom | `copy_atom`的模板参数,由`make_copy`接口推导得到。 | | ||
| 75 | +| DstTensor | 目的张量类型,需为Tensor API Tensor类型。 | | ||
| 76 | +| SrcTensor | 源张量类型,需为Tensor API Tensor类型。 | | ||
| 77 | +| DstCoord | 目的张量起始坐标类型,也可为`zero_coord`。 | | ||
| 78 | +| SrcCoord | 源张量起始坐标类型,也可为`zero_coord`。 | | ||
| 79 | +| CopyShape | 搬运区域形状的类型。 | | ||
| 80 | +| CopyOperation | 搬运操作对象类型。 | | ||
| 81 | +| CopyTrait | 搬运trait对象类型。 | | ||
| 82 | + | ||
| 83 | +**表2** `copy`接口参数说明 | ||
| 84 | + | ||
| 85 | +| 参数名 | 输入/输出 | 描述 | | ||
| 86 | +| :--- | :---: | :--- | | ||
| 87 | +| atom | 输入 | 搬运原子对象,可由`make_copy`接口构造。 | | ||
| 88 | +| dst | 输出 | 目的Tensor,必须位于Global Memory。 | | ||
| 89 | +| src | 输入 | 源Tensor,必须位于Unified Buffer。 | | ||
| 90 | +| dst_coord | 输入 | 搬运区域在目的Tensor中的起始坐标。 | | ||
| 91 | +| src_coord | 输入 | 搬运区域在源Tensor中的起始坐标。 | | ||
| 92 | +| copy_shape | 输入 | 搬运区域的形状,用于指定搬运区域的大小。 | | ||
| 93 | + | ||
| 94 | +**表3** `make_copy`接口参数说明 | ||
| 95 | + | ||
| 96 | +| 参数名 | 输入/输出 | 描述 | | ||
| 97 | +| :--- | :---: | :--- | | ||
| 98 | +| operation | 输入 | 搬运操作对象。Unified Buffer到Global Memory搬运取`copy_ub_to_gm{}`。 | | ||
| 99 | +| trait | 输入 | 搬运trait对象。Unified Buffer到Global Memory默认取`ub_to_gm_trait_default{}`。 | | ||
| 100 | + | ||
| 101 | +### copy_ub_to_gm说明 | ||
| 102 | + | ||
| 103 | +`copy_ub_to_gm`用于标识Unified Buffer到Global Memory的数据搬运通路,其静态`copy`成员负责分发该通路的数据搬运。 | ||
| 104 | + | ||
| 105 | +```cpp | ||
| 106 | +struct copy_ub_to_gm { | ||
| 107 | + template <typename Trait, const Trait& trait, typename... Args> | ||
| 108 | + __aicore__ inline static void copy(const Args&... args); | ||
| 109 | +}; | ||
| 110 | +``` | ||
| 111 | + | ||
| 112 | +### ub_to_gm_trait说明 | ||
| 113 | + | ||
| 114 | +`ub_to_gm_trait`表示Unified Buffer到Global Memory搬运的编译期特性,当前不包含可配置成员。`ub_to_gm_trait_default`提供该通路的默认Trait类型和默认值。 | ||
| 115 | + | ||
| 116 | +```cpp | ||
| 117 | +struct ub_to_gm_trait {}; | ||
| 118 | + | ||
| 119 | +struct ub_to_gm_trait_default { | ||
| 120 | + using trait_type = ub_to_gm_trait; | ||
| 121 | + static constexpr const trait_type value = {}; | ||
| 122 | +}; | ||
| 123 | +``` | ||
| 124 | + | ||
| 125 | +## 约束说明 | ||
| 126 | + | ||
| 127 | +- 源和目的Tensor的元素类型必须一致。 | ||
| 128 | +- 支持相同格式间搬运:`ND`、`NDExt`、`DN`、`DNExt`和`NZ`。 | ||
| 129 | +- 搬运长度、块数和Stride需要满足Unified Buffer到Global Memory搬运指令约束。 | ||
| 130 | +- 区域搬运的坐标、搬运区域大小及范围必须合法。 | ||
| 131 | + | ||
| 132 | +## 调用示例 | ||
| 133 | + | ||
| 134 | +```cpp | ||
| 135 | +#include "tensor_api/tensor.h" | ||
| 136 | + | ||
| 137 | +using namespace asc::te; | ||
| 138 | + | ||
| 139 | +auto atom = make_copy(copy_ub_to_gm{}, ub_to_gm_trait_default{}); | ||
| 140 | +copy(atom, gm_tensor, ub_tensor); | ||
| 141 | +``` | ||
| @@ -0,0 +1,4 @@ | |||
| 1 | +# Global Memory与Unified Buffer数据搬运 | ||
| 2 | + | ||
| 3 | +- [copy(Global Memory到Unified Buffer数据搬运)](copy_gm_to_ub.md) | ||
| 4 | +- [copy(Unified Buffer到Global Memory数据搬运)](copy_ub_to_gm.md) | ||
| @@ -0,0 +1,3 @@ | |||
| 1 | +# L0C Buffer到Global Memory数据搬运 | ||
| 2 | + | ||
| 3 | +- [copy(L0C Buffer到Global Memory数据搬运)](../matrix_compute/cube_compute_store/copy_l0c_to_gm.md) | ||
| @@ -0,0 +1,3 @@ | |||
| 1 | +# L0C Buffer到L1 Buffer数据搬运 | ||
| 2 | + | ||
| 3 | +- [copy(L0C Buffer到L1 Buffer数据搬运)](../matrix_compute/cube_compute_store/copy_l0c_to_l1.md) | ||
| @@ -0,0 +1,3 @@ | |||
| 1 | +# L0C Buffer到Unified Buffer数据搬运 | ||
| 2 | + | ||
| 3 | +- [copy(L0C Buffer到Unified Buffer数据搬运)](../matrix_compute/cube_compute_store/copy_l0c_to_ub.md) | ||
| @@ -0,0 +1,3 @@ | |||
| 1 | +# L1 Buffer到BiasTable Buffer数据搬运 | ||
| 2 | + | ||
| 3 | +- [copy(L1 Buffer到BiasTable Buffer数据搬运)](../matrix_compute/cube_compute_load/copy_l1_to_biastable.md) | ||
| @@ -0,0 +1,3 @@ | |||
| 1 | +# L1 Buffer到Fixpipe Buffer数据搬运 | ||
| 2 | + | ||
| 3 | +- [copy(L1 Buffer到Fixpipe Buffer数据搬运)](../matrix_compute/cube_compute_load/copy_l1_to_fixbuf.md) | ||
| @@ -0,0 +1,6 @@ | |||
| 1 | +# L1 Buffer到L0 Buffer数据搬运 | ||
| 2 | + | ||
| 3 | +- [copy(L1 Buffer到L0A Buffer数据搬运)](../matrix_compute/cube_compute_load/copy_l1_to_l0a.md) | ||
| 4 | +- [copy(L1 Buffer到L0B Buffer数据搬运)](../matrix_compute/cube_compute_load/copy_l1_to_l0b.md) | ||
| 5 | +- [copy(L1 Buffer到L0ScaleA Buffer数据搬运)](../matrix_compute/cube_compute_load/copy_l1_to_l0scalea.md) | ||
| 6 | +- [copy(L1 Buffer到L0ScaleB Buffer数据搬运)](../matrix_compute/cube_compute_load/copy_l1_to_l0scaleb.md) | ||
| @@ -0,0 +1,141 @@ | |||
| 1 | +# copy(Unified Buffer到L1 Buffer数据搬运) | ||
| 2 | + | ||
| 3 | +## 产品支持情况 | ||
| 4 | + | ||
| 5 | +<!-- npu="950" id1 --> | ||
| 6 | +- Ascend 950PR/Ascend 950DT:支持 | ||
| 7 | +<!-- end id1 --> | ||
| 8 | +<!-- npu="A3" id2 --> | ||
| 9 | +- Atlas A3训练系列产品/Atlas A3推理系列产品:不支持 | ||
| 10 | +<!-- end id2 --> | ||
| 11 | +<!-- npu="910b" id3 --> | ||
| 12 | +- Atlas A2训练系列产品/Atlas A2推理系列产品:不支持 | ||
| 13 | +<!-- end id3 --> | ||
| 14 | +<!-- npu="310b" id4 --> | ||
| 15 | +- Atlas 200I/500 A2推理产品:不支持 | ||
| 16 | +<!-- end id4 --> | ||
| 17 | +<!-- npu="310p" id5 --> | ||
| 18 | +- Atlas推理系列产品AI Core:不支持 | ||
| 19 | +<!-- end id5 --> | ||
| 20 | +<!-- npu="310p" id6 --> | ||
| 21 | +- Atlas推理系列产品Vector Core:不支持 | ||
| 22 | +<!-- end id6 --> | ||
| 23 | +<!-- npu="910" id7 --> | ||
| 24 | +- Atlas训练系列产品:不支持 | ||
| 25 | +<!-- end id7 --> | ||
| 26 | + | ||
| 27 | +## 功能说明 | ||
| 28 | + | ||
| 29 | +头文件路径为:`tensor_api/tensor.h`。 | ||
| 30 | + | ||
| 31 | +本接口将源Tensor的数据从Unified Buffer搬运到L1 Buffer。接口支持完整Tensor搬运,也支持通过`dst_coord`、`src_coord`和`copy_shape`指定目的Tensor中的起始坐标、源Tensor中的起始坐标和搬运区域的形状,执行区域搬运。 | ||
| 32 | + | ||
| 33 | +## 函数原型 | ||
| 34 | + | ||
| 35 | +- 执行Unified Buffer到L1 Buffer搬运。 | ||
| 36 | + | ||
| 37 | + ```cpp | ||
| 38 | + template <typename Atom, typename DstTensor, typename SrcTensor> | ||
| 39 | + __aicore__ inline void copy(const copy_atom<Atom>& atom, | ||
| 40 | + const DstTensor& dst, const SrcTensor& src) | ||
| 41 | + ``` | ||
| 42 | + | ||
| 43 | +- 按指定源坐标、目的坐标和搬运形状执行Unified Buffer到L1 Buffer搬运。 | ||
| 44 | + | ||
| 45 | + ```cpp | ||
| 46 | + template <typename Atom, typename DstTensor, typename SrcTensor, typename DstCoord, | ||
| 47 | + typename SrcCoord, typename CopyShape> | ||
| 48 | + __aicore__ inline void copy(const copy_atom<Atom>& atom, const DstTensor& dst, | ||
| 49 | + const SrcTensor& src, const DstCoord& dst_coord, const SrcCoord& src_coord, | ||
| 50 | + const CopyShape& copy_shape) | ||
| 51 | + ``` | ||
| 52 | + | ||
| 53 | +- 使用默认trait构造搬运原子对象。 | ||
| 54 | + | ||
| 55 | + ```cpp | ||
| 56 | + template <typename CopyOperation> | ||
| 57 | + __aicore__ inline constexpr auto make_copy(const CopyOperation& operation) | ||
| 58 | + ``` | ||
| 59 | + | ||
| 60 | +- 使用指定trait构造搬运原子对象。 | ||
| 61 | + | ||
| 62 | + ```cpp | ||
| 63 | + template <typename CopyOperation, typename CopyTrait> | ||
| 64 | + __aicore__ inline constexpr auto make_copy(const CopyOperation& operation, | ||
| 65 | + const CopyTrait& trait) | ||
| 66 | + ``` | ||
| 67 | + | ||
| 68 | +## 参数说明 | ||
| 69 | + | ||
| 70 | +**表1** 模板参数说明 | ||
| 71 | + | ||
| 72 | +| 参数名 | 描述 | | ||
| 73 | +| :--- | :--- | | ||
| 74 | +| Atom | `copy_atom`的模板参数,由`make_copy`接口推导得到。 | | ||
| 75 | +| DstTensor | 目的张量类型,需为Tensor API Tensor类型。 | | ||
| 76 | +| SrcTensor | 源张量类型,需为Tensor API Tensor类型。 | | ||
| 77 | +| DstCoord | 目的张量起始坐标类型,也可为`zero_coord`。 | | ||
| 78 | +| SrcCoord | 源张量起始坐标类型,也可为`zero_coord`。 | | ||
| 79 | +| CopyShape | 搬运区域形状的类型。 | | ||
| 80 | +| CopyOperation | 搬运操作对象类型。 | | ||
| 81 | +| CopyTrait | 搬运trait对象类型。 | | ||
| 82 | + | ||
| 83 | +**表2** `copy`接口参数说明 | ||
| 84 | + | ||
| 85 | +| 参数名 | 输入/输出 | 描述 | | ||
| 86 | +| :--- | :---: | :--- | | ||
| 87 | +| atom | 输入 | 搬运原子对象,可由`make_copy`接口构造。 | | ||
| 88 | +| dst | 输出 | 目的Tensor,必须位于L1 Buffer。 | | ||
| 89 | +| src | 输入 | 源Tensor,必须位于Unified Buffer。 | | ||
| 90 | +| dst_coord | 输入 | 搬运区域在目的Tensor中的起始坐标。 | | ||
| 91 | +| src_coord | 输入 | 搬运区域在源Tensor中的起始坐标。 | | ||
| 92 | +| copy_shape | 输入 | 搬运区域的形状,用于指定搬运区域的大小。 | | ||
| 93 | + | ||
| 94 | +**表3** `make_copy`接口参数说明 | ||
| 95 | + | ||
| 96 | +| 参数名 | 输入/输出 | 描述 | | ||
| 97 | +| :--- | :---: | :--- | | ||
| 98 | +| operation | 输入 | 搬运操作对象。Unified Buffer到L1 Buffer搬运取`copy_ub_to_l1{}`。 | | ||
| 99 | +| trait | 输入 | 搬运trait对象。Unified Buffer到L1 Buffer默认取`ub_to_l1_trait_default{}`。 | | ||
| 100 | + | ||
| 101 | +### copy_ub_to_l1说明 | ||
| 102 | + | ||
| 103 | +`copy_ub_to_l1`用于标识Unified Buffer到L1 Buffer的数据搬运通路,其静态`copy`成员负责分发该通路的数据搬运。 | ||
| 104 | + | ||
| 105 | +```cpp | ||
| 106 | +struct copy_ub_to_l1 { | ||
| 107 | + template <typename Trait, const Trait& trait, typename... Args> | ||
| 108 | + __aicore__ inline static void copy(const Args&... args); | ||
| 109 | +}; | ||
| 110 | +``` | ||
| 111 | + | ||
| 112 | +### ub_to_l1_trait说明 | ||
| 113 | + | ||
| 114 | +`ub_to_l1_trait`表示Unified Buffer到L1 Buffer搬运的编译期特性,当前不包含可配置成员。`ub_to_l1_trait_default`提供该通路的默认Trait类型和默认值。 | ||
| 115 | + | ||
| 116 | +```cpp | ||
| 117 | +struct ub_to_l1_trait {}; | ||
| 118 | + | ||
| 119 | +struct ub_to_l1_trait_default { | ||
| 120 | + using trait_type = ub_to_l1_trait; | ||
| 121 | + static constexpr const trait_type value = {}; | ||
| 122 | +}; | ||
| 123 | +``` | ||
| 124 | + | ||
| 125 | +## 约束说明 | ||
| 126 | + | ||
| 127 | +- 源和目的Tensor的元素类型必须一致。 | ||
| 128 | +- 支持相同格式间搬运:`ND`、`NDExt`、`DN`、`DNExt`、`NZ`和`ZN`。 | ||
| 129 | +- 搬运长度和块数需要满足Unified Buffer到L1 Buffer搬运指令约束。 | ||
| 130 | +- 区域搬运的坐标、搬运区域大小及范围必须合法。 | ||
| 131 | + | ||
| 132 | +## 调用示例 | ||
| 133 | + | ||
| 134 | +```cpp | ||
| 135 | +#include "tensor_api/tensor.h" | ||
| 136 | + | ||
| 137 | +using namespace asc::te; | ||
| 138 | + | ||
| 139 | +auto atom = make_copy(copy_ub_to_l1{}, ub_to_l1_trait_default{}); | ||
| 140 | +copy(atom, l1_tensor, ub_tensor); | ||
| 141 | +``` | ||
| @@ -0,0 +1,4 @@ | |||
| 1 | +# L1 Buffer与Unified Buffer数据搬运 | ||
| 2 | + | ||
| 3 | +- [copy(L1 Buffer到Unified Buffer数据搬运)](../../matrix_compute/cube_compute_load/copy_l1_to_ub.md) | ||
| 4 | +- [copy(Unified Buffer到L1 Buffer数据搬运)](copy_ub_to_l1.md) | ||
| @@ -0,0 +1,142 @@ | |||
| 1 | +# copy(Unified Buffer到Unified Buffer数据搬运) | ||
| 2 | + | ||
| 3 | +## 产品支持情况 | ||
| 4 | + | ||
| 5 | +<!-- npu="950" id1 --> | ||
| 6 | +- Ascend 950PR/Ascend 950DT:支持 | ||
| 7 | +<!-- end id1 --> | ||
| 8 | +<!-- npu="A3" id2 --> | ||
| 9 | +- Atlas A3训练系列产品/Atlas A3推理系列产品:不支持 | ||
| 10 | +<!-- end id2 --> | ||
| 11 | +<!-- npu="910b" id3 --> | ||
| 12 | +- Atlas A2训练系列产品/Atlas A2推理系列产品:不支持 | ||
| 13 | +<!-- end id3 --> | ||
| 14 | +<!-- npu="310b" id4 --> | ||
| 15 | +- Atlas 200I/500 A2推理产品:不支持 | ||
| 16 | +<!-- end id4 --> | ||
| 17 | +<!-- npu="310p" id5 --> | ||
| 18 | +- Atlas推理系列产品AI Core:不支持 | ||
| 19 | +<!-- end id5 --> | ||
| 20 | +<!-- npu="310p" id6 --> | ||
| 21 | +- Atlas推理系列产品Vector Core:不支持 | ||
| 22 | +<!-- end id6 --> | ||
| 23 | +<!-- npu="910" id7 --> | ||
| 24 | +- Atlas训练系列产品:不支持 | ||
| 25 | +<!-- end id7 --> | ||
| 26 | + | ||
| 27 | +## 功能说明 | ||
| 28 | + | ||
| 29 | +头文件路径为:`tensor_api/tensor.h`。 | ||
| 30 | + | ||
| 31 | +本接口在Unified Buffer内部搬运Tensor数据。接口支持完整Tensor搬运,也支持通过`dst_coord`、`src_coord`和`copy_shape`指定目的Tensor中的起始坐标、源Tensor中的起始坐标和搬运区域的形状,执行区域搬运。 | ||
| 32 | + | ||
| 33 | +## 函数原型 | ||
| 34 | + | ||
| 35 | +- 执行Unified Buffer到Unified Buffer搬运。 | ||
| 36 | + | ||
| 37 | + ```cpp | ||
| 38 | + template <typename Atom, typename DstTensor, typename SrcTensor> | ||
| 39 | + __aicore__ inline void copy(const copy_atom<Atom>& atom, | ||
| 40 | + const DstTensor& dst, const SrcTensor& src) | ||
| 41 | + ``` | ||
| 42 | + | ||
| 43 | +- 按指定源坐标、目的坐标和搬运形状执行Unified Buffer到Unified Buffer搬运。 | ||
| 44 | + | ||
| 45 | + ```cpp | ||
| 46 | + template <typename Atom, typename DstTensor, typename SrcTensor, typename DstCoord, | ||
| 47 | + typename SrcCoord, typename CopyShape> | ||
| 48 | + __aicore__ inline void copy(const copy_atom<Atom>& atom, const DstTensor& dst, | ||
| 49 | + const SrcTensor& src, const DstCoord& dst_coord, const SrcCoord& src_coord, | ||
| 50 | + const CopyShape& copy_shape) | ||
| 51 | + ``` | ||
| 52 | + | ||
| 53 | +- 使用默认trait构造搬运原子对象。 | ||
| 54 | + | ||
| 55 | + ```cpp | ||
| 56 | + template <typename CopyOperation> | ||
| 57 | + __aicore__ inline constexpr auto make_copy(const CopyOperation& operation) | ||
| 58 | + ``` | ||
| 59 | + | ||
| 60 | +- 使用指定trait构造搬运原子对象。 | ||
| 61 | + | ||
| 62 | + ```cpp | ||
| 63 | + template <typename CopyOperation, typename CopyTrait> | ||
| 64 | + __aicore__ inline constexpr auto make_copy(const CopyOperation& operation, | ||
| 65 | + const CopyTrait& trait) | ||
| 66 | + ``` | ||
| 67 | + | ||
| 68 | +## 参数说明 | ||
| 69 | + | ||
| 70 | +**表1** 模板参数说明 | ||
| 71 | + | ||
| 72 | +| 参数名 | 描述 | | ||
| 73 | +| :--- | :--- | | ||
| 74 | +| Atom | `copy_atom`的模板参数,由`make_copy`接口推导得到。 | | ||
| 75 | +| DstTensor | 目的张量类型,需为Tensor API Tensor类型。 | | ||
| 76 | +| SrcTensor | 源张量类型,需为Tensor API Tensor类型。 | | ||
| 77 | +| DstCoord | 目的张量起始坐标类型,也可为`zero_coord`。 | | ||
| 78 | +| SrcCoord | 源张量起始坐标类型,也可为`zero_coord`。 | | ||
| 79 | +| CopyShape | 搬运区域形状的类型。 | | ||
| 80 | +| CopyOperation | 搬运操作对象类型。 | | ||
| 81 | +| CopyTrait | 搬运trait对象类型。 | | ||
| 82 | + | ||
| 83 | +**表2** `copy`接口参数说明 | ||
| 84 | + | ||
| 85 | +| 参数名 | 输入/输出 | 描述 | | ||
| 86 | +| :--- | :---: | :--- | | ||
| 87 | +| atom | 输入 | 搬运原子对象,可由`make_copy`接口构造。 | | ||
| 88 | +| dst | 输出 | 目的Tensor,必须位于Unified Buffer。 | | ||
| 89 | +| src | 输入 | 源Tensor,必须位于Unified Buffer。 | | ||
| 90 | +| dst_coord | 输入 | 搬运区域在目的Tensor中的起始坐标。 | | ||
| 91 | +| src_coord | 输入 | 搬运区域在源Tensor中的起始坐标。 | | ||
| 92 | +| copy_shape | 输入 | 搬运区域的形状,用于指定搬运区域的大小。 | | ||
| 93 | + | ||
| 94 | +**表3** `make_copy`接口参数说明 | ||
| 95 | + | ||
| 96 | +| 参数名 | 输入/输出 | 描述 | | ||
| 97 | +| :--- | :---: | :--- | | ||
| 98 | +| operation | 输入 | 搬运操作对象。Unified Buffer到Unified Buffer搬运取`copy_ub_to_ub{}`。 | | ||
| 99 | +| trait | 输入 | 搬运trait对象。Unified Buffer到Unified Buffer默认取`ub_to_ub_trait_default{}`。 | | ||
| 100 | + | ||
| 101 | +### copy_ub_to_ub说明 | ||
| 102 | + | ||
| 103 | +`copy_ub_to_ub`用于标识Unified Buffer内部的数据搬运通路,其静态`copy`成员负责分发该通路的数据搬运。 | ||
| 104 | + | ||
| 105 | +```cpp | ||
| 106 | +struct copy_ub_to_ub { | ||
| 107 | + template <typename Trait, const Trait& trait, typename... Args> | ||
| 108 | + __aicore__ inline static void copy(const Args&... args); | ||
| 109 | +}; | ||
| 110 | +``` | ||
| 111 | + | ||
| 112 | +### ub_to_ub_trait说明 | ||
| 113 | + | ||
| 114 | +`ub_to_ub_trait`表示Unified Buffer内部搬运的编译期特性,当前不包含可配置成员。`ub_to_ub_trait_default`提供该通路的默认Trait类型和默认值。 | ||
| 115 | + | ||
| 116 | +```cpp | ||
| 117 | +struct ub_to_ub_trait {}; | ||
| 118 | + | ||
| 119 | +struct ub_to_ub_trait_default { | ||
| 120 | + using trait_type = ub_to_ub_trait; | ||
| 121 | + static constexpr const trait_type value = {}; | ||
| 122 | +}; | ||
| 123 | +``` | ||
| 124 | + | ||
| 125 | +## 约束说明 | ||
| 126 | + | ||
| 127 | +- 源和目的Tensor的元素类型必须一致。 | ||
| 128 | +- 支持相同格式间搬运:`ND`、`NDExt`、`DN`、`DNExt`、`NZ`和`ZN`。 | ||
| 129 | +- 搬运长度、块数和Stride需要满足Unified Buffer内部搬运指令约束。 | ||
| 130 | +- 源和目的区域重叠时,需要满足底层搬运指令对地址重叠的限制。 | ||
| 131 | +- 区域搬运的坐标、搬运区域大小及范围必须合法。 | ||
| 132 | + | ||
| 133 | +## 调用示例 | ||
| 134 | + | ||
| 135 | +```cpp | ||
| 136 | +#include "tensor_api/tensor.h" | ||
| 137 | + | ||
| 138 | +using namespace asc::te; | ||
| 139 | + | ||
| 140 | +auto atom = make_copy(copy_ub_to_ub{}, ub_to_ub_trait_default{}); | ||
| 141 | +copy(atom, dst_tensor, src_tensor); | ||
| 142 | +``` | ||
| @@ -0,0 +1,3 @@ | |||
| 1 | +# Unified Buffer内部数据搬运 | ||
| 2 | + | ||
| 3 | +- [copy(Unified Buffer到Unified Buffer数据搬运)](copy_ub_to_ub.md) | ||
| @@ -0,0 +1,23 @@ | |||
| 1 | +# 废弃接口 | ||
| 2 | + | ||
| 3 | +## Layout成员函数 | ||
| 4 | + | ||
| 5 | +- **[layout::Capacity(废弃)](layout_capacity_deprecated.md)** | ||
| 6 | +- **[layout::Shape(废弃)](layout_shape_deprecated.md)** | ||
| 7 | +- **[layout::Stride(废弃)](layout_stride_deprecated.md)** | ||
| 8 | +- **[layout::Rank(废弃)](layout_rank_deprecated.md)** | ||
| 9 | +- **[layout::Size(废弃)](layout_size_deprecated.md)** | ||
| 10 | +- **[layout::Get(废弃)](layout_get_deprecated.md)** | ||
| 11 | + | ||
| 12 | +## Tensor成员函数 | ||
| 13 | + | ||
| 14 | +- **[base_tensor::Tensor(废弃)](tensor_tensor_deprecated.md)** | ||
| 15 | +- **[base_tensor::Engine(废弃)](tensor_engine_deprecated.md)** | ||
| 16 | +- **[base_tensor::Layout(废弃)](tensor_layout_deprecated.md)** | ||
| 17 | +- **[base_tensor::Data(废弃)](tensor_data_deprecated.md)** | ||
| 18 | +- **[base_tensor::Shape(废弃)](tensor_shape_deprecated.md)** | ||
| 19 | +- **[base_tensor::Stride(废弃)](tensor_stride_deprecated.md)** | ||
| 20 | +- **[base_tensor::Size(废弃)](tensor_size_deprecated.md)** | ||
| 21 | +- **[base_tensor::Capacity(废弃)](tensor_capacity_deprecated.md)** | ||
| 22 | +- **[base_tensor::Slice(废弃)](tensor_slice_deprecated.md)** | ||
| 23 | +- **[global_tensor::SetL2CacheHint(废弃)](set_l2_cache_hint_deprecated.md)** | ||
| @@ -0,0 +1,71 @@ | |||
| 1 | +# layout::Capacity(废弃) | ||
| 2 | + | ||
| 3 | +## 产品支持情况 | ||
| 4 | + | ||
| 5 | +<!-- npu="950" id1 --> | ||
| 6 | +- Ascend 950PR/Ascend 950DT:支持 | ||
| 7 | +<!-- end id1 --> | ||
| 8 | +<!-- npu="A3" id2 --> | ||
| 9 | +- Atlas A3训练系列产品/Atlas A3推理系列产品:不支持 | ||
| 10 | +<!-- end id2 --> | ||
| 11 | +<!-- npu="910b" id3 --> | ||
| 12 | +- Atlas A2训练系列产品/Atlas A2推理系列产品:不支持 | ||
| 13 | +<!-- end id3 --> | ||
| 14 | +<!-- npu="310b" id4 --> | ||
| 15 | +- Atlas 200I/500 A2推理产品:不支持 | ||
| 16 | +<!-- end id4 --> | ||
| 17 | +<!-- npu="310p" id5 --> | ||
| 18 | +- Atlas推理系列产品AI Core:不支持 | ||
| 19 | +<!-- end id5 --> | ||
| 20 | +<!-- npu="310p" id6 --> | ||
| 21 | +- Atlas推理系列产品Vector Core:不支持 | ||
| 22 | +<!-- end id6 --> | ||
| 23 | +<!-- npu="910" id7 --> | ||
| 24 | +- Atlas训练系列产品:不支持 | ||
| 25 | +<!-- end id7 --> | ||
| 26 | + | ||
| 27 | +## 功能说明 | ||
| 28 | + | ||
| 29 | +头文件路径为:`tensor_api/tensor.h`。 | ||
| 30 | + | ||
| 31 | +**该接口已废弃,请使用[layout::capacity](../layout/layout.md#capacity)替代。** | ||
废弃说明放在接口说明后面 ![]() ![]() | |||
| 32 | + | ||
| 33 | +返回当前Layout或指定子维度对应布局的实际内存容量,包含由非连续Stride产生的无效数据区域。 | ||
这个描述不太明白,是否可以增加实际说明 ![]() ![]() | |||
| 34 | + | ||
| 35 | +## 函数原型 | ||
| 36 | + | ||
| 37 | +```cpp | ||
| 38 | +template <size_t... I> | ||
| 39 | +__aicore__ inline constexpr decltype(auto) Capacity() const; | ||
| 40 | +``` | ||
| 41 | + | ||
| 42 | +## 参数说明 | ||
| 43 | + | ||
| 44 | +**表1** 模板参数说明 | ||
| 45 | + | ||
| 46 | +| 参数名 | 输入/输出 | 描述 | | ||
| 47 | +| :--- | :---: | :--- | | ||
| 48 | +| I... | 输入 | 模板参数,表示需要访问的子维度索引序列。不指定时处理完整Layout。 | | ||
| 49 | + | ||
| 50 | +## 返回值说明 | ||
| 51 | + | ||
| 52 | +返回当前Layout或指定子维度对应布局的实际容量。 | ||
| 53 | + | ||
| 54 | +## 流水类型 | ||
| 55 | + | ||
| 56 | +无 | ||
| 57 | + | ||
| 58 | +## 约束说明 | ||
| 59 | + | ||
| 60 | +`I...`必须是Layout中的有效索引。 | ||
| 61 | + | ||
| 62 | +## 调用示例 | ||
| 63 | + | ||
| 64 | +```cpp | ||
| 65 | +#include "tensor_api/tensor.h" | ||
| 66 | + | ||
| 67 | +using namespace asc::te; | ||
| 68 | + | ||
| 69 | +auto old_capacity = layout.Capacity(); // 废弃写法 | ||
这里要写废弃写法吗?是不是只聚焦介绍该接口,前面已经说明后续会废弃 ![]() ![]() | |||
| 70 | +auto new_capacity = layout.capacity(); // 替代写法 | ||
| 71 | +``` | ||
| @@ -0,0 +1,74 @@ | |||
| 1 | +# layout::Get(废弃) | ||
| 2 | + | ||
| 3 | +## 产品支持情况 | ||
| 4 | + | ||
| 5 | +<!-- npu="950" id1 --> | ||
| 6 | +- Ascend 950PR/Ascend 950DT:支持 | ||
| 7 | +<!-- end id1 --> | ||
| 8 | +<!-- npu="A3" id2 --> | ||
| 9 | +- Atlas A3训练系列产品/Atlas A3推理系列产品:不支持 | ||
| 10 | +<!-- end id2 --> | ||
| 11 | +<!-- npu="910b" id3 --> | ||
| 12 | +- Atlas A2训练系列产品/Atlas A2推理系列产品:不支持 | ||
| 13 | +<!-- end id3 --> | ||
| 14 | +<!-- npu="310b" id4 --> | ||
| 15 | +- Atlas 200I/500 A2推理产品:不支持 | ||
| 16 | +<!-- end id4 --> | ||
| 17 | +<!-- npu="310p" id5 --> | ||
| 18 | +- Atlas推理系列产品AI Core:不支持 | ||
| 19 | +<!-- end id5 --> | ||
| 20 | +<!-- npu="310p" id6 --> | ||
| 21 | +- Atlas推理系列产品Vector Core:不支持 | ||
| 22 | +<!-- end id6 --> | ||
| 23 | +<!-- npu="910" id7 --> | ||
| 24 | +- Atlas训练系列产品:不支持 | ||
| 25 | +<!-- end id7 --> | ||
| 26 | + | ||
| 27 | +## 功能说明 | ||
| 28 | + | ||
| 29 | +头文件路径为:`tensor_api/tensor.h`。 | ||
| 30 | + | ||
| 31 | +**该接口已废弃,请使用[layout::get](../layout/layout.md#get)替代。** | ||
| 32 | + | ||
| 33 | +按照模板索引从Layout中提取Shape、Stride中的元素或子结构。 | ||
| 34 | + | ||
| 35 | +## 函数原型 | ||
| 36 | + | ||
| 37 | +```cpp | ||
| 38 | +template <size_t... I> | ||
| 39 | +__aicore__ inline constexpr decltype(auto) Get(); | ||
| 40 | + | ||
| 41 | +template <size_t... I> | ||
| 42 | +__aicore__ inline constexpr decltype(auto) Get() const; | ||
| 43 | +``` | ||
| 44 | + | ||
| 45 | +## 参数说明 | ||
| 46 | + | ||
| 47 | +**表1** 模板参数说明 | ||
| 48 | + | ||
| 49 | +| 参数名 | 输入/输出 | 描述 | | ||
| 50 | +| :--- | :---: | :--- | | ||
| 51 | +| I... | 输入 | 模板参数。首个索引0表示Shape,1表示Stride;后续索引用于继续访问嵌套子结构。 | | ||
| 52 | + | ||
| 53 | +## 返回值说明 | ||
| 54 | + | ||
| 55 | +返回指定位置的元素或子结构引用;const重载返回常量引用。 | ||
| 56 | + | ||
| 57 | +## 流水类型 | ||
| 58 | + | ||
| 59 | +无 | ||
| 60 | + | ||
| 61 | +## 约束说明 | ||
| 62 | + | ||
| 63 | +`I...`必须是Layout及其嵌套元组中的有效索引。 | ||
| 64 | + | ||
| 65 | +## 调用示例 | ||
调用示例没表达接口作用,只是展示写法 ![]() ![]() | |||
| 66 | + | ||
| 67 | +```cpp | ||
| 68 | +#include "tensor_api/tensor.h" | ||
| 69 | + | ||
| 70 | +using namespace asc::te; | ||
| 71 | + | ||
| 72 | +auto& old_value = layout.Get<0, 1>(); // 废弃写法 | ||
| 73 | +auto& new_value = layout.get<0, 1>(); // 替代写法 | ||
| 74 | +``` | ||
| @@ -0,0 +1,71 @@ | |||
| 1 | +# layout::Rank(废弃) | ||
| 2 | + | ||
| 3 | +## 产品支持情况 | ||
| 4 | + | ||
| 5 | +<!-- npu="950" id1 --> | ||
| 6 | +- Ascend 950PR/Ascend 950DT:支持 | ||
| 7 | +<!-- end id1 --> | ||
| 8 | +<!-- npu="A3" id2 --> | ||
| 9 | +- Atlas A3训练系列产品/Atlas A3推理系列产品:不支持 | ||
| 10 | +<!-- end id2 --> | ||
| 11 | +<!-- npu="910b" id3 --> | ||
| 12 | +- Atlas A2训练系列产品/Atlas A2推理系列产品:不支持 | ||
| 13 | +<!-- end id3 --> | ||
| 14 | +<!-- npu="310b" id4 --> | ||
| 15 | +- Atlas 200I/500 A2推理产品:不支持 | ||
| 16 | +<!-- end id4 --> | ||
| 17 | +<!-- npu="310p" id5 --> | ||
| 18 | +- Atlas推理系列产品AI Core:不支持 | ||
| 19 | +<!-- end id5 --> | ||
| 20 | +<!-- npu="310p" id6 --> | ||
| 21 | +- Atlas推理系列产品Vector Core:不支持 | ||
| 22 | +<!-- end id6 --> | ||
| 23 | +<!-- npu="910" id7 --> | ||
| 24 | +- Atlas训练系列产品:不支持 | ||
| 25 | +<!-- end id7 --> | ||
| 26 | + | ||
| 27 | +## 功能说明 | ||
| 28 | + | ||
| 29 | +头文件路径为:`tensor_api/tensor.h`。 | ||
| 30 | + | ||
| 31 | +**该接口已废弃,请使用[layout::rank](../layout/layout.md#rank)替代。** | ||
| 32 | + | ||
| 33 | +返回当前Layout或指定子维度的秩。 | ||
| 34 | + | ||
| 35 | +## 函数原型 | ||
| 36 | + | ||
| 37 | +```cpp | ||
| 38 | +template <size_t... I> | ||
| 39 | +__aicore__ inline constexpr decltype(auto) Rank() const; | ||
| 40 | +``` | ||
| 41 | + | ||
| 42 | +## 参数说明 | ||
| 43 | + | ||
| 44 | +**表1** 模板参数说明 | ||
| 45 | + | ||
| 46 | +| 参数名 | 输入/输出 | 描述 | | ||
| 47 | +| :--- | :---: | :--- | | ||
| 48 | +| I... | 输入 | 模板参数,表示需要访问的子维度索引序列。不指定时处理完整Layout。 | | ||
| 49 | + | ||
| 50 | +## 返回值说明 | ||
| 51 | + | ||
| 52 | +返回当前Layout或指定子维度Shape的顶层维度数量。 | ||
| 53 | + | ||
| 54 | +## 流水类型 | ||
| 55 | + | ||
| 56 | +无 | ||
| 57 | + | ||
| 58 | +## 约束说明 | ||
| 59 | + | ||
| 60 | +`I...`必须是Layout中的有效索引。 | ||
| 61 | + | ||
| 62 | +## 调用示例 | ||
| 63 | + | ||
| 64 | +```cpp | ||
| 65 | +#include "tensor_api/tensor.h" | ||
| 66 | + | ||
| 67 | +using namespace asc::te; | ||
| 68 | + | ||
| 69 | +auto old_rank = layout.Rank(); // 废弃写法 | ||
| 70 | +auto new_rank = layout.rank(); // 替代写法 | ||
| 71 | +``` | ||
| @@ -0,0 +1,74 @@ | |||
| 1 | +# layout::Shape(废弃) | ||
| 2 | + | ||
| 3 | +## 产品支持情况 | ||
| 4 | + | ||
| 5 | +<!-- npu="950" id1 --> | ||
| 6 | +- Ascend 950PR/Ascend 950DT:支持 | ||
| 7 | +<!-- end id1 --> | ||
| 8 | +<!-- npu="A3" id2 --> | ||
| 9 | +- Atlas A3训练系列产品/Atlas A3推理系列产品:不支持 | ||
| 10 | +<!-- end id2 --> | ||
| 11 | +<!-- npu="910b" id3 --> | ||
| 12 | +- Atlas A2训练系列产品/Atlas A2推理系列产品:不支持 | ||
| 13 | +<!-- end id3 --> | ||
| 14 | +<!-- npu="310b" id4 --> | ||
| 15 | +- Atlas 200I/500 A2推理产品:不支持 | ||
| 16 | +<!-- end id4 --> | ||
| 17 | +<!-- npu="310p" id5 --> | ||
| 18 | +- Atlas推理系列产品AI Core:不支持 | ||
| 19 | +<!-- end id5 --> | ||
| 20 | +<!-- npu="310p" id6 --> | ||
| 21 | +- Atlas推理系列产品Vector Core:不支持 | ||
| 22 | +<!-- end id6 --> | ||
| 23 | +<!-- npu="910" id7 --> | ||
| 24 | +- Atlas训练系列产品:不支持 | ||
| 25 | +<!-- end id7 --> | ||
| 26 | + | ||
| 27 | +## 功能说明 | ||
| 28 | + | ||
| 29 | +头文件路径为:`tensor_api/tensor.h`。 | ||
| 30 | + | ||
| 31 | +**该接口已废弃,请使用[layout::shape](../layout/layout.md#shape)替代。** | ||
| 32 | + | ||
| 33 | +获取Layout中的Shape对象或指定子维度对应的Shape子结构。 | ||
| 34 | + | ||
| 35 | +## 函数原型 | ||
| 36 | + | ||
| 37 | +```cpp | ||
| 38 | +template <size_t... I> | ||
| 39 | +__aicore__ inline constexpr decltype(auto) Shape(); | ||
| 40 | + | ||
| 41 | +template <size_t... I> | ||
| 42 | +__aicore__ inline constexpr decltype(auto) Shape() const; | ||
| 43 | +``` | ||
| 44 | + | ||
| 45 | +## 参数说明 | ||
| 46 | + | ||
| 47 | +**表1** 模板参数说明 | ||
| 48 | + | ||
| 49 | +| 参数名 | 输入/输出 | 描述 | | ||
| 50 | +| :--- | :---: | :--- | | ||
| 51 | +| I... | 输入 | 模板参数,表示需要访问的子维度索引序列。不指定时处理完整Layout。 | | ||
| 52 | + | ||
| 53 | +## 返回值说明 | ||
| 54 | + | ||
| 55 | +返回Shape对象或其子结构的引用;const重载返回常量引用。 | ||
| 56 | + | ||
| 57 | +## 流水类型 | ||
| 58 | + | ||
| 59 | +无 | ||
| 60 | + | ||
| 61 | +## 约束说明 | ||
| 62 | + | ||
| 63 | +`I...`必须是Shape中的有效索引。 | ||
| 64 | + | ||
| 65 | +## 调用示例 | ||
| 66 | + | ||
| 67 | +```cpp | ||
| 68 | +#include "tensor_api/tensor.h" | ||
| 69 | + | ||
| 70 | +using namespace asc::te; | ||
| 71 | + | ||
| 72 | +auto& old_shape = layout.Shape(); // 废弃写法 | ||
| 73 | +auto& new_shape = layout.shape(); // 替代写法 | ||
| 74 | +``` | ||
| @@ -0,0 +1,71 @@ | |||
| 1 | +# layout::Size(废弃) | ||
| 2 | + | ||
| 3 | +## 产品支持情况 | ||
| 4 | + | ||
| 5 | +<!-- npu="950" id1 --> | ||
| 6 | +- Ascend 950PR/Ascend 950DT:支持 | ||
| 7 | +<!-- end id1 --> | ||
| 8 | +<!-- npu="A3" id2 --> | ||
| 9 | +- Atlas A3训练系列产品/Atlas A3推理系列产品:不支持 | ||
| 10 | +<!-- end id2 --> | ||
| 11 | +<!-- npu="910b" id3 --> | ||
| 12 | +- Atlas A2训练系列产品/Atlas A2推理系列产品:不支持 | ||
| 13 | +<!-- end id3 --> | ||
| 14 | +<!-- npu="310b" id4 --> | ||
| 15 | +- Atlas 200I/500 A2推理产品:不支持 | ||
| 16 | +<!-- end id4 --> | ||
| 17 | +<!-- npu="310p" id5 --> | ||
| 18 | +- Atlas推理系列产品AI Core:不支持 | ||
| 19 | +<!-- end id5 --> | ||
| 20 | +<!-- npu="310p" id6 --> | ||
| 21 | +- Atlas推理系列产品Vector Core:不支持 | ||
| 22 | +<!-- end id6 --> | ||
| 23 | +<!-- npu="910" id7 --> | ||
| 24 | +- Atlas训练系列产品:不支持 | ||
| 25 | +<!-- end id7 --> | ||
| 26 | + | ||
| 27 | +## 功能说明 | ||
| 28 | + | ||
| 29 | +头文件路径为:`tensor_api/tensor.h`。 | ||
| 30 | + | ||
| 31 | +**该接口已废弃,请使用[layout::size](../layout/layout.md#size)替代。** | ||
| 32 | + | ||
| 33 | +返回当前Layout或指定子维度覆盖的有效元素数量。 | ||
| 34 | + | ||
| 35 | +## 函数原型 | ||
| 36 | + | ||
| 37 | +```cpp | ||
| 38 | +template <size_t... I> | ||
| 39 | +__aicore__ inline constexpr decltype(auto) Size() const; | ||
| 40 | +``` | ||
| 41 | + | ||
| 42 | +## 参数说明 | ||
| 43 | + | ||
| 44 | +**表1** 模板参数说明 | ||
| 45 | + | ||
| 46 | +| 参数名 | 输入/输出 | 描述 | | ||
| 47 | +| :--- | :---: | :--- | | ||
| 48 | +| I... | 输入 | 模板参数,表示需要访问的子维度索引序列。不指定时处理完整Layout。 | | ||
| 49 | + | ||
| 50 | +## 返回值说明 | ||
| 51 | + | ||
| 52 | +返回当前Layout或指定子维度对应Shape的元素总数。 | ||
| 53 | + | ||
| 54 | +## 流水类型 | ||
| 55 | + | ||
| 56 | +无 | ||
| 57 | + | ||
| 58 | +## 约束说明 | ||
| 59 | + | ||
| 60 | +`I...`必须是Layout中的有效索引。 | ||
| 61 | + | ||
| 62 | +## 调用示例 | ||
| 63 | + | ||
| 64 | +```cpp | ||
| 65 | +#include "tensor_api/tensor.h" | ||
| 66 | + | ||
| 67 | +using namespace asc::te; | ||
| 68 | + | ||
| 69 | +auto old_size = layout.Size(); // 废弃写法 | ||
| 70 | +auto new_size = layout.size(); // 替代写法 | ||
| 71 | +``` | ||
Rdocs/zh/api/SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Capacity.md→docs/zh/api/SIMD-API/tensor_api/layout/capacity.md+24-26
Rdocs/zh/api/SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Coshape.md→docs/zh/api/SIMD-API/tensor_api/layout/coshape.md+18-20
Rdocs/zh/api/SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Cosize.md→docs/zh/api/SIMD-API/tensor_api/layout/cosize.md+20-22
Rdocs/zh/api/SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Get.md→docs/zh/api/SIMD-API/tensor_api/layout/get.md+26-26
Rdocs/zh/api/SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/GetShape.md→docs/zh/api/SIMD-API/tensor_api/layout/get_shape.md+21-26
Rdocs/zh/api/SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/GetStride.md→docs/zh/api/SIMD-API/tensor_api/layout/get_stride.md+21-26
Rdocs/zh/api/SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Layout.md→docs/zh/api/SIMD-API/tensor_api/layout/layout.md+100-116
Rdocs/zh/api/SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/MakeCoord.md→docs/zh/api/SIMD-API/tensor_api/layout/make_coord.md+23-19
Rdocs/zh/api/SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/MakeLayout.md→docs/zh/api/SIMD-API/tensor_api/layout/make_layout.md+26-28
Rdocs/zh/api/SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/MakeShape.md→docs/zh/api/SIMD-API/tensor_api/layout/make_shape.md+20-18
Rdocs/zh/api/SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/MakeStride.md→docs/zh/api/SIMD-API/tensor_api/layout/make_stride.md+20-18
Rdocs/zh/api/SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Rank.md→docs/zh/api/SIMD-API/tensor_api/layout/rank.md+16-18
Rdocs/zh/api/SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Select.md→docs/zh/api/SIMD-API/tensor_api/layout/select.md+15-17
Rdocs/zh/api/SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Shape.md→docs/zh/api/SIMD-API/tensor_api/layout/shape.md+8-13
Rdocs/zh/api/SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Size.md→docs/zh/api/SIMD-API/tensor_api/layout/size.md+14-15
Rdocs/zh/api/SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Squeeze.md→docs/zh/api/SIMD-API/tensor_api/layout/squeeze.md+37-37
Rdocs/zh/api/SIMD-API/basic_api/data_structure_TensorAPI/layout_structure/Stride.md→docs/zh/api/SIMD-API/tensor_api/layout/stride.md+8-13
Rdocs/zh/api/SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_load/Copy_GMToL1.md→docs/zh/api/SIMD-API/tensor_api/matrix_compute/cube_compute_load/copy_gm_to_l1.md+132-88
Rdocs/zh/api/SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_load/Copy_L1ToL0B.md→docs/zh/api/SIMD-API/tensor_api/matrix_compute/cube_compute_load/copy_l1_to_l0b.md+110-52
Rdocs/zh/api/SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_load/Copy_L1ToL0ScaleA.md→docs/zh/api/SIMD-API/tensor_api/matrix_compute/cube_compute_load/copy_l1_to_l0scalea.md+89-33
Rdocs/zh/api/SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_load/Copy_L1ToL0ScaleB.md→docs/zh/api/SIMD-API/tensor_api/matrix_compute/cube_compute_load/copy_l1_to_l0scaleb.md+89-33
Rdocs/zh/api/SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_load/overall_description.md→docs/zh/api/SIMD-API/tensor_api/matrix_compute/cube_compute_load/overall_description.md+0-0
Rdocs/zh/api/SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_store/Copy_L0CToGM.md→docs/zh/api/SIMD-API/tensor_api/matrix_compute/cube_compute_store/copy_l0c_to_gm.md+181-112
Rdocs/zh/api/SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_store/Copy_L0CToUB.md→docs/zh/api/SIMD-API/tensor_api/matrix_compute/cube_compute_store/copy_l0c_to_ub.md+171-96
Rdocs/zh/api/SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_store/overall_description.md→docs/zh/api/SIMD-API/tensor_api/matrix_compute/cube_compute_store/overall_description.md+0-0
Rdocs/zh/api/SIMD-API/basic_api/cube_compute_TensorAPI/cube_store_key_features/batch_copy.md→docs/zh/api/SIMD-API/tensor_api/matrix_compute/cube_store_key_features/batch_copy.md+13-13
Rdocs/zh/api/SIMD-API/basic_api/cube_compute_TensorAPI/cube_store_key_features/cube_store_key_features.md→docs/zh/api/SIMD-API/tensor_api/matrix_compute/cube_store_key_features/cube_store_key_features.md+0-0
Rdocs/zh/api/SIMD-API/basic_api/cube_compute_TensorAPI/cube_store_key_features/f32_channel_split.md→docs/zh/api/SIMD-API/tensor_api/matrix_compute/cube_store_key_features/f32_channel_split.md+16-14
Rdocs/zh/api/SIMD-API/basic_api/cube_compute_TensorAPI/cube_store_key_features/int8_channel_merge.md→docs/zh/api/SIMD-API/tensor_api/matrix_compute/cube_store_key_features/int8_channel_merge.md+0-0
Rdocs/zh/api/SIMD-API/basic_api/cube_compute_TensorAPI/cube_store_key_features/l0c_to_ub_dual_dst.md→docs/zh/api/SIMD-API/tensor_api/matrix_compute/cube_store_key_features/l0c_to_ub_dual_dst.md+35-29
Rdocs/zh/api/SIMD-API/basic_api/cube_compute_TensorAPI/cube_store_key_features/quant_pre.md→docs/zh/api/SIMD-API/tensor_api/matrix_compute/cube_store_key_features/quant_pre.md+9-9
Rdocs/zh/api/SIMD-API/basic_api/cube_compute_TensorAPI/cube_compute_TensorAPI.md→docs/zh/api/SIMD-API/tensor_api/matrix_compute/matrix_compute.md+9-10
Rdocs/zh/api/SIMD-API/basic_api/cube_compute_TensorAPI/mmad_compute/Mmad.md→docs/zh/api/SIMD-API/tensor_api/matrix_compute/mmad_compute/mmad.md+133-92
Rdocs/zh/api/SIMD-API/basic_api/cube_compute_TensorAPI/mmad_compute_key_features/GEMV.md→docs/zh/api/SIMD-API/tensor_api/matrix_compute/mmad_compute_key_features/gemv.md+32-30
Rdocs/zh/api/SIMD-API/basic_api/cube_compute_TensorAPI/mmad_compute_key_features/HF32.md→docs/zh/api/SIMD-API/tensor_api/matrix_compute/mmad_compute_key_features/hf32.md+15-14
Rdocs/zh/api/SIMD-API/basic_api/cube_compute_TensorAPI/overview/overview.md→docs/zh/api/SIMD-API/tensor_api/matrix_compute/overview.md+7-8
Rdocs/zh/api/SIMD-API/basic_api/data_structure_TensorAPI/tensor_structure/MakeMemPtr.md→docs/zh/api/SIMD-API/tensor_api/tensor/make_mem_ptr.md+47-47
Rdocs/zh/api/SIMD-API/basic_api/data_structure_TensorAPI/tensor_structure/MakeTensor.md→docs/zh/api/SIMD-API/tensor_api/tensor/make_tensor.md+27-24
Rdocs/zh/api/SIMD-API/basic_api/data_structure_TensorAPI/tensor_structure/Slice.md→docs/zh/api/SIMD-API/tensor_api/tensor/slice.md+30-30
Rdocs/zh/api/SIMD-API/basic_api/data_structure_TensorAPI/tensor_structure/Tensor.md→docs/zh/api/SIMD-API/tensor_api/tensor/tensor.md+140-104
Rdocs/zh/api/SIMD-API/basic_api/data_structure_TensorAPI/tensor_structure/ViewEngine.md→docs/zh/api/SIMD-API/tensor_api/tensor/view_engine.md+38-28
Rdocs/zh/api/SIMD-API/basic_api/data_structure_TensorAPI/utils/GetLayoutPattern.md→docs/zh/api/SIMD-API/tensor_api/utils/get_layout_pattern.md+22-21


这里需要体现不支持的产品吗