Compare commits

...
847 Commits
Author SHA1 Message Date
i-robot f88a00a21a !2470 [Feature] Add testcase for custom operator npu_multi_head_attention
Merge pull request !2470 from rui_everAfter/mha
2023-03-08 06:19:57 +00:00
i-robot 56f3bb219b !2465 [Feature] Add testcase for custom operator npu_lstm
Merge pull request !2465 from rui_everAfter/analysis-0228
2023-03-08 06:19:06 +00:00
i-robot a538497f59 !2484 [Feature] Add NpuFusedAdamW and fused clip_grad_norm()
Merge pull request !2484 from 郭鹏/feature/v1.11.0-fusedoptim
2023-03-08 06:15:54 +00:00
i-robot 19cd190e3f !2468 Add seq id in CallStack.
Merge pull request !2468 from 裘凯达/master
2023-03-07 01:36:10 +00:00
i-robot 0b2ab39356 !2512 [Fix] modify onnx export of npu_dropout_with_add_softmax op.
Merge pull request !2512 from Zhang Yingxin/up_master
2023-03-06 13:32:16 +00:00
i-robot 603afe6766 !2500 [fix] fix datadump bugs
Merge pull request !2500 from xudaohong/master
2023-03-06 12:23:27 +00:00
zhang-aurora ae8127baa1 modify onnx export of npu_dropout_with_add_softmax op 2023-03-04 14:53:04 +08:00
x00430237 4ecb83fbce [fix] fix datadump bugs 2023-03-04 14:42:52 +08:00
gp513 512ee2b65b supports fused optimizer AdamW and fused clip_grad_norm
bugfix
2023-03-04 10:33:02 +08:00
i-robot f5e0cc1f07 !2505 [Feature] Add onnx export of npu_gru
Merge pull request !2505 from Zhang Yingxin/add_ops
2023-03-03 09:51:15 +00:00
zhang-aurora e926388805 Add onnx export of npu_gru 2023-03-03 16:55:05 +08:00
王铭锐 2d4d1e5a1b Add testcase for custom operator npu_lstm 2023-03-03 11:25:08 +08:00
i-robot 4fde9fa1b9 !2499 [Feature] part2: add custom ops wrapper to export onnx
Merge pull request !2499 from Zhang Yingxin/add_ops
2023-03-03 03:15:29 +00:00
i-robot 3cec1c1cfe !2451 [Refactor]remove BUILD_LIBTORCH compiler options from the header file of libtorch_npu.
Merge pull request !2451 from huangyunlong/feature_libtorch
2023-03-03 03:02:41 +00:00
王铭锐 f532c9b752 Add testcase for custom operator npu_multi_head_attention 2023-03-03 11:02:22 +08:00
zhang-aurora 906726d910 add custom ops wrapper to export onnx 2023-03-03 10:16:36 +08:00
i-robot d36d0ec290 !2489 Don't split oversize cached blocks in memory management.
Merge pull request !2489 from 闫鹏全/master
2023-03-02 12:41:50 +00:00
i-robot 77b6fb806e !2485 [Feature] Combined onnx ops export and testcases
Merge pull request !2485 from Zhang Yingxin/local_master
2023-03-02 12:16:25 +00:00
i-robot cb1d8a2c28 !2493 Optimize the performance of the pow operator.
Merge pull request !2493 from 郑亚金/master_zyj_pow_mul_0302
2023-03-02 12:13:40 +00:00
闫鹏全 42af859b44 Don't split oversize cached blocks. 2023-03-02 18:47:26 +08:00
zhang-aurora 38a0e62a3e Combined onnx ops export and testcases 2023-03-02 17:13:13 +08:00
郑亚金 ddee779f77 When the operand of the pow operator is of the scalar is two, call the mul operator. 2023-03-02 14:27:30 +08:00
i-robot 756dbca545 !2480 [BugFix]Full operation fill with dtype inferred from fill_value.
Merge pull request !2480 from 邵非凡/full-1.11
2023-03-02 03:27:26 +00:00
i-robot d4626a9fa0 !2467 [Feature] Allow user to specify a fraction of the NPU memory.
Merge pull request !2467 from 闫鹏全/redo_fraction
2023-03-02 03:23:37 +00:00
cudi 28a1634b9a Add seq number in CallStack. 2023-03-02 10:24:35 +08:00
i-robot 46667a35f1 !2475 [BugFix]e2e profiling compatible with old lite-profiling
Merge pull request !2475 from 王恒/master-local-3
2023-03-01 11:09:35 +00:00
邵非凡 31a1abcedd Full operation fill with dtype inferred from fill_value. 2023-03-01 16:19:44 +08:00
i-robot 4e10b42dcb !2479 Add allgather_base function
Merge pull request !2479 from hanjun/master
2023-03-01 07:27:46 +00:00
wang--heng 68935fd96f e2e profiling compatible with old lite-profiling 2023-03-01 12:18:46 +08:00
尤安升 79131f0ed7 update OWNERS. 2023-03-01 03:50:44 +00:00
h00558267 195973bfaa Add allgather_base
Add allgather_base
2023-03-01 09:27:28 +08:00
i-robot 7e42915d22 !2453 [Fix] optimize error message in hccl.
Merge pull request !2453 from 施博/fix_hccl
2023-03-01 01:17:38 +00:00
i-robot 6fb2529e7b !2438 [Feature] Export ONNX for combined ops
Merge pull request !2438 from Zhang Yingxin/local_master
2023-02-28 13:06:54 +00:00
i-robot 026318d011 !2463 Add per-device allocator object.
Merge pull request !2463 from 闫鹏全/master
2023-02-28 12:35:58 +00:00
i-robot 0c84bc5ac1 !2448 Supports torch.distributed._reduce_scatter_base() on NPU
Merge pull request !2448 from 郭鹏/feature/_reduce_scatter_base
2023-02-28 12:30:31 +00:00
i-robot 170b08e0d2 !2424 [Feature] Add switch allowinternalformat to enable internal format or ND format
Merge pull request !2424 from 王强/master
2023-02-28 12:23:46 +00:00
闫鹏全 0fb902e015 Add memory fraction function for NPU memory management. 2023-02-28 17:18:41 +08:00
i-robot 06b60acb9e !2403 [Feature] Add tests for npu_grid_assign_positive and npu_convolution_transpose.
Merge pull request !2403 from 叶灵煜/custom_op_0222
2023-02-28 09:03:20 +00:00
i-robot 0f17858241 !2406 [Feature] Add base support for fused optimizer and add fused SGD
Merge pull request !2406 from lj_new/master
2023-02-28 07:24:02 +00:00
zhang-aurora 24bb368bcc Export ONNX for combined ops 2023-02-28 15:07:07 +08:00
闫鹏全 95ae807b6d Add per-device allocator object. 2023-02-28 14:56:10 +08:00
shibo19 f118eb1083 optimize error message in hccl 2023-02-28 14:43:35 +08:00
gp513 7e09a22788 supports torch.distributed._reduce_scatter_base()
bugfix
2023-02-28 14:38:37 +08:00
lijing 144bc77742 Add base support for fused optimizer, add fused sgd
Use raise error method instead of abstractmethod

Use enumerate instead of range

Move fused optimizer to torch_npu

Rename fused optimizer to npu fused optimizer

Rename fused sgd to npu fused sgd

Remove unused arguments
2023-02-28 14:33:23 +08:00
i-robot 5122896b91 !2423 [BugFix] API get_device_properties compatibility is maintained with CUDA
Merge pull request !2423 from yangxiaorun/bugfix_get_device_properties
2023-02-28 06:21:51 +00:00
i-robot 32d70b4038 !2434 Add testcase for npu_pad, npu_ptiou and sign_bits_umpack.
Merge pull request !2434 from shaoyf/onnx_testcase_1
2023-02-28 06:11:39 +00:00
huangyunlong 5663059394 [Refactor]remove BUILD_LIBTORCH compiler options from the header file of libtorch. 2023-02-28 11:02:32 +08:00
i-robot 96b8b009a2 !2454 use correct param when calling assert_never in get_kernel
Merge pull request !2454 from dilililiwhy/master
2023-02-28 01:44:51 +00:00
i-robot 6900aae386 !2450 Update the configuration information of BiShengCPP.
Merge pull request !2450 from shaoyf/bishengcpp_test_1
2023-02-27 13:01:18 +00:00
i-robot 6523535ba9 !2457 [BugFix] restore old e2e profiling
Merge pull request !2457 from 王恒/master-local-2
2023-02-27 12:18:15 +00:00
wang--heng 9f68ec2cbb restore old e2e profiling 2023-02-27 19:22:08 +08:00
dilililiWhy 8eddb4b6a3 use correct param when calling assert_never in get_kernel 2023-02-27 18:07:49 +08:00
叶灵煜 d338cd358c Add testcases for custom torch_npu ops.
Signed-off-by: 叶灵煜 <yelingyu@huawei.com>
2023-02-27 16:37:27 +08:00
i-robot 938fb1f720 !2331 [Feature] Add test for npu_conv2d, npu_conv3d and npu_conv_transpose2d.
Merge pull request !2331 from 杜金航/master
2023-02-27 08:11:30 +00:00
i-robot 7bef164a6d !2446 Refactor codegen & make sure clean of setup succeed.
Merge pull request !2446 from 尤安升/master
2023-02-27 07:35:39 +00:00
尤安升 df2f34de5b Refactor codegen & make sure clean of setup succeed. 2023-02-27 14:35:49 +08:00
shaoyf fb8e4aaf13 Update the configuration information of BiShengCPP. 2023-02-27 11:25:58 +08:00
wq160 416303682f [Feature] Add switch allow_internal_format to enable internal format or ND format 2023-02-27 10:36:17 +08:00
i-robot 2383422b68 !2397 [BugFix] Fix embedding_bag in 0D scenario.
Merge pull request !2397 from 戢芳/embedding1.11
2023-02-27 01:24:36 +00:00
i-robot c779c72c50 !2327 Relax the interception condition of Index operator.
Merge pull request !2327 from 刘哲续/master
2023-02-26 08:18:34 +00:00
尤安升 750ff7fe4f Remove unused code. 2023-02-25 16:38:18 +08:00
i-robot 81d672880e !2443 Relocate c10d headers according to origin pytorch.
Merge pull request !2443 from 尤安升/master
2023-02-25 07:10:02 +00:00
尤安升 4afddfcb8f Relocate c10d headers according to origin pytorch. 2023-02-25 14:10:03 +08:00
i-robot 0e515a7f2a !2432 [Fix] fix libtorch build bug
Merge pull request !2432 from 施博/up_master_build
2023-02-24 03:59:16 +00:00
shaoyf 219738354c Add testcase for npu_pad, npu_ptiou and sign_bits_umpack. 2023-02-24 11:40:50 +08:00
shibo19 185b7b4e0a fix libtorch build bug 2023-02-24 10:32:40 +08:00
yangxiaorun 0a0b9bb852 fix: [BugFix] API compatibility is maintained with CUDA 2023-02-24 09:46:28 +08:00
i-robot c007ee1cbe !2360 [Fix] Update version 3.0.0 ReleaseNote .
Merge pull request !2360 from 彭子荣/master
2023-02-23 12:37:33 +00:00
i-robot f7357be81e !2318 [Feature] Upgrade replication_pad2d&reflection_pad2d to support 3D input.
Merge pull request !2318 from 戢芳/pad1.11
2023-02-23 12:28:30 +00:00
i-robot f3735572a7 !2417 [bugfix] Fix uniform kernel error.
Merge pull request !2417 from will-devil/bfmdev
2023-02-23 12:19:38 +00:00
i-robot adc1109bd6 !2396 [Fix]index_put supports the tensors of the input for different devices
Merge pull request !2396 from 王夏夏/master
2023-02-23 12:14:35 +00:00
i-robot a138577098 !2412 [Bugfix] Add “enable_overflow_npu” api for V2 interface of overflow detection.
Merge pull request !2412 from 谭親林/master
2023-02-23 09:22:40 +00:00
wangyicheng d8bdf54268 Fix uniform kernel error. 2023-02-23 17:00:04 +08:00
i-robot 8e08b7fb4c !2410 e2e profiling performance optimization
Merge pull request !2410 from 王恒/master-local
2023-02-23 08:18:55 +00:00
i-robot 7f787ff8d2 !2390 [Feature] Add tests for npu_fused_attention_layernorm_qkv_fwd, npu_convolution, fast_gelu, and npu_format_cast.
Merge pull request !2390 from 叶灵煜/custom_op_0221
2023-02-23 07:35:25 +00:00
i-robot dd8769799b !2401 [Fix]Improve test cases for npu_strided_copy.
Merge pull request !2401 from huangyunlong/feature_hyl
2023-02-23 07:33:42 +00:00
i-robot a27540b719 !2407 [Feature] Add test for npu_scatter.
Merge pull request !2407 from will-devil/scatterdev
2023-02-23 07:27:15 +00:00
i-robot af5e0f5dd9 !2387 [Feature] Add test for npu_layer_norm_eval.
Merge pull request !2387 from will-devil/layerdev
2023-02-23 07:26:50 +00:00
xiaxia3 68f90c1b80 [Fix]index_put supports the tensors of the input for different devices 2023-02-23 15:15:35 +08:00
tanqinlin 12068adce8 [Fix] add interface for overflow enable switch. 2023-02-23 14:40:28 +08:00
i-robot 0413b53608 !2354 ApplyAdamW adaptation
Merge pull request !2354 from 郑亚金/master_zyj_applyadamw_adaptation
2023-02-23 06:09:52 +00:00
wang--heng 1d6fc4fdcc e2e profiling optimization 2023-02-23 10:52:23 +08:00
i-robot fa1a698e7d !2352 [Fix] fix build shell bug on ubuntu with dash
Merge pull request !2352 from 施博/fix_build_shell
2023-02-23 02:02:43 +00:00
shibo19 eb13e4af2b fix build shell bug in ubuntu with dash 2023-02-23 09:52:37 +08:00
郑亚金 569eacd08c ApplyAdamW adaptation. 2023-02-23 09:43:20 +08:00
i-robot 64d507f32c !2404 [Bugfix] Check aclrtSetOpWaitTimeout interface.
Merge pull request !2404 from darin123/master
2023-02-23 01:34:26 +00:00
i-robot fd87b7f678 !2411 [Revert] Revert npu memory management.
Merge pull request !2411 from 闫鹏全/master
2023-02-22 12:30:22 +00:00
闫鹏全 ef47a4d8e3 Revert npu memory management. 2023-02-22 19:14:18 +08:00
i-robot 59bf37805f !2378 [Feature] Add test for npu_anchor_response_flags, npu_roi_align and npu_nms_rotated.
Merge pull request !2378 from huangyunlong/1.11npu
2023-02-22 07:51:45 +00:00
i-robot 6577976e8d !2348 [Feature] Add tests for npu_confusion_transpose, npu_ps_roi_pooling, and npu_softmax_cross_entropy_with_logits.
Merge pull request !2348 from 叶灵煜/custom_op_0216
2023-02-22 07:40:37 +00:00
i-robot 8ce20fe213 !2351 [Feature] Add testcases for npu_broadcast, npu_transpos, one_ and npu_one_hot
Merge pull request !2351 from Zhang Yingxin/local_master
2023-02-22 07:37:11 +00:00
wangyicheng ae965f2075 Add test for npu_scatter. 2023-02-22 15:29:25 +08:00
anping 11fc2307fb [Bugfix] Check aclrtSetOpWaitTimeout interface. 2023-02-22 14:10:44 +08:00
huangyunlong 3e5d81d509 [Fix]Improve test cases for npu_strided_copy. 2023-02-22 11:15:32 +08:00
pipihugh 7d4457922b Fix embedding_bag in 0D scenario. 2023-02-22 11:13:45 +08:00
wangyicheng bdae65f5b1 Add test for npu_layer_norm_eval 2023-02-22 09:59:12 +08:00
叶灵煜 181eec7fbc Add testcases for custom torch_npu ops. 2023-02-22 09:23:18 +08:00
i-robot 4dc80c4a96 !2381 [Feature] Allow user to specify a fraction of the NPU memory.
Merge pull request !2381 from 闫鹏全/fraction
2023-02-21 11:44:24 +00:00
i-robot 1ce31cec98 !2283 Upgrade syncbn_forward.
Merge pull request !2283 from 王夏夏/master
2023-02-21 08:39:13 +00:00
i-robot 47285663c7 !2286 [Fix]Index supports the tensors of the input for different devices.
Merge pull request !2286 from 王夏夏/master
2023-02-21 08:39:00 +00:00
i-robot ff1a542a04 !2305 [Feature] Add test for npu_stride_copy and npu_sort_v2.
Merge pull request !2305 from huangyunlong/feature_hyl
2023-02-21 08:38:30 +00:00
huangyunlong 5078ed052f [Feature] Add test for npu_anchor_response_flags, npu_roi_align and npu_nms_rotated 2023-02-21 16:19:07 +08:00
i-robot c4965940ae !2367 [Fix] Optimize Taskqueue
Merge pull request !2367 from 詹昊/taskqueue
2023-02-21 07:09:34 +00:00
zhanhao dffec8246c Optimize taskqueue. 2023-02-21 14:44:08 +08:00
i-robot e0c1ae859c !2385 [Feature] Register CPU backend.
Merge pull request !2385 from will-devil/cpudev2
2023-02-21 03:17:12 +00:00
闫鹏全 41814ccec9 Add memory fraction function for NPU memory management. 2023-02-21 10:55:09 +08:00
i-robot 517633ddab !2365 [Fix] Warning once when cast dtype to double.
Merge pull request !2365 from 刘嘉巍/ops
2023-02-21 02:04:29 +00:00
i-robot 88d08ed069 !2374 Report CANN opName to MsProfiler with TASK_QUEUE_ENABLE=1
Merge pull request !2374 from 裘凯达/master
2023-02-21 01:56:18 +00:00
i-robot 805722b01a !2353 Add per-device allocator object.
Merge pull request !2353 from 闫鹏全/master
2023-02-21 01:55:46 +00:00
wangyicheng e14cc14023 Register CPU backend. 2023-02-20 11:08:48 +08:00
cudi a5ac48d964 Report CANN opName to MsProfiler with TASK_ENABLE_ENABLE=1. 2023-02-20 10:37:20 +08:00
pipihugh 223f14ac04 Upgrade replication_pad2d&reflection_pad2d to support 3D input. 2023-02-20 10:25:13 +08:00
i-robot cb5e7854c5 !2133 [Refactor] Gen default value for C++ API and Correct backend from yaml.
Merge pull request !2133 from will-devil/defaultdev
2023-02-20 01:35:30 +00:00
叶灵煜 ecb82ae3f0 Add testcases for custom torch_npu ops.
Signed-off-by: 叶灵煜 <yelingyu@huawei.com>
2023-02-19 18:35:02 +08:00
闫鹏全 adf91cf9cc Add per-device allocator object. 2023-02-18 17:11:53 +08:00
刘嘉巍 050a42f571 warn_once when cast double dtype 2023-02-18 11:44:17 +08:00
i-robot ccd25e5ceb !2333 [Feature] Add test for npu bounding box encode and decode.
Merge pull request !2333 from 刘嘉巍/ops
2023-02-17 09:09:04 +00:00
Zhang Yingxin e7cdb7395c Add onnx export operators file and test cases 2023-02-17 17:07:56 +08:00
i-robot 2bc784b27d !2292 Fix input device for get_rng_state and set_rng_state.
Merge pull request !2292 from shaoyf/fix/get_rng_state
2023-02-17 09:06:30 +00:00
pengzirong 30ea9fc4e3 更新3.0.0版本RELEASENOT 2023-02-17 16:59:57 +08:00
huangyunlong 58416fc03b [Feature] Add test for npu_strided_copy and npu_sort_v2. 2023-02-17 11:42:09 +08:00
wangyicheng 4356839fd9 Gen default value for C++ API and Correct backend from yaml. 2023-02-17 10:29:12 +08:00
i-robot 4618bf1eec !2308 [Feature] Add test for npu_ifmr, npu_max.dim, npu_max.names_dim, npu_bmmV2 and npu_dtype_cast.
Merge pull request !2308 from 叶灵煜/custom_op_0215
2023-02-16 13:03:57 +00:00
i-robot 86773348c6 !2344 [FIX] Torch_npu is compatible for rts feature err.
Merge pull request !2344 from darin123/master
2023-02-16 12:36:08 +00:00
dujinhang fb86cd4adb [Feature] add test for npu_conv2d, npu_conv3d and npu_conv_transpose2d. 2023-02-16 19:13:39 +08:00
i-robot 71ec59af34 !2325 Test npu_slice, npu_indexing and npu_stride_add.
Merge pull request !2325 from Leon/master
2023-02-16 09:27:45 +00:00
i-robot e2cdd05214 !2316 [bugfix] Fix uniform kernel forward error.
Merge pull request !2316 from will-devil/uniformdev
2023-02-16 09:24:12 +00:00
i-robot 33274e2f7f !2312 [Fix] Fix the deadlock in taskqueue
Merge pull request !2312 from 詹昊/master
2023-02-16 08:51:46 +00:00
anping c98e57cf82 [FIX] Torch_npu is compatible for rts feature err. 2023-02-16 16:21:19 +08:00
叶灵煜 1c3af9d9d7 Add testcases for custom torch_npu ops.
Signed-off-by: 叶灵煜 <yelingyu@huawei.com>
2023-02-16 14:33:53 +08:00
刘嘉巍 4cb2bd9c14 Test npu bounding box encode & decode 2023-02-16 13:23:17 +08:00
i-robot 85efdd3570 !2287 [Feature] Add combine tensor related APIs used for NpuFusedOptimizers
Merge pull request !2287 from 郭鹏/feature/v1.11.0-combine
2023-02-16 03:39:28 +00:00
刘哲续 f49a5963f5 Relax interception conditions. 2023-02-16 10:33:05 +08:00
liangyunfan 6d4beb57d4 Test npu_indexing, npu_slice and npu_stride_add. 2023-02-15 17:53:33 +08:00
zhanhao 3eabfefbda Fix the deadlock in taskqueue 2023-02-15 15:36:43 +08:00
i-robot 4eba282bf6 !2290 Optimize im2col to support 3D input.
Merge pull request !2290 from 戢芳/im2col1.11
2023-02-15 07:35:35 +00:00
gp513 bd1768767c add npu_combine_tensors() for NpuFusedOptimizer
rename combine as combine_tensors and moved to torch_npu/utils

fix init in torch_npu/npu
2023-02-15 14:39:02 +08:00
wangyicheng a0f5177f80 Fix uniform kernel forward error. 2023-02-15 14:18:38 +08:00
i-robot 4f9dad9047 !2297 [Feature] Libtorch: add shell to build libtorch_npu without python.
Merge pull request !2297 from 施博/libtorch_up_master
2023-02-15 03:56:32 +00:00
i-robot d10347340e !2273 [stream feat] add stream failure mode.
Merge pull request !2273 from darin123/master
2023-02-14 02:51:42 +00:00
i-robot b09d3b94d6 !2080 [Fix]Fix the input tensor src_stride under aicore mode.
Merge pull request !2080 from 於欣洁/master_vc0107
2023-02-14 02:03:36 +00:00
pipihugh 98638b44ec Optimize im2col to support 3D input. 2023-02-14 09:49:33 +08:00
i-robot 775e0998fa !2288 [Feature] Add test for npu_reshape and npu_iou.
Merge pull request !2288 from 刘嘉巍/ops
2023-02-13 14:16:33 +00:00
i-robot ec8f8d9baf !2298 Modify function name of Call Stack.
Merge pull request !2298 from 裘凯达/aic_def_master
2023-02-13 14:15:59 +00:00
shibo19 aad94342bf add shell for building libtorch_npu without python 2023-02-13 20:57:03 +08:00
cudi 2c5467d884 Modify name For Call Stack. 2023-02-13 19:53:04 +08:00
00817228 9af82239b1 Fix the input tensor src_stride under aicore mode. 2023-02-13 19:45:51 +08:00
anping 0d99ec1c95 [Stream feat] Add stream failure mode. 2023-02-13 17:24:22 +08:00
i-robot 553fee0239 !2280 [Fix] Fix no attribute python_exit_status.
Merge pull request !2280 from 龚俊强/master
2023-02-13 08:25:58 +00:00
刘嘉巍 fee91ebf65 Test npu_reshape & npu_iou 2023-02-13 16:21:25 +08:00
xiaxia3 cc3103a295 Index supports the tensors of the input for different devices. 2023-02-13 15:54:48 +08:00
shaoyf 3b45846a51 Fix input device for get_rng_state and set_rng_state. 2023-02-13 15:10:16 +08:00
i-robot 318c393bce !2192 Fix output shape of lstm_backward.
Merge pull request !2192 from 郑亚金/master_zyj_11_lstm
2023-02-11 09:10:25 +00:00
郑亚金 2d4d9718bd Fix output shape of lstm_backward. 2023-02-11 15:57:25 +08:00
junqiang521 39b204a6e6 Master version upgrade, update _shutdown_workers 2023-02-11 12:26:12 +08:00
xiaxia3 f4c6b6094e Upgrade syncbn_forward. 2023-02-11 09:57:05 +08:00
i-robot 430c5c2f94 !2276 [Fix] fix isinstance bug in transfer_to_npu tools
Merge pull request !2276 from 施博/master_instance
2023-02-10 10:33:39 +00:00
shibo19 418b3a3984 fix isinstance bug in transfer_to_npu tools 2023-02-10 17:24:44 +08:00
i-robot 9ed6e41198 !2271 [Fix] fix device constructor bug
Merge pull request !2271 from 施博/device_master
2023-02-10 09:17:15 +00:00
shibo19 97264f66ec fix device ctor bug 2023-02-10 14:40:23 +08:00
i-robot fd1a22a26c !2252 Change the default value of AiCore Metrics with ACL_AICORE_PIPE_UTILIZATION.
Merge pull request !2252 from 裘凯达/aic_def_master
2023-02-10 02:32:43 +00:00
cudi 604e8415a4 Modify the default value of AICore Metrics with ACL_AICORE_PIPE_UTILIZATION. 2023-02-09 20:47:37 +08:00
i-robot a312794efe !2248 [Fix] parameter parsing error when 'device=None'.
Merge pull request !2248 from 杜金航/master
2023-02-09 12:37:19 +00:00
i-robot ebc77698bd !2240 Report CallStack to MsProfiler.
Merge pull request !2240 from 裘凯达/master_pt
2023-02-09 10:59:33 +00:00
i-robot f2fffab19a !2174 Torch.load supports npu tensor load to cpu.
Merge pull request !2174 from 闫鹏全/master
2023-02-08 06:54:43 +00:00
dujinhang 53fbed4d35 [Fix] parameter parsing error when 'device=None'. 2023-02-08 14:32:17 +08:00
i-robot 85bca4946f !2235 Add Attr of Swish.
Merge pull request !2235 from 戢芳/swish1.11
2023-02-08 03:37:30 +00:00
i-robot 920d88ac28 !2225 Fix clamp in int64 scenario.
Merge pull request !2225 from 戢芳/clamp1.11
2023-02-08 03:17:14 +00:00
i-robot 85728a332d !2245 [Fix] Fix device class bug
Merge pull request !2245 from 施博/device_master
2023-02-07 13:55:49 +00:00
施博 7275a94942 Merge branch 'master' of gitee.com:ascend/pytorch into device_master
Signed-off-by: 施博 <shibo19@huawei.com>
2023-02-07 12:17:27 +00:00
shibo19 e57a52fe9c fix device class bug 2023-02-07 20:14:25 +08:00
i-robot 0ff9946e9d !2156 IndexPut support 1D broadcast case.
Merge pull request !2156 from 王晓歆/master
2023-02-07 12:11:47 +00:00
i-robot 6ae13a31b0 !2237 Strengthen index operator verification.
Merge pull request !2237 from 刘哲续/master
2023-02-07 12:04:20 +00:00
刘哲续 b5d7ba5d1a Strengthen index operator verification. 2023-02-07 17:24:23 +08:00
闫鹏全 bbcd9ef109 Torch.load supports npu tensor load to cpu. 2023-02-07 17:12:36 +08:00
i-robot 0bc66c1b6c !2232 [Fix] Fix instance assert bug for torch_npu._C.device
Merge pull request !2232 from 施博/master_device
2023-02-07 08:44:32 +00:00
i-robot ce16d822bb !2207 [Fix] Fix bug in storage_resize_npu.
Merge pull request !2207 from 刘嘉巍/master
2023-02-07 08:42:56 +00:00
i-robot 66e7cb5350 !2132 Add BiShengExtension for compile ops writed by BiShengCPP.
Merge pull request !2132 from lotus/master
2023-02-07 07:19:12 +00:00
cudi 8917a72c3a Report call stack to MsProfiler. 2023-02-07 14:23:28 +08:00
pipihugh 4497ba11d4 Add Attr of Swish. 2023-02-07 13:45:11 +08:00
shibo19 6603a558a1 fix assert for torch_npu._C.device 2023-02-07 11:03:48 +08:00
i-robot 90cbf43488 !2168 [Feature] Add allgather_togather op only used for syncbn.
Merge pull request !2168 from 施博/upmaster_allgather
2023-02-07 01:44:37 +00:00
i-robot 28e1d943b9 !2215 Add aminmax.out operator and update the operator support list.
Merge pull request !2215 from Leon/master
2023-02-07 01:15:35 +00:00
i-robot ab58ce6967 !2228 FusedColorjitter Moving the position of the import pillow avoids the problem of dependencies when importing torch_npu
Merge pull request !2228 from 王姜奔/master
2023-02-06 13:37:29 +00:00
王姜奔 4988421705 Moving the position of the import pillow avoids the problem of dependencies when importing torch_npu
Signed-off-by: 王姜奔 <wangjiangben@huawei.com>
2023-02-06 11:46:49 +00:00
pipihugh e46b4eafeb Fix clamp in int64 scenario. 2023-02-06 17:07:55 +08:00
i-robot b920df19a5 !2180 Correct the output dtype of add and sub in the mix dtype scenario.
Merge pull request !2180 from 戢芳/add&sub1.11
2023-02-06 01:11:52 +00:00
i-robot 1acb807f7f !2181 Restore the adaptation of fill_.
Merge pull request !2181 from 戢芳/fill1.11
2023-02-06 01:10:39 +00:00
i-robot 43398f6f8c !2216 Report CANN op name to MsProfiler.
Merge pull request !2216 from 裘凯达/master_pt
2023-02-06 01:08:10 +00:00
i-robot 612682fa6d !2220 [Fix] Add class "Device" for torch_npu
Merge pull request !2220 from 施博/device_master
2023-02-04 09:32:53 +00:00
shibo19 761c973adf Add class Device for torch_npu 2023-02-04 11:34:43 +08:00
i-robot 0325389d2b !2219 回退 'Pull Request !2189 : [Fix] Add class "Device" for torch_npu'
Merge pull request !2219 from weili10/revert-merge-2189-master
2023-02-03 11:41:30 +00:00
weili10 00e313fd85 回退 'Pull Request !2189 : [Fix] Add class "Device" for torch_npu' 2023-02-03 11:30:36 +00:00
lotusdeng2010 9c840a2ed9 Add BiShengExtension for compile ops writed by BiShengCPP 2023-02-03 17:30:08 +08:00
i-robot 2ea2d86e55 !2188 [Fix] Taskqueue add memory barrier.
Merge pull request !2188 from 詹昊/master
2023-02-03 08:04:51 +00:00
i-robot 2297e73ff8 !2189 [Fix] Add class "Device" for torch_npu
Merge pull request !2189 from 施博/device_master
2023-02-03 08:02:28 +00:00
liangyunfan e034df7a08 Add aminmax.out operator and update the operator support list. 2023-02-03 11:57:46 +08:00
i-robot a858d2119e !2177 [fix] fix datadump enque input is cpu tensor
Merge pull request !2177 from xudaohong/master
2023-02-03 01:34:16 +00:00
刘嘉巍 329b39a5a9 Fix bug in storage_resize_npu. 2023-02-02 20:34:49 +08:00
pipihugh ac22be1ed3 Correct the output dtype of add and sub in the mix dtype scenario. 2023-02-02 16:57:45 +08:00
shibo19 59f16c912b Add class Device for torch_npu 2023-02-02 16:53:48 +08:00
zhanhao 06c19d2e52 Taskqueue add memory barrier 2023-02-02 16:43:33 +08:00
pipihugh fc10134eb9 Restore the adaptation of fill_. 2023-02-02 16:32:55 +08:00
cudi 6ba29b2227 Report CANN op to MsProfiler. 2023-02-02 15:38:46 +08:00
i-robot 64093abaf5 !2166 Correct the output dtype of pow.
Merge pull request !2166 from 郑亚金/master_zyj_pow_20230130
2023-02-02 01:32:25 +00:00
i-robot b6052cb85c !2179 Add onnx export operators and test cases
Merge pull request !2179 from Zhang Yingxin/master
2023-02-01 07:38:02 +00:00
i-robot 69b059e791 !2161 [Refactor] Add new op UT to CI.
Merge pull request !2161 from will-devil/cidev
2023-02-01 06:29:21 +00:00
i-robot d570dbb582 !2120 Modify the torch_device_guard function and removed some device patches.
Merge pull request !2120 from 杜金航/master
2023-02-01 06:23:34 +00:00
i-robot 2e5ec43567 !2160 [Fix] Fix invalid output shape allocation of dropout mask in op FusedAttentionScore
Merge pull request !2160 from lj_new/master
2023-02-01 06:18:05 +00:00
zhang-aurora 00368d6dd7 Add onnx export operators and test cases 2023-02-01 11:57:52 +08:00
i-robot 951e379132 !2141 Add alltoall_base op.
Merge pull request !2141 from 邵非凡/ddpUpdate
2023-02-01 02:38:15 +00:00
i-robot 3a8ee9a901 !2139 [Refactor] Remove the DeviceStats data structure and update BlockPool data structure.
Merge pull request !2139 from 闫鹏全/npucaching
2023-02-01 02:24:23 +00:00
i-robot 7ede7dc326 !2135 Add BiShengCPP ops.
Merge pull request !2135 from lotus/master
2023-02-01 01:27:30 +00:00
i-robot 712ce80a78 !2114 Fix upsample_nearest1d to support dynamic scenes.
Merge pull request !2114 from 戢芳/resize1.11
2023-02-01 01:08:37 +00:00
i-robot 67cd14794d !2172 [cherry-pick]: sync commits in 1.8,[1]:refactor(func: convert_to_acl_data_type); [2]:[Style]:reformat the func in calcuopUitl.*
Merge pull request !2172 from 宇世康/master
2023-02-01 01:08:04 +00:00
i-robot 392279649d !2002 [Feature] Add onnx export operators file and test cases
Merge pull request !2002 from Zhang Yingxin/master
2023-01-31 13:50:19 +00:00
shibo19 98745abe88 Add allgather_togather op only used for syncbn. 2023-01-31 21:03:15 +08:00
lotusdeng2010 b0aafbd4e8 Add BiShengCPP ops 2023-01-31 19:52:34 +08:00
x00430237 244c83b81e [fix] fix datadump enque input is cpu tensor 2023-01-31 17:20:37 +08:00
i-robot a3160d129f !2171 [Feature] graph mode support HCCL ops (allreduce, allgather).
Merge pull request !2171 from 王强/master
2023-01-31 07:49:26 +00:00
dujinhang 5cf7c55de9 Modify the torch_device_guard function and removed some device patches. 2023-01-31 15:23:11 +08:00
i-robot ff81f207ee !2159 [Feature] ReplayGraph support only forward case by setting requires_grad to False
Merge pull request !2159 from 王强/master
2023-01-31 07:15:30 +00:00
yskhhh 3e74e3328c fix(CalcuOpUtil.*): Scalartype QUInt2x4 has been added into pytorch1.11,so kATenScalarTypeToAclDataTypeTable must be updated 2023-01-31 11:35:25 +08:00
yskhhh 75d4714f72 style(CalcuOpUtil.*): reformat some func and remove some unused func 2023-01-31 11:17:00 +08:00
wq160 ab148143cb [Feature] graph mode support HCCL ops (allreduce, allgather). 2023-01-31 11:15:43 +08:00
yskhhh 68cdd57237 refactor(func: convert_to_acl_data_type): use array instead of map to implement func convert_to_acl_data_type 2023-01-31 11:01:56 +08:00
wangyicheng 706ce76ea4 Add new op_ut to ci. 2023-01-31 09:26:22 +08:00
weili10 81435460ae update cann version.
Signed-off-by: weili10 <liwei386@huawei.com>
2023-01-30 13:18:04 +00:00
i-robot 5ef9627a0e !2170 [Fix] Fix format bug of resize.
Merge pull request !2170 from 王强/master
2023-01-30 11:42:05 +00:00
wq160 d281876507 [Fix] Fix format bug of resize 2023-01-30 18:20:24 +08:00
i-robot 4201aebfda !2138 [Refactor] Refactor fast gelu forward function.
Merge pull request !2138 from 刘嘉巍/ops
2023-01-30 08:00:08 +00:00
邵非凡 71265b10eb Add alltoall_base op. 2023-01-30 15:44:31 +08:00
Zhang Yingxin e043d6e451 Add onnx export operators file and test cases 2023-01-30 15:33:31 +08:00
hxf12345677 2ae40194f5 Correct the output dtype of pow. 2023-01-30 14:45:53 +08:00
i-robot bd2df86313 !2151 Update Index Adaption.
Merge pull request !2151 from 刘哲续/master
2023-01-30 02:04:39 +00:00
wangxiaoxin_sherie 77a9c27900 IndexPut shrink the number of indicators. 2023-01-30 10:04:26 +08:00
lijing d7b5bd636a Fix invalid output shape allocation of mask 2023-01-30 09:36:40 +08:00
i-robot ec3c015fe1 !2131 [Fix] Remove functions that do not need autograd from custom_autograd.
Merge pull request !2131 from 刘嘉巍/master
2023-01-30 01:26:53 +00:00
wq160 ab22ff657e [Feature] ReplayGraph support only forward case by setting requires_grad to False. 2023-01-29 20:59:10 +08:00
i-robot 9554cf77e6 !2152 [Fix] Fix the bug of empty_strided, when resize occurs.
Merge pull request !2152 from 王强/master
2023-01-29 12:19:10 +00:00
i-robot 908b3e8694 !2145 Delete the transpose operation in the framework of GIoU.
Merge pull request !2145 from 於欣洁/master_giou0107
2023-01-29 11:36:09 +00:00
i-robot 13b0dce9bd !2148 [fix] fix datadump problem caused by torch v1.11.0 code merge
Merge pull request !2148 from xudaohong/master
2023-01-29 08:38:05 +00:00
00817228 0c8e6d4213 Delete the transpose operation in the framework of GIoU. 2023-01-29 15:19:46 +08:00
刘哲续 2393293c81 Update Index Adaption. 2023-01-29 14:52:20 +08:00
wq160 748a00159f [Fix] fix the bug of empty_strided, when resize occurs. 2023-01-29 10:38:12 +08:00
x00430237 34c9f17eba [fix] fix datadump problem caused by torch v1.11.0 code merge 2023-01-28 15:30:22 +08:00
闫鹏全 f6ee0d33ef Update some data structures and function in npu memory management. 2023-01-20 09:26:52 +08:00
weili10 354f47aca6 update README.zh.md.
Signed-off-by: weili10 <liwei386@huawei.com>
2023-01-19 08:13:46 +00:00
weili10 0c4aa35681 update README.zh.md.
Signed-off-by: weili10 <liwei386@huawei.com>
2023-01-18 09:26:36 +00:00
刘嘉巍 d4b45042c0 Refactor fast gelu forward function 2023-01-18 15:20:15 +08:00
闫鹏全 43708a8bf6 Remove the DeviceStats data structure. 2023-01-18 15:12:24 +08:00
i-robot 4b94310443 !2134 [Refactor] Clean up some uncall functions related to npu memory management.
Merge pull request !2134 from 闫鹏全/npucaching
2023-01-18 06:55:58 +00:00
pipihugh 3356f3701f Fix upsample_nearest1d to support dynamic scenes. 2023-01-17 17:06:13 +08:00
闫鹏全 a7e7320808 Clean up some uncall functions related to npu memory management. 2023-01-17 11:03:15 +08:00
i-robot 1c327d96a6 !2122 [Refactor] Clean up an uncalled function.
Merge pull request !2122 from 闫鹏全/npucaching
2023-01-16 02:57:12 +00:00
刘嘉巍 16d27b43ae remove functions that do not need autograd from custom_autograd 2023-01-15 13:55:29 +08:00
尤安升 14ce47a51d 新建 examples 2023-01-14 07:04:06 +00:00
闫鹏全 795e527ed7 Clean up an uncalled function. 2023-01-13 16:52:31 +08:00
weili10 b010233bd0 update README.zh.md.
Signed-off-by: weili10 <liwei386@huawei.com>
2023-01-13 08:25:40 +00:00
i-robot 08f17a4dde !2106 Update unit test files.
Merge pull request !2106 from 闫鹏全/ut
2023-01-13 01:27:31 +00:00
i-robot 7b5d2421eb !2112 [Fix] Fixed bugs caused by npu device.
Merge pull request !2112 from 杜金航/master
2023-01-12 14:11:53 +00:00
dujinhang 56d1f2db3d [Fix] Fixed npu device not torch.device type issue. 2023-01-12 22:00:19 +08:00
i-robot 171bd21ad8 !2102 [Refactor] Delete Allocator files that have not been called.
Merge pull request !2102 from 闫鹏全/memory
2023-01-12 13:23:44 +00:00
i-robot 54d1f16da8 !2110 [Fix]Modifying the map_location parameter processing flow in torch.load.
Merge pull request !2110 from 闫鹏全/master
2023-01-12 12:19:20 +00:00
i-robot be0630c160 !2108 Add three npu native func: format_contiguous, check_match, check_memory_over_laps.
Merge pull request !2108 from lotus/master
2023-01-12 12:18:38 +00:00
lotus 8a819be35e Add three npu native func: format_contiguous, check_match, check_memory_over_laps 2023-01-12 16:18:17 +08:00
闫鹏全 d056930764 Update unit test to 1.11.0. 2023-01-12 11:44:50 +08:00
闫鹏全 c833b916c2 Fixed the map_location parameter processing in torch.load. 2023-01-12 11:39:58 +08:00
i-robot 4df3b3f678 !2090 [Feature] Add overflow check func for 1971 soc version.
Merge pull request !2090 from 施博/overflow_1971_master
2023-01-11 09:01:14 +00:00
shibo19 afb69ac33e Add overflow check func for 1971 soc version. 2023-01-11 16:36:19 +08:00
闫鹏全 0538236b1e Delete Allocator files that have not been called. 2023-01-11 09:35:55 +08:00
i-robot 1a069561fc !2097 [Refactor] Remove unsupported ops from yaml.
Merge pull request !2097 from will-devil/yamldev
2023-01-10 08:42:22 +00:00
wangyicheng e377dc0283 Remove unsupported ops from yaml 2023-01-10 14:29:57 +08:00
i-robot 54b0f7126b !2092 [Fix]Fix silu inplace backward.
Merge pull request !2092 from 王晓/silu_1.11
2023-01-09 12:45:35 +00:00
i-robot 72e41b8e47 !2081 Update readme file.
Merge pull request !2081 from 邵非凡/readme
2023-01-09 12:27:32 +00:00
i-robot 58cb4bedea !2091 [Cleancode] Clean code for all.
Merge pull request !2091 from huangyunlong/feature_hyl
2023-01-09 12:21:15 +00:00
i-robot 5287176deb !2084 [Fix] Add attr of GatherV2.
Merge pull request !2084 from 戢芳/gather1.11
2023-01-09 12:17:47 +00:00
wangxiao ccb2200a1b Fix silu inplace backward. 2023-01-09 19:28:02 +08:00
huangyunlong bf754d7bc0 [Cleancode] Clean code for all. 2023-01-09 16:50:57 +08:00
邵非凡 5340ee6f6c Update readme file. 2023-01-09 15:04:24 +08:00
pipihugh f5b6d26c23 Add attr of GatherV2. 2023-01-09 13:37:11 +08:00
i-robot e536e35617 !2077 Synchronize 1.11.0 branch to the master branch.
Merge pull request !2077 from 邵非凡/update1.11
2023-01-07 07:43:45 +00:00
i-robot dab155b170 !2066 [Fix] Update op list for AOE dump.
Merge pull request !2066 from 施博/up_master
2023-01-07 03:25:14 +00:00
i-robot db24b9a054 !2076 [Fix] Fix the problem of cnt can not be 0.
Merge pull request !2076 from 詹昊/master
2023-01-07 03:21:28 +00:00
邵非凡 b53ec7fec9 Synchronize 1.11.0 branch to the master branch. 2023-01-07 11:16:28 +08:00
i-robot baa99a0507 !2067 [Fix] The inverse computation of depth separable convolution is supported.
Merge pull request !2067 from 王夏夏/master
2023-01-07 02:13:08 +00:00
i-robot 73c2db15cd !2069 [Fix] Fix the fp16 precision problem of scatter.
Merge pull request !2069 from 王夏夏/master
2023-01-07 02:12:43 +00:00
zhanhao 81cd832b5e Fix the problem of cnt can not be 0. 2023-01-06 21:54:11 +08:00
xiaxia3 a86b5f46ec The inverse computation of depth separable convolution is supported. 2023-01-06 17:29:12 +08:00
xiaxia3 b595c7afdc Fix the fp16 precision problem of scatter. 2023-01-06 16:21:59 +08:00
shibo19 9f6f8220b6 Update op list for AOE dump. 2023-01-06 15:27:20 +08:00
i-robot 7cdc9414b3 !2062 Fix the compilation errors.
Merge pull request !2062 from 闫鹏全/bugfix
2023-01-06 07:23:34 +00:00
尤安升 9f1067bc35 !2059 Upgrade the master branch from version 1.8.1 to 1.11.0.
Merge pull request !2059 from 闫鹏全/v1.11.0-diff
2023-01-06 06:50:06 +00:00
闫鹏全 4a314b171f Fix the compilation errors. 2023-01-06 14:34:34 +08:00
i-robot 6bc8c786a8 !2050 [Feature] Add adapters of tril_indices and triu_indices.
Merge pull request !2050 from 戢芳/triu_indices1.8
2023-01-06 03:45:53 +00:00
尤安升 ef0c0f4c84 !2026 Update data structures and types to 1.11.0.
Merge pull request !2026 from 闫鹏全/v1.11.0-diff-data
2023-01-06 03:26:34 +00:00
尤安升 a42e50c0f9 !2015 The operator interface is synchronized to official 1.11.0.
Merge pull request !2015 from 闫鹏全/v1.11.0-diff-opsinterface
2023-01-06 03:26:02 +00:00
邵非凡 f3fbe062e4 The operator interface is synchronized to official 1.11.0. 2023-01-06 09:32:11 +08:00
i-robot fe17155b17 !1988 Add affinity interface for bert big kernel
Merge pull request !1988 from lj_new/master
2023-01-06 01:26:28 +00:00
i-robot e019e2c0ea !2054 [Cleancode] Clean code for all.
Merge pull request !2054 from shaoyf/cleancode/master
2023-01-06 01:17:35 +00:00
i-robot b5f0714ebc !2049 IndexPut support 1D broadcast case
Merge pull request !2049 from 王晓歆/master
2023-01-05 13:48:09 +00:00
闫鹏全 8da378d72f Update data structures and types to 1.11.0. 2023-01-05 21:38:53 +08:00
i-robot 1ca96c3887 !2045 Reduce Transpose calls of npu_deformable_conv2d.
Merge pull request !2045 from 王晓/nhwc_fix_1
2023-01-05 13:37:38 +00:00
i-robot cf93f428f7 !2046 [bugfix] Modify InferShapeofNHWC.
Merge pull request !2046 from will-devil/shapedev
2023-01-05 13:31:27 +00:00
i-robot efcb27cfe3 !2036 [Fix] Adjust the Index adaptation logic.
Merge pull request !2036 from 刘哲续/master
2023-01-05 13:30:21 +00:00
i-robot 0ec39852ae !1967 Upgrade Input to support IntArrayRef and set descName.
Merge pull request !1967 from 戢芳/input1.8
2023-01-05 12:29:22 +00:00
刘哲续 153490f0ed Adjust the Index adaptation logic. 2023-01-05 20:08:10 +08:00
wangyicheng 4789b3c28e Modify InferShapeofNHWC. 2023-01-05 19:51:54 +08:00
尤安升 3fc05d486d !2007 Update amp related code implementation to 1.11.0.
Merge pull request !2007 from 闫鹏全/v1.11.0-diff-amp
2023-01-05 11:49:23 +00:00
尤安升 cbd0cc73c8 !2011 Update test framework related code implementation to 1.11.0.
Merge pull request !2011 from 闫鹏全/v1.11.0-diff-test
2023-01-05 11:48:51 +00:00
尤安升 d0e35c02a9 !2009 Update ddp related code implementation to 1.11.0.
Merge pull request !2009 from 闫鹏全/v1.11.0-diff-ddp
2023-01-05 11:48:20 +00:00
尤安升 80cd4b4a37 !2018 Update codegen related code implementation to 1.11.0.
Merge pull request !2018 from 闫鹏全/v1.11.0-diff-codegen
2023-01-05 11:47:43 +00:00
尤安升 a83dec1111 !2013 Updated the python side interface implementation to 1.11.0.
Merge pull request !2013 from 闫鹏全/v1.11.0-diff-part
2023-01-05 11:47:16 +00:00
尤安升 3caec95134 !2027 Update some of the operator interfaces and their implementations to 1.11.0.
Merge pull request !2027 from 闫鹏全/v1.11.0-diff-ops
2023-01-05 11:46:44 +00:00
尤安升 6d5791e967 !2019 Update fx related code implementation to 1.11.0.
Merge pull request !2019 from 闫鹏全/v1.11.0-diff-fx
2023-01-05 11:46:17 +00:00
尤安升 a901d5a9b9 !2028 Update the operator input to add a constraint on const references.
Merge pull request !2028 from 闫鹏全/v1.11.0-diff-const
2023-01-05 11:45:24 +00:00
i-robot fcf28becb2 !2039 Fix hardsigmoid_ and add corresponding cases.
Merge pull request !2039 from 戢芳/hardsigmoid1.8
2023-01-05 11:22:25 +00:00
闫鹏全 08acf60c3c Update codegen related code implementation to 1.11.0. 2023-01-05 19:12:04 +08:00
i-robot 4088f0b895 !2004 [Fix] Reduce unnecessary item when the Tensor is on device
Merge pull request !2004 from 王强/master
2023-01-05 09:57:27 +00:00
闫鹏全 b73b4054ae Update some of the operator interfaces and their implementations to 1.11.0. 2023-01-05 16:59:04 +08:00
wangxiaoxin_sherie 51c61ec9cb indexput support 1D broadcast case 2023-01-05 15:07:56 +08:00
li_jing_hw 19740f7a75 Add 2 affinity interface for bert big kernel
clean code

modify judgement of bool

修复大kernel无法import的问题

Signed-off-by: lj_new <lijing202@huawei.com>

bert大kernel clean code(line too long)

add license for bert big kernel

clean code

clean code

cleancode
2023-01-05 14:29:44 +08:00
pipihugh 6a98a54278 Add adapters of tril_indices and triu_indices. 2023-01-05 13:58:41 +08:00
shaoyf 40b90290a2 Clean code for all. 2023-01-05 13:36:22 +08:00
i-robot 4fedd8df68 !2031 [Fix]Add flag in read and write queue.
Merge pull request !2031 from 詹昊/master
2023-01-05 02:25:49 +00:00
wangxiao 30db38ddca Reduce Transpose calls of npu_deformable_conv2d. 2023-01-05 10:20:40 +08:00
闫鹏全 01554314d1 Master version upgrade, update partial interface. 2023-01-05 10:16:25 +08:00
i-robot 3299eceb18 !2035 [Fix] Fix new_zeros and new_empty without args.
Merge pull request !2035 from shaoyf/bugfix/new_zeros
2023-01-04 12:29:51 +00:00
zhanhao 81a665e09e Add flag in read and write queue. 2023-01-04 20:20:40 +08:00
i-robot 3c268615ce !2037 [Fix]IndexPut unsupport bool incomplete axis
Merge pull request !2037 from 王晓歆/master
2023-01-04 10:57:30 +00:00
pipihugh 500b50ff95 Fix hardsigmoid_ and add corresponding cases. 2023-01-04 16:19:48 +08:00
wangxiaoxin_sherie 8491713a91 Intercept bool non full axis case. 2023-01-04 15:52:22 +08:00
pipihugh cdafc4de0e Upgrade Input to support IntArrayRef and set descName. 2023-01-04 13:49:41 +08:00
shaoyf ac8caded56 Fix new_zeros and new_empty without args. 2023-01-04 11:25:34 +08:00
闫鹏全 6e4e84ac76 Update ddp related code implementation to 1.11.0.
fix
2023-01-04 10:58:00 +08:00
i-robot 7439ae5cce !1995 [feat] add step control and async datadump hook in acc_cmp_tool
Merge pull request !1995 from xudaohong/master
2023-01-04 01:52:34 +00:00
尤安升 2577dcf72e !2005 Update profiler related code implementation to 1.11.0.
Merge pull request !2005 from 闫鹏全/v1.11.0-diff
2023-01-03 11:54:52 +00:00
尤安升 8ffaadd68a !2006 Update Graph mode related code implementation to 1.11.0.
Merge pull request !2006 from 闫鹏全/v1.11.0-diff-graph
2023-01-03 11:53:54 +00:00
i-robot bfa4a58efc !2021 Adjust the Index adaptation logic.
Merge pull request !2021 from 刘哲续/master
2023-01-03 11:49:58 +00:00
邵非凡 1f1765f4b3 Update the operator input to add a constraint on const references. 2023-01-03 19:38:08 +08:00
闫鹏全 8e01258655 Update fx related code implementation to 1.11.0. 2023-01-03 19:11:54 +08:00
x00430237 e672675d13 [feat] add step control and async datadump hook in acc_cmp_tool 2023-01-03 18:45:31 +08:00
刘哲续 218ea4a965 Adjust the Index adaptation logic. 2023-01-03 18:32:27 +08:00
闫鹏全 694e7ed93b Master version upgrade, update test framework related code implementation. 2022-12-30 17:23:16 +08:00
闫鹏全 6311d0d748 Master version upgrade, update amp related code implementation. 2022-12-30 15:40:44 +08:00
闫鹏全 3c637ec022 Master version upgrade, update Graph mode related code implementation. 2022-12-30 14:36:29 +08:00
i-robot c602fd97cb !1946 [Fix] Syncbn support input shape (N,C,+)
Merge pull request !1946 from huangxinliang/master
2022-12-30 06:16:14 +00:00
闫鹏全 ea7b131819 Master version upgrade, update profiler related code implementation. 2022-12-30 14:11:53 +08:00
xinlianglalala 019e7cb16e Do reshape to support ND format 2022-12-30 12:11:46 +08:00
wq160 4a079401b5 [fix] Reduce unnecessary item when the Tensor is on device 2022-12-30 11:43:20 +08:00
i-robot 863ca112de !1968 Call Transpose explicitly in adapter of deformable_conv2d.
Merge pull request !1968 from 王晓/deformable_conv_nhwc2
2022-12-29 13:23:14 +00:00
i-robot 083d8b1db2 !1996 Fix layer_norm shape error.
Merge pull request !1996 from 王晓/ln_resize
2022-12-29 09:05:21 +00:00
wangxiao 69c4092660 Fix layer_norm shape error. 2022-12-29 13:33:59 +08:00
i-robot 32d69d12a9 !1978 [fix] bugfix of supported data types by hccl ops
Merge pull request !1978 from 王强/master
2022-12-27 14:00:52 +00:00
i-robot 91c840476d !1989 Fix compilation errors when the version.py file exists.
Merge pull request !1989 from 闫鹏全/master
2022-12-27 13:51:21 +00:00
i-robot 9d7a6e248e !1982 [feat] merge device stream during datadump, modify tdtchannel capacity
Merge pull request !1982 from xudaohong/master
2022-12-27 13:23:55 +00:00
i-robot 0620f02bfb !1979 [BugFix] Correct the output shape of lstm_backward.
Merge pull request !1979 from 戢芳/lstm1.8
2022-12-27 10:18:32 +00:00
i-robot fb396531f4 !1965 Update the code format of DivKernelNpu.cpp, which is the same as version 1.11.0.
Merge pull request !1965 from 邵非凡/updateFormat
2022-12-27 07:17:50 +00:00
wq160 0fa9e7353f [fix] hccl op supported data type check bug fix 2022-12-27 11:37:44 +08:00
闫鹏全 bffaedbbac Fix compilation errors when the version.py file exists. 2022-12-27 11:34:01 +08:00
x00430237 ad167affff [feat] merge op stream during datadump, modify tdtchannel capacity 2022-12-27 10:42:16 +08:00
i-robot 1871cb1934 !1976 [Fix] Only warning once when running unsupported kernel.
Merge pull request !1976 from 刘嘉巍/dev
2022-12-26 12:47:43 +00:00
liu-jiaweikf 769ff87a21 Warning only once 2022-12-26 17:47:42 +08:00
pipihugh 31beaac68e Correct the output shape of lstm_backward. 2022-12-26 13:35:44 +08:00
i-robot 9da3639213 !1970 Index/IndexPut aicore operator adaptation.
Merge pull request !1970 from 王晓歆/master
2022-12-25 12:15:27 +00:00
wangxiaoxin_sherie 668e45e5d4 Add Index/IndexPut aicore adpater. 2022-12-25 11:22:08 +08:00
Author 邵非凡 7457160ace Update the code format, which is the same as version 1.11.0. 2022-12-24 09:13:07 +08:00
wangxiao 22b276758e Call Transpose explicitly in adapter of deformable_conv2d. 2022-12-23 17:46:00 +08:00
i-robot c47920038b !1964 Update the version number of the branch.
Merge pull request !1964 from 闫鹏全/version
2022-12-22 13:11:59 +00:00
i-robot e857d105b9 !1961 [Feature] Optimize dropout_with_add_softmax to support non-half.
Merge pull request !1961 from 戢芳/dropout_softmax1.8
2022-12-22 12:02:35 +00:00
i-robot 214b62590c !1966 [BugFix] Fix the error of median and fill_.
Merge pull request !1966 from 戢芳/median1.8
2022-12-22 12:02:07 +00:00
i-robot a894f74ec4 !1920 sets the HF32 mixing precision attribute for the matmul and conv operators
Merge pull request !1920 from 刘晶晶/HF32
2022-12-22 09:44:00 +00:00
闫鹏全 676cfa48fd Update the version number of the branch. 2022-12-22 16:40:28 +08:00
pipihugh e63811e40f Optimize dropout_with_add_softmax to support non-half. 2022-12-22 15:27:03 +08:00
pipihugh ef3204b2f7 Fix the error of median and fill_. 2022-12-22 11:39:08 +08:00
i-robot c73ae1d729 !1962 [feat] acl async memcpy into task queue
Merge pull request !1962 from xudaohong/master
2022-12-21 13:09:38 +00:00
weili10 ed285bdf7e update OWNERS.
Signed-off-by: weili10 <liwei386@huawei.com>
2022-12-21 12:47:52 +00:00
x00430237 05a2f2e587 [feat] acl async memcpy into task queue 2022-12-21 16:21:28 +08:00
i-robot 87229b5a06 !1945 [UT]Check over flow interface
Merge pull request !1945 from zhaojingwei/master
2022-12-21 06:47:13 +00:00
i-robot 07750c3eae !1950 [Fix] Modify the default device of as_tensor.
Merge pull request !1950 from shaoyf/fix/as_tensor_default_device
2022-12-21 04:02:40 +00:00
shaoyf 0b5ebb435b [Fix] Modify the default device of as_tensor. 2022-12-20 11:34:09 +00:00
zhaojingwei 899a56efb9 [ut]Check over flow interface 2022-12-20 17:21:01 +08:00
i-robot 2475770ccf !1942 [BugFix] Fix the accuracy problem of nllloss2d.
Merge pull request !1942 from 戢芳/nllloss1.8
2022-12-20 03:50:07 +00:00
liujingjing 8b036cd83b sets the HF32 mixing precision attribute for the matmul and conv operators 2022-12-20 11:48:07 +08:00
pipihugh 4605b0db1b Fix the accuracy problem of nllloss2d. 2022-12-20 09:17:54 +08:00
weili10 b0bc2fe45d !1937 [Refactor]Simplify the usage of accuracy comparison tool.
Merge pull request !1937 from 杜金航/master
2022-12-19 13:22:12 +00:00
i-robot d6f7030a20 !1927 [Fix]: Modify error msg in HCCL op.
Merge pull request !1927 from 施博/master_hccl_error
2022-12-19 12:33:56 +00:00
dujinhang 4416abba79 [Refactor]Simplify the usage of accuracy comparison tool. 2022-12-19 20:30:29 +08:00
shibo19 905996ae5c Fix: modify error msg in HCCL op 2022-12-19 20:29:04 +08:00
i-robot 8d776ee382 !1940 [Fix] Fix bug in indexing contiguous operation.
Merge pull request !1940 from 刘嘉巍/dev
2022-12-19 11:04:22 +00:00
刘嘉巍 75d1234976 Fix bug in indexing_opt 2022-12-19 16:33:13 +08:00
dujinhang 400f4c9856 [Fix]Update support_wrap_ops.yaml. 2022-12-19 15:50:54 +08:00
i-robot aba9fb6683 !1934 Set the device sat mode during initialization
Merge pull request !1934 from zhaojingwei/master
2022-12-19 03:02:43 +00:00
zhaojingwei 8e2d27d5c3 Set the device sat mode during initialization 2022-12-19 10:32:05 +08:00
i-robot 5b188b0049 !1887 [feat] datadump UT/ST, modify review suggests
Merge pull request !1887 from xudaohong/master
2022-12-19 01:52:19 +00:00
weili10 4231c4a323 Modify the default value of the TASK_QUEUE_ENABLE
Signed-off-by: weili10 <liwei386@huawei.com>
2022-12-18 13:14:49 +00:00
i-robot 30c096e611 !1925 [BugFix] Correct the output shape of layer_norm_eval.
Merge pull request !1925 from 戢芳/layer_norm1.8
2022-12-17 11:25:39 +00:00
pipihugh 1ae147d00a Correct the output shape of layer_norm_eval. 2022-12-17 18:10:49 +08:00
i-robot a1d5d4bbe9 !1924 [Feature] BatchNorm2d eliminate transdata in binary 5HD scenarios.
Merge pull request !1924 from 戢芳/bn_trans1.8
2022-12-17 08:37:38 +00:00
i-robot 2fbf703b78 !1797 Modify the framework of Viewcopy.
Merge pull request !1797 from 於欣洁/master
2022-12-17 08:15:51 +00:00
pipihugh 3232a6cba5 BatchNorm2d eliminate transdata in binary 5HD scenarios. 2022-12-17 15:37:08 +08:00
i-robot 571201df7f !1763 Set the device sat mode during initialization
Merge pull request !1763 from zhaojingwei/master
2022-12-16 09:53:50 +00:00
i-robot 8b63680b3b !1912 [Fix]Specified process processing in overflow detection tool.
Merge pull request !1912 from 杜金航/master
2022-12-16 09:46:05 +00:00
zhaojingwei 42cd0a401e Merge branch 'master' of gitee.com:ascend/pytorch into master
Signed-off-by: zhaojingwei <zhaojingwei2@huawei.com>
2022-12-16 09:18:28 +00:00
zhaojingwei 59393c2526 Set the device sat mode during initialization 2022-12-16 17:09:31 +08:00
i-robot a4f5dd6afa !1921 set all SocVersion's ACL_PRECISION_MODE to "allow_fp32_to_fp16"
Merge pull request !1921 from 刘晶晶/FP32
2022-12-16 09:02:07 +00:00
liujingjing 49f0951c8d set all SocVersion's ACL_PRECISION_MODE to "allow_fp32_to_fp16" 2022-12-16 16:35:09 +08:00
i-robot 316f285e5a !1911 ut: jit_compile Adaption
Merge pull request !1911 from chengqixuan/jit-compile
2022-12-16 08:30:14 +00:00
i-robot beec80f38f !1914 Modify Index API
Merge pull request !1914 from 刘哲续/master
2022-12-16 08:28:15 +00:00
i-robot 7f90d27c8b !1913 [Fix] Support torch.npu.FloatTensor for PyTorch installed by wheel(x86_64).
Merge pull request !1913 from shaoyf/fix/x86_npu_tensor
2022-12-16 08:24:13 +00:00
dujinhang 394b9560cc [Fix]Specified process processing in overflow detection tool. 2022-12-16 15:37:35 +08:00
i-robot 24f15345ca !1906 [Fix] Modify the error information of libhccl.so.
Merge pull request !1906 from 詹昊/master
2022-12-16 07:28:09 +00:00
於欣洁 b5c0fe5d0a Modify the framework of Viewcopy. 2022-12-16 15:19:47 +08:00
i-robot 0dc985df9d !1917 [Fix] revert 'Pull Request !1888 : [Feature] Modify the size of AvgPoolV2Grad to int32'
Merge pull request !1917 from weili10/revert-merge-1888-master
2022-12-16 06:55:45 +00:00
weili10 578956016c 回退 'Pull Request !1888 : [Feature] Modify the size of AvgPoolV2Grad to int32' 2022-12-16 06:35:50 +00:00
shaoyf ca5852a72d Support npu tensor for PyTorch installed by wheel(x86_64) 2022-12-16 13:14:20 +08:00
刘哲续 8c97c4fbc5 Modify Index API. 2022-12-16 12:06:35 +08:00
zhanhao c8d43c1b02 Modify error infomation of libhccl.so 2022-12-16 11:55:02 +08:00
i-robot c24bf7125d !1874 [Fix]Only dump specified process in accuracy comparison tool.
Merge pull request !1874 from 杜金航/master
2022-12-16 02:31:43 +00:00
x00430237 22d30c44e6 [feat] datadump UT/ST, modify review suggests 2022-12-16 10:16:52 +08:00
chengqixuan 97c0d5a5e8 ut: jit_compile Adaption 2022-12-16 10:03:32 +08:00
i-robot 3dc216c21e !1898 DVPP适配-ImgToTensor
Merge pull request !1898 from 陈瑛琰/master
2022-12-16 01:08:38 +00:00
i-robot 8a287fd8af !1897 [Fix] Optimize release queue.
Merge pull request !1897 from 詹昊/master
2022-12-15 13:58:53 +00:00
i-robot a29abc7fda !1835 [feature]Add adapters of bert kernels.
Merge pull request !1835 from 王晓/bert_kernel_all1
2022-12-15 13:28:58 +00:00
c00659642 f25131f3da DVPP适配-ImgToTensor 2022-12-15 20:05:53 +08:00
i-robot 56c6b810d7 !1890 Add checkpoint UT to test_utils
Merge pull request !1890 from will-devil/ckptut
2022-12-15 09:36:56 +00:00
i-robot 17b0f999b6 !1891 Optimize the RepeatInterleave operator adaptation scheme
Merge pull request !1891 from aikede/r1.8_repeat
2022-12-15 09:33:01 +00:00
wangxiao d0aec24385 Add adapters of bert kernels. 2022-12-15 16:42:21 +08:00
i-robot 99910676c5 !1859 DVPP适配-CropAndResizeV2/NormalizeV2部分参数改host值
Merge pull request !1859 from 陈瑛琰/master
2022-12-15 02:34:43 +00:00
wangyicheng 62dfc27033 Add checkpoint UT to test_utils 2022-12-15 10:16:17 +08:00
zhanhao 3ce7bb411a Optimize taskqueue. 2022-12-15 09:59:28 +08:00
dujinhang 98af8a6276 [Fix]Only dump specified process in accuracy comparison tool. 2022-12-15 09:49:27 +08:00
aikede 36006a1528 Optimize the RepeatInterleave operator adaptation scheme. 2022-12-14 21:24:01 +08:00
c00659642 e2981565e8 DVPP适配-CropAndResizeV2/NormalizeV2部分参数改host值 2022-12-14 21:18:20 +08:00
i-robot c586e665fc !1893 [Fix] revert 'Pull Request !1847 : [Feature] BatchNorm2d eliminate transdata in binary 5HD scenarios'
Merge pull request !1893 from weili10/revert-merge-1847-master
2022-12-14 13:16:13 +00:00
i-robot af608371b5 !1864 [Fix] Patch nn.parallel._functions._get_stream to support npu.
Merge pull request !1864 from 郭夏/master
2022-12-14 12:48:31 +00:00
i-robot b7268705e3 !1888 [Feature] Modify the size of AvgPoolV2Grad to int32
Merge pull request !1888 from 戢芳/avg_pool2d_grad1.8
2022-12-14 10:30:31 +00:00
weili10 821fcbdca1 回退 'Pull Request !1847 : [Feature] BatchNorm2d eliminate transdata in binary 5HD scenarios' 2022-12-14 10:00:00 +00:00
pipihugh af2be91571 Modify the size of AvgPoolV2Grad to int32. 2022-12-14 15:53:45 +08:00
郭夏 0bb47aa178 [Fix]Patch nn.parallel._functions._get_stream to support npu.
Signed-off-by: 郭夏 <guoxia2@huawei.com>
2022-12-14 11:26:37 +08:00
i-robot f6c27b8a74 !1871 [feat] datadump code optimization
Merge pull request !1871 from xudaohong/master
2022-12-14 01:08:12 +00:00
i-robot fcdeee2fdd !1883 [fix] revert deformable_conv2d changes
Merge pull request !1883 from weili10/revert-merge-1802-master
2022-12-13 15:08:23 +00:00
weili10 87dedabbf4 回退 'Pull Request !1802 : Call Transpose explicitly in adapter of deformable_conv2d.' 2022-12-13 14:49:16 +00:00
i-robot d9e976a44e !1877 Modified the Usage Guide of the accuracy comparison tool at GPU Scenarios
Merge pull request !1877 from 谭親林/master
2022-12-13 14:32:11 +00:00
i-robot fe7916bbab !1856 [Fix] Optimize log printing in taskqueue.
Merge pull request !1856 from 詹昊/master
2022-12-13 14:02:14 +00:00
tanqinlin ca35b63288 modify usage Guide 2022-12-13 21:32:47 +08:00
zhanhao 7e4c91f644 Add log printing to taskqueue. 2022-12-13 21:15:02 +08:00
i-robot 8fafe8d7a0 !1839 Update Syncbn adapter for mixed precision training
Merge pull request !1839 from huangxinliang/master
2022-12-13 12:48:31 +00:00
i-robot 2944aac13a !1834 [Fix]Add call stack information for overflow detection.
Merge pull request !1834 from 杜金航/master
2022-12-13 12:40:15 +00:00
xinlianglalala 77b8f70814 Update Syncbn adapter for mixed precision training 2022-12-13 20:09:19 +08:00
x00430237 fbab1d9c05 [feat] datadump code optimization 2022-12-13 19:48:51 +08:00
weili10 b4c130b56a update OWNERS.
Signed-off-by: weili10 <liwei386@huawei.com>
2022-12-13 09:27:27 +00:00
i-robot 84908800b4 !1861 【Fix】Fix bug for checkpoint
Merge pull request !1861 from hanjun/master
2022-12-13 09:12:14 +00:00
dujinhang 984f693765 Add call stack information for overflow detection. 2022-12-13 16:37:40 +08:00
i-robot 1fdaacfd07 !1858 Revert Index/IndexPut Adaptive logic
Merge pull request !1858 from 刘哲续/master
2022-12-13 07:45:29 +00:00
h00558267 41a9302ecc Fix bug for checkpoint 2022-12-13 15:07:09 +08:00
刘哲续 795bff9363 Revert Index/IndexPut Adaptive logic 2022-12-13 14:54:57 +08:00
i-robot d4836c9240 !1739 [feat] support datadump to dump async input and outpur tensor of acl ops
Merge pull request !1739 from xudaohong/master
2022-12-13 02:24:22 +00:00
i-robot 88655029be !1828 feat: jit-compile Adaptation
Merge pull request !1828 from chengqixuan/jit-compile
2022-12-13 02:20:10 +00:00
i-robot 531a74a666 !1847 [Feature] BatchNorm2d eliminate transdata in binary 5HD scenarios
Merge pull request !1847 from 戢芳/bn_transdata1.8
2022-12-12 17:33:51 +00:00
i-robot 280acf6eaa !1844 回退 'Pull Request !1738 : task queue优化'
Merge pull request !1844 from weili10/revert-merge-1738-master
2022-12-12 15:57:50 +00:00
pipihugh 91bde61256 BatchNorm2d eliminate transdata in binary 5HD scenarios. 2022-12-12 23:57:33 +08:00
weili10 631c7609dd 回退 'Pull Request !1738 : task queue优化' 2022-12-12 15:39:10 +00:00
i-robot 5ab30c2515 !1840 [Feature]Index generalization: bool indices support 0 axis
Merge pull request !1840 from 戢芳/index_aicore_bool1.8
2022-12-12 15:24:10 +00:00
x00430237 3fee9987f4 [feat] support datadump to dump async input and outpur tensor of acl ops 2022-12-12 22:41:59 +08:00
i-robot 5b786a6a16 !1820 [Bug Fix] Add the aicore branch of indexput
Merge pull request !1820 from 王晓歆/master
2022-12-12 13:24:04 +00:00
i-robot db67635aeb !1802 Call Transpose explicitly in adapter of deformable_conv2d.
Merge pull request !1802 from 王晓/deformable_conv_nhwc1
2022-12-12 13:04:07 +00:00
pipihugh 0a094266b6 Index generalization: bool indices support 0 axis. 2022-12-12 20:57:40 +08:00
chengqixuan f33a7b3475 feat: jit-compile Adaptation 2022-12-12 20:29:08 +08:00
wangxiao 51744de4ad Call Transpose explicitly in adapter of deformable_conv2d. 2022-12-12 18:47:47 +08:00
i-robot 2a7b1fb710 !1831 configuring the Hybrid Precision Attribute During Operator Compilation
Merge pull request !1831 from 刘晶晶/FP32
2022-12-12 09:50:15 +00:00
weili10 042b81869f update torch_npu/csrc/core/npu/register/OptionsManager.cpp.
Signed-off-by: weili10 <liwei386@huawei.com>
2022-12-12 09:40:10 +00:00
i-robot 2f025c65b3 !1817 Add tensor device verification
Merge pull request !1817 from 王夏夏/master
2022-12-12 09:15:57 +00:00
wangxiaoxin_sherie 44a98a83e7 Add the aicore branch of indexput. 2022-12-12 17:01:39 +08:00
liujingjing 6230586449 configuring the Hybrid Precision Attribute During Operator Compilation 2022-12-12 17:00:21 +08:00
i-robot 95e74b625c !1823 [Fix] Fix judgment error of tensor format cast in allgather operator
Merge pull request !1823 from 施博/fix_allgather_bug
2022-12-12 08:58:09 +00:00
shibo19 1a84ad2e71 Bufgix: Fix judgment error of tensor format cast in allgather op 2022-12-12 11:02:52 +08:00
xiaxia3 c44a8447fd Add tensor device verification 2022-12-12 10:51:17 +08:00
i-robot 8910373487 !1803 Modify the error information of libhccl.so
Merge pull request !1803 from 詹昊/master
2022-12-10 13:00:33 +00:00
zhanhao 6b329bb814 Modify the error message reported when libhccl.so cannot be found. 2022-12-10 19:02:09 +08:00
i-robot 222da74df6 !1806 modify soc versin interface enum parameters
Merge pull request !1806 from zhaojingwei/master
2022-12-10 03:40:12 +00:00
zhaojingwei 0374a18c67 modify soc versin interface enum parameters 2022-12-10 11:01:11 +08:00
i-robot a8327275b8 !1778 添加 infershapeofNHWC
Merge pull request !1778 from will-devil/formatdev
2022-12-09 13:12:15 +00:00
i-robot acac9814d1 !1800 [Feature] add aclrtCreateStreamWithConfig to create fast streams
Merge pull request !1800 from 王强/master
2022-12-09 13:00:15 +00:00
wq160 9bafbf675e [Feature] add aclrtCreateStreamWithConfig to create fast streams 2022-12-09 19:38:06 +08:00
i-robot e3182552a0 !1738 task queue优化
Merge pull request !1738 from 詹昊/master
2022-12-09 10:14:17 +00:00
i-robot 7a787674c3 !1786 IndexPut aicore实现适配
Merge pull request !1786 from 王晓歆/master
2022-12-09 09:48:18 +00:00
i-robot a3b062177f !1784 【精度比对工具】增加序号映射
Merge pull request !1784 from 杜金航/master
2022-12-09 09:34:41 +00:00
wangxiaoxin_sherie bb82c454bf 添加indexput aicore 适配 2022-12-09 17:30:24 +08:00
i-robot 0a2771537b !1791 【BugFix】修复unique2申请空tensor的问题
Merge pull request !1791 from 戢芳/unique1.8
2022-12-09 09:22:34 +00:00
dujinhang a4b44ed58c 精度比对工具增加序号 2022-12-09 17:04:59 +08:00
i-robot 2ea5c9c837 !1752 bugfix:解决allgather计算输入为私有格式时的精度问题
Merge pull request !1752 from 施博/allgather_v1.8
2022-12-09 09:04:22 +00:00
shibo19 ed40d2c200 bugfix:解决allgather计算输入为私有格式时的精度问题 2022-12-09 16:17:07 +08:00
i-robot b018bb5841 !1794 回退 'Pull Request !1637 : 【Feature】batchNorm参数format与输入一致'
Merge pull request !1794 from weili10/revert-merge-1637-master
2022-12-09 08:00:52 +00:00
weili10 45f5eb2537 回退 'Pull Request !1637 : 【Feature】batchNorm参数format与输入一致' 2022-12-09 07:30:48 +00:00
i-robot f5d67aeafa !1753 【Feature】index添加aicore分支
Merge pull request !1753 from 戢芳/index_aicore1.8
2022-12-09 07:16:54 +00:00
pipihugh 06e197ed6d 修复unique2申请空tensor的问题 2022-12-09 11:21:50 +08:00
zhanhao ab0ab22b51 optimize task_queue 2022-12-09 11:19:18 +08:00
pipihugh bcae12b756 index添加aicore分支 2022-12-09 11:01:50 +08:00
weili10 a65f3caff4 update OWNERS.
Signed-off-by: weili10 <liwei386@huawei.com>
2022-12-09 02:13:55 +00:00
i-robot 17836e0a06 !1782 适配npu的checkpoint的功能
Merge pull request !1782 from hanjun/master
2022-12-08 11:37:11 +00:00
h00558267 640b13d02d upload checkpoint for pytorch
fix some cleancode problem

add license
2022-12-08 19:17:09 +08:00
i-robot 2c8c588d3e !1771 【1.8.1算子适配】logsumexp算子适配
Merge pull request !1771 from 郑亚金/master_zyj_1207_logsumexp
2022-12-08 08:27:35 +00:00
i-robot bc6dd05a85 !1773 【溢出检测工具】增加api层dump功能
Merge pull request !1773 from 杜金航/master
2022-12-08 08:23:36 +00:00
h00558267 8efad6d006 modify checkpoint function for npu 2022-12-08 15:23:57 +08:00
i-robot fc7ca3f80f !1750 AsStrided + Transpose instead of AsStrided
Merge pull request !1750 from 刘嘉巍/asstrided
2022-12-08 07:21:17 +00:00
i-robot 234bbae07e !1762 [主线]RepeatInterleave 算子适配
Merge pull request !1762 from aikede/r1.8_repeat
2022-12-08 03:59:28 +00:00
aikede 56813b97e5 RepeatInterleave 算子适配 2022-12-08 11:25:28 +08:00
wangyicheng 4cb3be0e56 add infershapeofNHWC to formathelper 2022-12-08 10:39:51 +08:00
dujinhang 5c4c4050a4 溢出检测增加api层dump功能 2022-12-08 09:48:04 +08:00
hxf12345677 e60830426a logsumexp 算子适配修改 2022-12-07 17:14:27 +08:00
i-robot f7d498b87a !1766 set the mixing precision on the "aclCompileOpt"
Merge pull request !1766 from 刘晶晶/FP32
2022-12-07 04:38:58 +00:00
i-robot 0a430d4c16 !1720 亲和库限制说明
Merge pull request !1720 from 彭子荣/master
2022-12-07 04:12:25 +00:00
pengzirong 45b14f68e5 亲和库增加限制说明
补充亲和库限制

优化器合并参数说明
2022-12-07 11:58:18 +08:00
i-robot 64ddb54721 !1708 change asynchronous copy + stream synchronization to stream synchronization + synchronous copy
Merge pull request !1708 from 刘晶晶/aclrtMemcpy
2022-12-07 03:52:16 +00:00
liujingjing 23ea30c62f set the mixing precision on the "aclSetCompileopt" 2022-12-07 10:33:55 +08:00
i-robot cd97940976 !1761 【新增NpuOneTimeDropout特性】
Merge pull request !1761 from 宁振江/master
2022-12-06 14:00:42 +00:00
n00502110 afe81a0e2c 【预生成Dropoutmask新特性】clean code 2022-12-06 20:05:20 +08:00
n00502110 dce1b6051b 【预生成Dropoutmask新特性】根据20221201 TMG评审意见,修改为NpuPreGenDropout,增加不同概率P的支持。
在confor、Bert、Transformer-xl等多个模型验证loss正常,多个statelessDropOutGenMask合并为一次,算子执行时间降低。该特性会降低生成mask的随机性,但是精度无影响。
2022-12-06 19:19:47 +08:00
i-robot dfafe1c14e !1747 syncbn相关适配clean code修改主线
Merge pull request !1747 from huangxinliang/master
2022-12-06 10:51:04 +00:00
i-robot b4c0182ec5 !1736 精度比对和溢出检测工具同步
Merge pull request !1736 from 杜金航/master
2022-12-06 10:39:03 +00:00
i-robot c09de005ef !1746 enhance disable switch
Merge pull request !1746 from 唐超/enable_nz_out
2022-12-06 07:43:12 +00:00
chaoTANG570034 5746fcd494 fixed_review_found_bug 2022-12-06 14:49:51 +08:00
dujinhang 16a3474fd2 同步精度比对和溢出检测 2022-12-06 14:28:02 +08:00
xinlianglalala 467386d15d clean code 2022-12-06 14:05:06 +08:00
刘嘉巍 7296246129 change to 256 2022-12-06 11:46:39 +08:00
刘嘉巍 761e5be7fc AsStrided + Transpose instead of AsStrided 2022-12-06 09:38:12 +08:00
i-robot ae60e160c4 !1749 [UT][add]soc version and unified overflow detection interface
Merge pull request !1749 from zhaojingwei/master
2022-12-05 13:30:14 +00:00
zhaojingwei e1a81306fe [UT][add]soc version and unified overflow detection interface 2022-12-05 20:11:03 +08:00
i-robot e2df607544 !1737 set the FP32 defaults based on the soc version
Merge pull request !1737 from 刘晶晶/FP32
2022-12-05 09:18:12 +00:00
liujingjing 91e02c1dca set the FP32 defaults based on the soc version 2022-12-05 15:28:19 +08:00
chaoTANG570034 af062aeb4d disable nd mode 2022-12-04 13:10:43 +08:00
i-robot b5ba3440c2 !1719 _nnpack_spatial_convolution OpCommand重构
Merge pull request !1719 from 戢芳/ns_conv1.8
2022-12-02 09:25:00 +00:00
i-robot 3f44203970 !1710 【BugFix】修复smooth_l1_loss_backward的beta
Merge pull request !1710 from 戢芳/smoothloss1.8
2022-12-02 09:22:58 +00:00
i-robot a3da1ccaa9 !1716 [add]unified overflow detection interface
Merge pull request !1716 from zhaojingwei/master
2022-12-02 09:14:43 +00:00
i-robot bb376ee271 !1745 【BugFix】sum规避输入int和bool型
Merge pull request !1745 from 戢芳/sum_debug
2022-12-02 09:12:48 +00:00
pipihugh 52334374d4 sum规避int和bool型 2022-12-02 15:20:44 +08:00
i-robot df3424a747 !1733 【序列化bugfix】避免_lagecy_save进行数据存储
Merge pull request !1733 from 闫鹏全/master
2022-12-02 07:00:40 +00:00
i-robot 3038116634 !1663 sync_bn适配整改
Merge pull request !1663 from huangxinliang/master
2022-12-02 06:56:51 +00:00
xinlianglalala 71cf0f2e33 新增syncbn算子相关适配 2022-12-02 11:08:10 +08:00
zhaojingwei 97a11afe8e [WIP][change]unified overflow detection interface 2022-12-01 20:13:01 +08:00
闫鹏全 acb9916e6a 不支持legacy_save,采用zipfile的存储方式 2022-12-01 15:45:21 +08:00
pipihugh 50fe7a9dc0 修复smooth_l1_loss_backward的beta 2022-12-01 11:12:07 +08:00
i-robot 802e51b486 !1700 补充亲和库局限性说明
Merge pull request !1700 from 王夏夏/master
2022-11-30 07:43:01 +00:00
weili10 e9ba56a881 update OWNERS.
Signed-off-by: weili10 <liwei386@huawei.com>
2022-11-30 06:38:39 +00:00
pipihugh e806e7bb3f _nnpack_spatial_convolution OpCommand重构 2022-11-30 14:15:57 +08:00
xiaxia3 cf29817301 补充亲和库局限性说明 2022-11-29 17:14:24 +08:00
i-robot caa8f21b20 !1690 【bugfix】修改max/amax/maximum支持out参数是Tensor的切片部分的场景
Merge pull request !1690 from 郭夏/max
2022-11-29 01:30:22 +00:00
i-robot df8017d8b8 !1698 【序列化bugfix】解除cpu tensor加载时依赖torch_npu
Merge pull request !1698 from 闫鹏全/master
2022-11-28 13:42:20 +00:00
liujingjing 0644764af0 change asynchronous copy + stream synchronization to stream synchronization + synchronous copy 2022-11-28 18:18:32 +08:00
i-robot 54c9eb2adc !1703 【BugFix】sum保持self和result类型一致,且只规避bool型
Merge pull request !1703 from 戢芳/sum_debug
2022-11-28 05:56:42 +00:00
i-robot fb39e0fe98 !1699 Replace the FP32 defaults based on the soc version
Merge pull request !1699 from 刘晶晶/FP32
2022-11-28 01:28:19 +00:00
pipihugh eb958f2cb8 sum保持self和result类型一致,且只规避bool型 2022-11-26 20:19:48 +08:00
i-robot a626b9d7ac !1697 【modify】修改lstm算子开关门顺序,与torch语义对齐
Merge pull request !1697 from 郭夏/lstm
2022-11-25 10:40:46 +00:00
liujingjing 488a00a41f Replace the FP32 defaults based on the soc version 2022-11-25 17:19:29 +08:00
郭夏 9d28bb2e81 修改lstm正反向开关门顺序
Signed-off-by: 郭夏 <guoxia2@huawei.com>
2022-11-25 14:09:56 +08:00
i-robot f0e0ee0600 !1677 NZ cast back to ND in MatMuL
Merge pull request !1677 from 唐超/nz_to_nd
2022-11-25 02:25:05 +00:00
闫鹏全 4572f6dad5 解除torch.save中cpu tensor对torch_npu包的依赖 2022-11-25 10:16:47 +08:00
i-robot 4fa43712a3 !1694 bugfix:修复调用destroy_process_group接口未释放HCCL资源问题
Merge pull request !1694 from 施博/fix_hccl_release
2022-11-24 13:07:03 +00:00
i-robot fd7b68341a !1668 [feature] support npu tensortype, eg. torch.npu.FloatTensor
Merge pull request !1668 from shaoyf/feature/npu_tensor_type
2022-11-24 11:33:44 +00:00
i-robot 8aecacde9d !1691 DVPP适配-DecodeJpeg输出格式改ND&&CropAndResize参数修改&&worker进程设置jit_compileFalse
Merge pull request !1691 from 陈瑛琰/master
2022-11-24 10:59:42 +00:00
shaoyf 1cad7d98f7 support npu tensortype eg. torch.npu.FloatTensor 2022-11-24 17:30:45 +08:00
i-robot 7f2eb6dd32 !1686 soc version initialize
Merge pull request !1686 from zhaojingwei/master
2022-11-24 09:05:09 +00:00
郭夏 d05791a6f4 修改max接口out参数带切片Tensor的场景场景
Signed-off-by: 郭夏 <guoxia2@huawei.com>
2022-11-24 16:50:35 +08:00
zhaojingwei 27c2d44b4c soc version Initialize 2022-11-24 16:07:57 +08:00
c00659642 28011235ef DVPP适配-DecodeJpeg输出格式改ND&&CropAndResize参数修改&&worker进程设置jit_compileFalse 2022-11-24 15:30:04 +08:00
shibo19 e6dbc75118 修复调用destroy_process_group接口未释放HCCL资源问题 2022-11-24 11:10:17 +08:00
i-robot 02c9a1375a !1683 [bugfix] 修复hccl_dtype_wraper中当使用kwargs传参时的bug
Merge pull request !1683 from 王姜奔/master
2022-11-23 10:28:19 +00:00
王姜奔 d9497766b9 fix wrapper bug 2022-11-23 11:55:50 +08:00
chaoTANG570034 9c9db5b9ca cast back to nd 2022-11-22 15:57:24 +08:00
i-robot b5136487ce !1674 [BugFix] Support x.npu(device=None)
Merge pull request !1674 from shaoyf/bugfix/npu
2022-11-22 06:42:39 +00:00
shaoyf f198c39549 BugFix x.npu(device=None) 2022-11-22 06:24:01 +00:00
i-robot d6ce1ee4ee !1657 Set Default On
Merge pull request !1657 from 唐超/switch_default_in
2022-11-20 10:39:51 +00:00
i-robot d9cd088abd !1661 【BugFix】修复div输入dtype不同时计算错误问题
Merge pull request !1661 from 王晓/div_diff_dtype
2022-11-19 09:52:28 +00:00
wangxiao 0349431952 fix div different dtype bug 2022-11-19 17:07:18 +08:00
i-robot 6829a63297 !1662 Bugfix & Performance optimize for UpsampleNearest2dKernelNpu
Merge pull request !1662 from 刘嘉巍/print
2022-11-19 03:13:08 +00:00
刘嘉巍 bd5d280d26 bugfix of upsamplenearest2dkernel & optimize for graph mode 2022-11-19 10:26:48 +08:00
weili10 c894bde4c9 update torch_npu/csrc/aten/common/ResizeNpu.h.
Signed-off-by: weili10 <liwei386@huawei.com>
2022-11-18 10:45:33 +00:00
i-robot 531b053d07 !1660 use AclQueryEventRecordedStatus & AclQueryEventWaitStatus replace AclQueryEventStatus
Merge pull request !1660 from 刘晶晶/master
2022-11-18 07:53:19 +00:00
chaoTANG570034 637b4e56a8 set switch to default-on 2022-11-18 11:51:04 +08:00
i-robot c981fd9a90 !1637 【Feature】batchNorm参数format与输入一致
Merge pull request !1637 from 戢芳/bn1.8
2022-11-18 03:14:55 +00:00
i-robot c8be8e3201 !1651 Optimize performance of AsStrided
Merge pull request !1651 from 刘嘉巍/print
2022-11-18 03:05:01 +00:00
liujingjing 11e79f720e use AclQueryEventRecordedStatus & AclQueryEventWaitStatus replace AclQueryEventStatus 2022-11-18 10:17:13 +08:00
刘嘉巍 0c361fce90 optimize performance of AsStridedKernel 2022-11-18 09:27:52 +08:00
i-robot d229ec138f !1650 回退 'Pull Request !1631 : use AclQueryEventRecordedStatus & AclQueryEventWaitStatus replace AclQueryEventStatus'
Merge pull request !1650 from weili10/revert-merge-1631-master
2022-11-17 14:26:59 +00:00
weili10 f1d92c84fc 回退 'Pull Request !1631 : use AclQueryEventRecordedStatus & AclQueryEventWaitStatus replace AclQueryEventStatus' 2022-11-17 14:05:26 +00:00
i-robot 5b86087213 !1592 新API清单更新
Merge pull request !1592 from 彭子荣/master
2022-11-17 11:46:50 +00:00
i-robot 98e8f254b2 !1648 Allocate larger memory size while resize storage
Merge pull request !1648 from 刘嘉巍/print
2022-11-17 11:08:49 +00:00
i-robot 0b87a5f86d !1569 精度对比工具功能完善
Merge pull request !1569 from 杜金航/master
2022-11-17 10:56:51 +00:00
刘嘉巍 ae3b041f2c allocate double size 2022-11-17 18:51:28 +08:00
i-robot 33483dee61 !1644 【序列化bugfix】序列化加载参数map_location支持npu device数据
Merge pull request !1644 from 闫鹏全/master
2022-11-17 08:07:59 +00:00
i-robot e4bea2a1e6 !1642 【BugFix】sum统一转fp32计算
Merge pull request !1642 from 戢芳/sum_stype1.8
2022-11-17 08:05:57 +00:00
i-robot d5e9beefa3 !1632 【BugFix】删除copy_tensor_host_to_device
Merge pull request !1632 from 戢芳/copy_tensor1.8
2022-11-17 07:24:01 +00:00
闫鹏全 59dc1c08b9 torch.load适配支持npu device类型的入参 2022-11-17 14:47:16 +08:00
pipihugh 0496cae434 sum非fp32全转为fp32计算 2022-11-17 14:00:01 +08:00
pengzirong b0b6c9aeef API清单更新 2022-11-17 12:02:39 +08:00
pipihugh f0f5ded9af batchNorm参数format与输入一致,保证二进制场景功能正常 2022-11-16 19:43:56 +08:00
pipihugh c75e3453b4 bugfix:删除不合理的copy_tensor_host_to_device 2022-11-16 15:50:43 +08:00
i-robot cbee7908e7 !1631 use AclQueryEventRecordedStatus & AclQueryEventWaitStatus replace AclQueryEventStatus
Merge pull request !1631 from 刘晶晶/master
2022-11-16 03:09:59 +00:00
liujingjing eaf51789a3 use AclQueryEventRecordedStatus & AclQueryEventWaitStatus replace AclQueryEventStatus 2022-11-16 09:38:56 +08:00
i-robot 743f85fd6a !1624 【fixbug】修复cat不支持空tensor问题
Merge pull request !1624 from 王晓/cat_null
2022-11-15 11:27:48 +00:00
i-robot e9a88148e4 !1618 README更新
Merge pull request !1618 from Jializheng/master
2022-11-15 11:10:03 +00:00
wangxiao 79f97d6faf fix cat null 2022-11-15 16:17:35 +08:00
i-robot 3008e810f0 !1613 【BugFix】修复conv调用sum_out的反向问题
Merge pull request !1613 from 戢芳/conv_sum1.8
2022-11-15 02:31:12 +00:00
i-robot 86f2fb343b !1611 【BugFix】删除indexput中的异步拷贝
Merge pull request !1611 from 戢芳/indexput_up1.8
2022-11-15 02:25:06 +00:00
i-robot acd1344110 !1620 [bugfix] 给torch.cuda.amp下的文件打上自动转换函数补丁,避免自动转换失败
Merge pull request !1620 from 王姜奔/master
2022-11-14 12:57:01 +00:00
王姜奔 0f54bc31c7 update patch_cuda 2022-11-14 20:36:53 +08:00
j00648035 541b06723e update deepspeed readme 2022-11-14 20:25:28 +08:00
15990042527 e4881465bb 精度比对工具完善 2022-11-14 20:06:46 +08:00
15990042527 1235e10dd7 增加dump path判断 2022-11-14 19:54:17 +08:00
weili10 35d13ad2b6 update OWNERS.
Signed-off-by: weili10 <liwei386@huawei.com>
2022-11-14 09:23:10 +00:00
weili10 4f24433e65 update OWNERS.
Signed-off-by: weili10 <liwei386@huawei.com>
2022-11-14 08:58:31 +00:00
i-robot 6865f903bb !1609 修复bn3d format问题
Merge pull request !1609 from 王晓/bn3d
2022-11-14 08:54:36 +00:00
i-robot a083f19a2e !1571 bugfix: 修复DDP场景多进程场景创建文件失败问题
Merge pull request !1571 from 施博/fix_profier_ddp
2022-11-14 08:42:35 +00:00
15990042527 d10e745dfe hooks sample 修改 2022-11-14 15:57:59 +08:00
wangxiao e29cdc0ce0 fix bn3d format 2022-11-14 15:30:21 +08:00
i-robot e0a6954d09 !1557 DVPP适配-DecodeJpeg增加属性dst_img_format
Merge pull request !1557 from 陈瑛琰/master
2022-11-14 02:42:27 +00:00
pipihugh 84277629bf bugfix:修复conv调用sum_out的反向问题 2022-11-14 10:03:22 +08:00
pipihugh 13e74f596e bugfix:删除indexput适配中的异步拷贝 2022-11-12 18:24:39 +08:00
i-robot 1cc15c74db !1589 empty_with_format整改
Merge pull request !1589 from 戢芳/empty1.8
2022-11-12 09:02:38 +00:00
i-robot 96cdca2b87 !1606 [BugFix] Support npu:x format for Tensor.npu
Merge pull request !1606 from shaoyf/bugfix_npu
2022-11-11 11:37:59 +00:00
shaoyf c39619f3b6 Bugfix Support npu:x format for Tensor.npu 2022-11-11 09:40:29 +00:00
i-robot 38b321ea66 !1604 【序列化bugfix】兼容老版本的文件加载
Merge pull request !1604 from 闫鹏全/master
2022-11-11 09:32:16 +00:00
闫鹏全 4c8fbf775f 兼容old_zipfile_serialization 2022-11-11 17:17:00 +08:00
pipihugh 5854088d63 empty_with_format整改 2022-11-11 16:23:35 +08:00
c00659642 36592dd2d6 DVPP适配-DecodeJpeg增加属性dst_img_format 2022-11-11 15:51:07 +08:00
i-robot e235eaea66 !1582 【图模式1.8】Enable asynchronous printing in graph mode
Merge pull request !1582 from 刘嘉巍/print
2022-11-11 03:39:20 +00:00
i-robot b9f77ee6e2 !1580 Independent storage_offset compile in AsStrided
Merge pull request !1580 from 刘嘉巍/dev
2022-11-11 03:36:06 +00:00
i-robot 2bc88f9c80 !1576 【图模式1.8】Bugfix in resize_impl_npu_ for graph mode
Merge pull request !1576 from 刘嘉巍/error
2022-11-11 03:33:38 +00:00
i-robot 37ed15eb08 !1574 【bugfix】修改_Aminmax在keepdim=false时shape未对齐的问题
Merge pull request !1574 from 郭夏/aminmax
2022-11-11 02:03:01 +00:00
i-robot 40828f1a8f !1566 【BugFix】max支持不同dtype输入
Merge pull request !1566 from 戢芳/max_dtype1.8
2022-11-10 13:05:41 +00:00
刘嘉巍 5e0c24e900 independent storage_offset compile in AsStrided 2022-11-10 20:52:30 +08:00
刘嘉巍 0e2d101ad1 enable asynchronous print in graph mode 2022-11-10 20:40:46 +08:00
i-robot 7bda7fa158 !1392 【图模式1.8】Basic module for asynchronous printing in graph mode
Merge pull request !1392 from 刘嘉巍/print-dev
2022-11-10 11:51:42 +00:00
i-robot 173a0a53bd !1561 【序列化】npu tensor的序列化存储
Merge pull request !1561 from 闫鹏全/master
2022-11-10 11:49:42 +00:00
刘嘉巍 cddeb21aeb bugfix resize_impl_npu_ 2022-11-10 16:44:39 +08:00
pipihugh 58a3cd26df bugfix:max支持不同dtype 2022-11-10 15:36:09 +08:00
闫鹏全 ca830defcc npu serialization 2022-11-10 14:33:00 +08:00
郭夏 91ad5e0aa4 修改keepdim为false时报错问题
Signed-off-by: 郭夏 <guoxia2@huawei.com>
2022-11-10 06:11:51 +00:00
i-robot 7e50d454bf !1560 【Feature】conv类算子私有格式整改
Merge pull request !1560 from 戢芳/conv1.8
2022-11-10 06:08:04 +00:00
shibo19 8fe250db9a 修复DDP场景多进程场景创建文件失败问题 2022-11-10 10:34:43 +08:00
15990042527 254e2075a3 fix json.load bug 2022-11-10 10:16:55 +08:00
i-robot 4f04bb0202 !1552 【Feature】sum增加dimlist的校验
Merge pull request !1552 from 戢芳/sum_dim1.8
2022-11-10 01:16:27 +00:00
pipihugh dc33615bdc conv类算子featuremap直接指定5HD,其他地方不指定私有格式 2022-11-09 14:38:15 +08:00
pipihugh df1b14b3e3 sum添加dimlist的校验 2022-11-09 13:52:42 +08:00
i-robot e06786ec83 !1544 【torch.fx】patch fx python_code and to_folder
Merge pull request !1544 from will-devil/fxdev
2022-11-09 03:05:28 +00:00
i-robot f722beb774 !1541 【bugfix】解决PackPadded适配调用rang_out报错
Merge pull request !1541 from 郭夏/pack
2022-11-09 01:51:27 +00:00
i-robot c097719dfc !1523 [feature] use aclrtQueryEventStatus to get better event query performance
Merge pull request !1523 from 王强/master
2022-11-08 13:56:56 +00:00
wq160 22c1dfb7fd [feature] use aclrtQueryEventStatus to get better event query performance 2022-11-08 21:18:02 +08:00
i-robot 766005b953 !1502 【新增DEBUG日志】记录pytorch申请释放内存及缓存池使用情况
Merge pull request !1502 from yangxiaorun/master
2022-11-08 12:44:56 +00:00
i-robot 6dccf9529c !1529 [Feature] Update format selection policy in binary
Merge pull request !1529 from 王强/master
2022-11-08 12:36:46 +00:00
i-robot d8cd9955e9 !1546 README更新
Merge pull request !1546 from 彭子荣/master
2022-11-08 12:16:56 +00:00
wq160 69af833543 Update format selection policy in binary 2022-11-08 19:41:21 +08:00
i-robot 053e08f354 !1545 revert d6fb78 + a283f4 + 1af6a3
Merge pull request !1545 from 王强/master
2022-11-08 11:17:04 +00:00
pengzirong 43a8bc21e8 readme新增镜像版本配套表 2022-11-08 17:12:25 +08:00
wq160 c5f54b8e80 revert d6fb78 + a283f4 + 1af6a3 2022-11-08 16:43:21 +08:00
wangyicheng 70d068b6ee patch fx method and add fx unittest 2022-11-08 15:24:20 +08:00
i-robot 8305c7e681 !1536 API修正
Merge pull request !1536 from 彭子荣/master
2022-11-08 03:47:09 +00:00
pengzirong f72dcf4673 API修正 2022-11-08 11:17:53 +08:00
郭夏 06b1fb68bf 修改pack处调用rang_out冗余问题
Signed-off-by: 郭夏 <guoxia2@huawei.com>
2022-11-08 03:17:07 +00:00
i-robot 79512f48d3 !1494 【add】:新增torch._aminmax的npu适配
Merge pull request !1494 from 郭夏/aminmax
2022-11-08 02:04:52 +00:00
i-robot 548ca2002d !1488 torch_npu.fx特性支持 torch_npu.contrib.module
Merge pull request !1488 from will-devil/fxdev
2022-11-08 01:36:55 +00:00
wangyicheng 2d31aa3017 support fx feature 2022-11-07 14:05:25 +08:00
i-robot 2d3042ae0f !1499 【BugFix】补充nllloss_2d的weight赋0的判断条件
Merge pull request !1499 from 戢芳/nllloss_debug
2022-11-07 02:02:53 +00:00
i-robot e07fe4f7b9 !1456 【bugfix】: 修复mul在输入有scalar参数时(tensor * scalar)输出类型处理错误问题
Merge pull request !1456 from 郭夏/rsub
2022-11-04 08:12:26 +00:00
yangxiaorun 2df5874875 feat: add memory log for pytorch 2022-11-04 15:50:09 +08:00
郭夏 07ceee671c 修复byte输入时参数类型未对齐问题
Signed-off-by: 郭夏 <guoxia2@huawei.com>
2022-11-04 11:18:28 +08:00
i-robot 6884d31656 !1518 all_reduce, reduce, broadcast支持数据类型自动转换
Merge pull request !1518 from 王姜奔/master
2022-11-03 15:26:16 +00:00
王姜奔 5e02263aba add wrap_dtype_for_hccl 2022-11-03 22:11:34 +08:00
i-robot be839d5f38 !1513 DVPP适配-多进程启动方式改spawn&&设置优先级
Merge pull request !1513 from 陈瑛琰/master
2022-11-03 11:34:06 +00:00
i-robot 99aa79ff5c !1509 API清单更新
Merge pull request !1509 from 彭子荣/master
2022-11-03 09:14:21 +00:00
pengzirong ab2d1b148f API清单更新 2022-11-03 16:58:51 +08:00
c00659642 6384e7f4d4 DVPP适配-多进程启动方式改spawn&&设置优先级 2022-11-03 16:39:42 +08:00
i-robot 9c85d508e7 !1495 [fix] scalar scene and rank=1 scene do not support NZ
Merge pull request !1495 from 王强/master
2022-11-03 08:36:10 +00:00
i-robot 970f14f4ba !1500 DVPP适配-CropAndResizeV2/ReverseV2/NormalizeV2
Merge pull request !1500 from 陈瑛琰/master
2022-11-03 07:22:25 +00:00
i-robot 5d98864402 !1501 aoe: update op list for aoe
Merge pull request !1501 from 施博/add_op_for_aoe
2022-11-03 07:08:13 +00:00
郭夏 1aeebf1e55 新增aminmax适配
Signed-off-by: 郭夏 <guoxia2@huawei.com>
2022-11-03 13:56:10 +08:00
i-robot a6bbba4bef !1446 RELEASENOTE更新
Merge pull request !1446 from 彭子荣/master
2022-11-03 03:24:12 +00:00
shibo19 a6c7c3fc4a update op list for aoe 2022-11-03 11:19:37 +08:00
c00659642 7145c9f786 DVPP适配-CropAndResizeV2/ReverseV2/NormalizeV2 2022-11-03 10:50:40 +08:00
wq160 13a03f75f0 [fix] scalar scene and rank=1 scene do not support NZ 2022-11-03 09:13:41 +08:00
pipihugh cc18215871 bugfix:补充nllloss_2d对weight赋0的判断条件 2022-11-02 16:49:15 +08:00
pengzirong 1cb34f68de releasenote更新RC3&多机多卡合指南合并进训练指南 2022-11-01 15:21:26 +08:00
i-robot 81c3135a9d !1492 【联调接口调整】DVPP传递STRING类型tensor&&GE接口参数类型调整
Merge pull request !1492 from yangxiaorun/master
2022-11-01 06:21:19 +00:00
yangxiaorun 212e4f00de fix: dvpp interface joint commissioning 2022-11-01 11:05:33 +08:00
i-robot e654ffdd5e !1425 profiler性能优化
Merge pull request !1425 from 施博/profiler_update
2022-10-31 07:08:40 +00:00
i-robot 0b2e994399 !1470 【BugFix】规避sum不支持bool类型
Merge pull request !1470 from 戢芳/sum_bool
2022-10-28 10:50:50 +00:00
i-robot 2d7145f421 !1469 【图模式1.8】Adapt ops & fix bugs in graph mode
Merge pull request !1469 from 刘嘉巍/dev-error
2022-10-28 09:26:45 +00:00
i-robot 83c0a19448 !1466 【modify】:修改pack-lstm-pad,pack时保证有效时间T内的填充,lstm保持定长计算,pack时与CPU对齐输出pack后的数据
Merge pull request !1466 from 郭夏/pack-lstm-pad
2022-10-28 09:24:58 +00:00
i-robot 2925d7e022 !1472 batchnorm性能优化
Merge pull request !1472 from shaoyf/master_batchnorm
2022-10-28 09:23:10 +00:00
pipihugh 544a42c5f6 sum算子不支持bool类型,适配层转int64规避 2022-10-28 16:52:20 +08:00
i-robot 0059f7e350 !1478 [refactor] optimize contiguous op name, op: AsStrided ViewCopy
Merge pull request !1478 from xudaohong/master
2022-10-28 01:14:45 +00:00
x00430237 20800d2e83 [refactor] optimize contiguous op name, AsStrided ViewCopy 2022-10-27 21:13:12 +08:00
shaoyf e5f6878048 Change the dtype of num_batches_tracked in _NormBase from int64 to int32 2022-10-27 20:32:38 +08:00
刘嘉巍 958305ad28 adapt ops & fix bug for graph mode 2022-10-27 16:08:41 +08:00
郭夏 fd28453df3 根据TMG决策实现pack-lstm-pad,但是lstm依然保持定长计算。
Signed-off-by: 郭夏 <guoxia2@huawei.com>
2022-10-27 14:13:17 +08:00
i-robot 1b4d83f230 !1460 [refactor] optimize contiguous op name
Merge pull request !1460 from xudaohong/master
2022-10-26 10:04:37 +00:00
i-robot d6fb7864e5 !1461 【Feature】算子不指定输出私有格式NZ
Merge pull request !1461 from 戢芳/format_nz1.8
2022-10-26 09:48:40 +00:00
i-robot a283f40286 !1459 【Feature】算子不指定输出私有格式5HD
Merge pull request !1459 from 戢芳/format_bn1.8
2022-10-26 09:46:34 +00:00
i-robot 1af6a37b69 !1450 【Feature】conv类算子不指定输出私有格式
Merge pull request !1450 from 戢芳/format1.8
2022-10-26 09:44:39 +00:00
i-robot 360317efc5 !1464 [bugfix]cancel lstm npu_dtype_cast
Merge pull request !1464 from darin123/master
2022-10-26 09:16:45 +00:00
i-robot 2a2d3870d5 !1455 在codegen中添加检查 has_torch_function
Merge pull request !1455 from will-devil/gendev
2022-10-26 09:14:48 +00:00
x00430237 0f547c35cc [refactor] modify codecheck 2022-10-26 16:46:57 +08:00
anping 1cf7737314 [bugfix]cancel lstm npu_dtype_cast 2022-10-26 16:33:58 +08:00
x00430237 a503cb839a [refactor] modify test cases synchronously 2022-10-26 15:46:21 +08:00
x00430237 1a41cf7773 Merge branch 'master' of gitee.com:ascend/pytorch 2022-10-26 15:44:33 +08:00
i-robot b747bcd4a8 !1453 【BugFix】sum适配重构
Merge pull request !1453 from 戢芳/sum1.8
2022-10-26 07:18:33 +00:00
pipihugh 2e237b83e1 不指定输出私有格式:NZ 2022-10-26 15:11:35 +08:00
x00430237 1a935fadc5 [refactor] optimize memory repoint contiguous op name 2022-10-26 09:29:39 +08:00
pipihugh 1fc3673653 适配层不指定私有格式输出:5HD 2022-10-25 21:11:06 +08:00
刘嘉巍 e6b82d358a basic module for asynchronous printing in graph mode 2022-10-25 20:24:36 +08:00
wangyicheng e2f6481825 check has_torch_function in codegen 2022-10-25 20:00:32 +08:00
x00430237 c533d2a7ca [refactor] optimize contiguous op name 2022-10-25 19:47:54 +08:00
i-robot c5b0246ea9 !1451 [Feature] Transdata - Do not specific out0 format of MaxPoolGradWithArgmaxV1
Merge pull request !1451 from 王强/master
2022-10-25 09:13:42 +00:00
i-robot f8cd015cb7 !1445 1.8.1算子适配lstm_cell
Merge pull request !1445 from 王晓/1.8lstm_cell_update
2022-10-25 08:49:52 +00:00
wangxiao 5463ac1261 1.8 lstm_cell 2022-10-25 10:04:14 +08:00
i-robot 10ac4bdb99 !1440 【refactor】npu_dtype_cast替换to方案
Merge pull request !1440 from darin123/master
2022-10-24 11:27:38 +00:00
pipihugh b55e7b75c0 sum适配重构 2022-10-24 17:47:11 +08:00
wq160 1f0e857c11 Do not specific out0 format of MaxPoolGradWithArgmaxV1 2022-10-24 16:28:39 +08:00
pipihugh 16da77be78 conv类接口不再指定输出私有格式 2022-10-24 14:49:49 +08:00
anping 6967c22f5d [refactor]npu_dtype_cast replace to function. 2022-10-24 11:25:28 +08:00
i-robot 08da087f84 !1429 优化npu_dtype_cast
Merge pull request !1429 from 王夏夏/master
2022-10-22 08:08:19 +00:00
王夏夏 b7f3d15927 Merge branch 'master' of gitee.com:ascend/pytorch into master
Signed-off-by: 王夏夏 <wangxiaxia3@huawei.com>
2022-10-22 06:30:33 +00:00
weili10 978be93b50 update README.zh.md.
Signed-off-by: weili10 <liwei386@huawei.com>
2022-10-22 03:55:17 +00:00
i-robot c15559db8d !1435 修改viewcopy入参编译选项为independent,可减少重复编译
Merge pull request !1435 from 王晓/1.8_master_viewcopy_independent
2022-10-21 09:14:10 +00:00
i-robot 0c52b61e0d !1413 【BugFix】add支持不同dtype输入
Merge pull request !1413 from 王晓/add_high_type
2022-10-21 02:58:32 +00:00
i-robot df06968a03 !1408 删除index中expandTensors流程
Merge pull request !1408 from 王晓/1.8_index_rm_expand
2022-10-21 02:56:34 +00:00
i-robot fd5d50c47a !1432 cast kernel 内存使用优化
Merge pull request !1432 from yangxiaorun/master
2022-10-21 02:52:13 +00:00
i-robot 5868a64322 !1431 [fix] bn use 5HD only when weight is 5hd
Merge pull request !1431 from 王强/master
2022-10-21 01:14:17 +00:00
wq160 d44c3a69cb [fix] bn use 5HD only when weight is 5hd 2022-10-20 22:18:46 +08:00
wangxiao bb584d217f view copy independent 2022-10-20 19:27:12 +08:00
wangxiao d9e2344f5c rm index expandtensors 2022-10-20 17:56:45 +08:00
yangxiaorun ea84a66227 fix: optimize cast op forward: use less npu memory to save cast dtype 2022-10-20 16:07:41 +08:00
xiaxia3 3f18792ad6 优化npu_dtype_cast 2022-10-20 15:02:00 +08:00
i-robot 0de28eccf4 !1426 【feature】优化环境变量ACL_DUMP_DATA内部判定
Merge pull request !1426 from 汪瑞哲/master
2022-10-20 06:35:17 +00:00
i-robot 7364d556ce !1424 [Fix] use dynamicCompileswitch=enable to represent the case of binary
Merge pull request !1424 from 王强/master
2022-10-20 06:09:07 +00:00
wang-ruizhe7 41397946b5 feat: Optimize option: ACL_DUMP_DATA
Change the internal implementation of this functions, using
const static to ensure that the GetBoolTypeOption func run only once.
2022-10-20 14:05:08 +08:00
shibo19 b86053a03e performance optimization for profiler 2022-10-20 11:49:30 +08:00
wq160 00178dbabd [Fix] use dynamicCompileswitch=enable to represent the case of binary 2022-10-20 11:02:57 +08:00
weili10 1f7eb235f6 update README.zh.md.
Signed-off-by: weili10 <liwei386@huawei.com>
2022-10-20 02:10:21 +00:00
i-robot 850ec52a64 !1421 资料问题更新
Merge pull request !1421 from 彭子荣/master
2022-10-19 12:09:47 +00:00
pengzirong 090da68ef5 修改版本配套表&问题 2022-10-19 18:04:30 +08:00
i-robot f109c0c391 !1416 [Feature] remove cast weight in binary and do not specify format
Merge pull request !1416 from 王强/master
2022-10-19 09:55:35 +00:00
wq160 06a935aabf remove cast weight in binary and do not specify format 2022-10-19 17:03:55 +08:00
wangxiao e679e0148f fix add of different dtype 2022-10-18 17:24:36 +08:00
i-robot 16678c3a95 !1409 补充README图片
Merge pull request !1409 from 彭子荣/master
2022-10-18 08:24:00 +00:00
pengzirong 92b01dfa9b 补充FAQ图片 2022-10-18 09:24:48 +08:00
i-robot 3a4b1a7ba5 !1393 新增训练调优&工具使用指南
Merge pull request !1393 from 彭子荣/master
2022-10-17 04:00:23 +00:00
i-robot 65c969c041 !1379 【feature】新增环境变量DISABLE_ACLOP_COM_EXE
Merge pull request !1379 from 汪瑞哲/master
2022-10-15 03:07:41 +00:00
i-robot 833249aba8 !1373 index indexput v3
Merge pull request !1373 from 王晓/1.8index_v3_new
2022-10-14 15:47:51 +00:00
pengzirong 41ca455c8f 新增训练调优&工具使用指南 2022-10-14 18:23:43 +08:00
wang-ruizhe7 594463aa28 feat: Add env variable "DISABLE_ACLOP_COM_EXE"
1. This env variable can control whether op compile and execute
in single mode(with task queue or not).
2. Change the internal implementation of the three functions, using
   const static to ensure that the GetBoolTypeOption func run only once.
2022-10-14 17:26:03 +08:00
i-robot 9600236732 !1383 【BugFix】去除mul_中多余copy操作
Merge pull request !1383 from 戢芳/mul_
2022-10-14 06:22:50 +00:00
pipihugh df4d3cd0ab bugfix:去除mul中多余的copy操作 2022-10-14 09:32:49 +08:00
wangxiao c37d7a503f index indexput v3 2022-10-12 20:20:21 +08:00
i-robot 7b0d81b276 !1362 bugfix:torch.device for Module.to
Merge pull request !1362 from 王夏夏/master
2022-10-09 13:21:59 +00:00
xiaxia3 520a201d85 bugfix:torch.device for Module.to 2022-10-09 21:10:14 +08:00
i-robot cde81ba099 !1354 【bernoulli适配】 bernoulli IR修改,适配层对齐 & cast 问题处理
Merge pull request !1354 from 沈鹏程/108_bernoulli_IR
2022-10-08 14:17:43 +00:00
shenpengcheng 9c54f441db IR修改适配层对齐 & cast问题处理
code fix

code fix again

code modify
2022-10-08 20:58:10 +08:00
i-robot 5de6dbec2b !1355 FAQ文档修改
Merge pull request !1355 from 龚俊强/master
2022-10-08 11:20:53 +00:00
i-robot bf687ce7c0 !1349 【bugfix】1.8版本显存性能劣化修正
Merge pull request !1349 from 闫鹏全/master
2022-10-08 11:06:53 +00:00
junqiang521 787c40813d add FAQs 2022-10-08 18:37:36 +08:00
i-robot da7503f088 !1352 [Cleancode] Clean code for wrong import order.
Merge pull request !1352 from shaoyf/clean_code_master
2022-10-08 10:16:52 +00:00
i-robot 3938ee89b9 !1343 修复当dynamic=False时的参数GradScaler父类Cuda_GradScaler第337行的校验错误
Merge pull request !1343 from 王姜奔/fix_static_loss_bug
2022-10-08 09:21:02 +00:00
shaoyf f296e8584b Clean code for wrong import order. 2022-10-08 08:56:25 +00:00
i-robot 86fabd9a3e !1326 gridsampler2D 传参符合算子IR要求
Merge pull request !1326 from aikede/bug_grid
2022-10-08 07:46:54 +00:00
i-robot d0f3bb4b91 !1339 修复index中转连续走aicpu导致性能下降问题
Merge pull request !1339 from 王晓/index_mae
2022-10-08 07:44:57 +00:00
闫鹏全 c9cf97d466 NPU计算格式适配 2022-10-08 14:39:00 +08:00
wangxiao 22305f9a31 fix index bug 2022-10-08 14:28:21 +08:00
王姜奔 71f4a3b8ad 修复当dynamic=False时的参数GradScaler父类Cuda_GradScaler第337行的校验错误
Signed-off-by: 王姜奔 <wangjiangben@huawei.com>
2022-10-06 09:17:41 +00:00
i-robot 32720f937e !1335 修复index_select反向index_add不支持index为0维问题
Merge pull request !1335 from 王晓/index_select
2022-10-05 08:38:58 +00:00
wangxiao 9c14ce9fb6 fix bug index_add 2022-09-30 17:39:46 +08:00
i-robot 0c1edc359f !1328 【BugFix】修正HCCL报错信息不完整
Merge pull request !1328 from 汪瑞哲/master
2022-09-29 13:26:55 +00:00
i-robot 2242370db7 !1327 【BugFix】修复maksed_select的输出shape
Merge pull request !1327 from 戢芳/masked_select1.8
2022-09-29 13:06:58 +00:00
wang-ruizhe7 1d88b003f9 fix: Fix HCCL error does not have complete error message
HCCL error does not show specific error code and error info, so add
AclGetErrMsg() interface in C10D_HCCL_CHECK macro to show more detailed
error message.
2022-09-29 19:57:43 +08:00
i-robot 7a7d375f4c !1313 【Refactor】更改数据预处理时算子优先级属性的设置方式
Merge pull request !1313 from 汪瑞哲/master
2022-09-28 13:07:14 +00:00
pipihugh e719faa568 masked_select修改输出shape 2022-09-28 16:40:05 +08:00
aikede eab18eea79 传参保持和算子IR一致 2022-09-28 13:32:58 +08:00
i-robot 1c722f39cd !1325 回退 'Pull Request !1305 : add ProcessGroupHCCL methods binding'
Merge pull request !1325 from weili10/revert-merge-1305-master
2022-09-28 03:34:33 +00:00
i-robot ad23806589 !1321 【精度比对】backwardhook执行bug修复
Merge pull request !1321 from 闫鹏全/master
2022-09-28 03:32:32 +00:00
weili10 adf0dd0d21 回退 'Pull Request !1305 : add ProcessGroupHCCL methods binding' 2022-09-28 03:07:21 +00:00
wang-ruizhe7 4a16edbf83 refactor: set op priority attr in OpCommand::Run()
Due to priority attr is a property of op, this attr can be set in
OpCommand::Run() at first, before calling InnerRun(without task
queue) or ExecFunc(with task queue).
2022-09-28 10:44:24 +08:00
i-robot 70efb590da !1312 【BCM】index_put 适配
Merge pull request !1312 from hxf12345677/indexput
2022-09-27 14:10:44 +00:00
i-robot 73411490ab !1319 【BugFix】_unique2算子fp16场景存在精度问题,转fp32规避
Merge pull request !1319 from 戢芳/unique1.8
2022-09-27 13:20:45 +00:00
i-robot 098a7268cf !1298 masked_select支持非bool mask
Merge pull request !1298 from 王晓/maskedselect
2022-09-27 12:54:43 +00:00
闫鹏全 09ed1d1ece 修复正向计算result类型推断错误,导致的反向hook执行报错的问题 2022-09-27 20:07:14 +08:00
i-robot 00147fe6e8 !1309 【图模式1.8】Disable DropoutKernel RNG state in graph mode
Merge pull request !1309 from 刘嘉巍/dev-bert
2022-09-27 11:46:44 +00:00
hxf12345677 7fce2bc7e7 indexput 适配 2022-09-27 19:42:12 +08:00
pipihugh 2f2105d115 bugfix:_unique2算子fp16场景存在精度问题,转fp32规避 2022-09-27 17:39:40 +08:00
i-robot 6e8160d05b !1314 [Bugfix] Support npu:x format for Module.to.
Merge pull request !1314 from 尤安升/hooks
2022-09-27 08:22:41 +00:00
i-robot 7f8559628e !1305 add ProcessGroupHCCL methods binding
Merge pull request !1305 from weili10/master
2022-09-27 08:20:48 +00:00
尤安升 753c3f59ee [Bugfix] Support npu:x format for Module.to. 2022-09-27 15:18:08 +08:00
刘嘉巍 81f92f7917 disable dropout rng state in graph mode 2022-09-27 10:24:57 +08:00
i-robot 8dcbbd6d2a !1290 [Cleancode] clean code for all.
Merge pull request !1290 from shaoyf/master_clean_code
2022-09-26 12:35:12 +00:00
i-robot f172b8bcd3 !1302 回退padv3, padv3grad适配
Merge pull request !1302 from hxf12345677/silu1
2022-09-26 12:33:15 +00:00
weili10 0c29dd5ba6 add ProcessGroupHCCL methods binding 2022-09-26 17:16:36 +08:00
hxf12345677 fd5300a907 padv3, padv3grad适配层回退 2022-09-26 13:42:20 +08:00
shaoyf 6707e09ad8 adjust torch_npu import order 2022-09-26 10:30:33 +08:00
i-robot b277702854 !1286 【BugFix】修正HCCL接口reduce标杆
Merge pull request !1286 from 戢芳/reduce_test
2022-09-26 02:12:57 +00:00
i-robot 30c0c89640 !1291 【BCM】删除triu、scatter_add过适配
Merge pull request !1291 from 戢芳/delete
2022-09-26 02:10:55 +00:00
wangxiao 8f9e5dd4a4 maskselect mask support no bool 2022-09-24 16:34:43 +08:00
i-robot b63b652747 !1297 bugfix:解决使用device6, device7无法barrier的问题
Merge pull request !1297 from 袁舰/master
2022-09-24 08:25:03 +00:00
i-robot 41204b7102 !1296 【BugFix】修复task queue中的内存泄露,显式析构ExecuteParas类型变量
Merge pull request !1296 from yangxiaorun/master
2022-09-24 07:57:01 +00:00
yangxiaorun 4ea78ef838 fix: fix memory leak of task queue
Due to "struct ExecuteParas" has string type, ExecuteParas is not tile memory. So we need call
destructor old struct when we want to new one.
2022-09-24 15:26:52 +08:00
袁舰 dfd3398c6b bugfix:解决使用device6, device7无法barrier的问题
bugfix:解决使用device6, device7无法barrier的问题

Signed-off-by: 袁舰 <goodjobwubai@126.com>
2022-09-24 07:20:18 +00:00
i-robot 96029971af !1281 【BCM】masked_scatter去除过适配
Merge pull request !1281 from 戢芳/masked_scatter
2022-09-23 11:04:16 +00:00
i-robot 4814f794a6 !1282 【BCM】upsample_nearest3d、upsample_trilinear3d删除过适配
Merge pull request !1282 from 戢芳/upsample3d
2022-09-23 11:02:18 +00:00
i-robot 0ce6c56cd7 !1294 【BugFix】cumprod IR参数变更
Merge pull request !1294 from 戢芳/cumprod1.8
2022-09-23 10:52:17 +00:00
pipihugh f1f0b0e34c cumprod IR参数变更 2022-09-23 18:20:35 +08:00
i-robot 73a8051005 !1289 aoe支持算子列表刷新,dump算子同步刷新
Merge pull request !1289 from 施博/aoe_ops_master
2022-09-23 08:51:38 +00:00
pipihugh a248a70379 删除triu、scatter_add过适配 2022-09-23 13:49:41 +08:00
shaoyf 5e05522c62 clean code for all 2022-09-23 11:38:35 +08:00
shibo19 05fafa4046 aoe支持算子列表刷新,dump算子同步刷新 2022-09-23 11:30:05 +08:00
pipihugh 9c73a875e7 bugfix:修正reduce的标杆 2022-09-22 21:01:51 +08:00
pipihugh 7f3f3f9274 BCM整改:masked_scatter删除类型转换 2022-09-22 13:58:22 +08:00
pipihugh c9ef4b0ff7 BCM整改,删除数据类型转换:upsample_nearest3d、upsample_trilinear3d 2022-09-22 13:43:49 +08:00
i-robot b0a2f29441 !1280 【图模式1.8】enable torch profilling in graph mode
Merge pull request !1280 from 刘嘉巍/dev-bert
2022-09-22 03:37:25 +00:00
刘嘉巍 b3cb7d5919 RECORD_FUNCTION in graph mode 2022-09-22 10:35:07 +08:00
i-robot 001a6e8d07 !1272 【BCM】upsample_nearest1d调用Resize
Merge pull request !1272 from 戢芳/resize
2022-09-20 13:36:34 +00:00
pipihugh 4436ffbd95 upsample_nearest1d适配Resize 2022-09-20 20:06:49 +08:00
i-robot a9425d1e0e !1275 【BugFix】修复new_zeros、new_full、new_ones、new_tensor算子参数device='npu'报错问题
Merge pull request !1275 from shaoyf/master_fixbug_new_zeros
2022-09-20 12:04:36 +00:00
i-robot e2d8bcb7e8 !1276 [Bugfix] fix as_tensor operator.
Merge pull request !1276 from 尤安升/hooks
2022-09-20 06:44:34 +00:00
尤安升 4618770dd5 [Bugfix] fix as_tensor operator. 2022-09-20 10:28:54 +08:00
i-robot 31eaff14dd !1251 【图模式1.8】adapt ops for graph mode & add testcase
Merge pull request !1251 from 刘嘉巍/dev
2022-09-19 13:24:25 +00:00
i-robot 0f64213c10 !1256 nonzero第三类算子适配
Merge pull request !1256 from 王晓/nonzero_third_kind
2022-09-19 12:56:27 +00:00
i-robot 069d1d59dd !1252 Modify randperm adapt to StatelessRandperm
Merge pull request !1252 from 王晓/randperm_n_input
2022-09-19 12:54:27 +00:00
weili10 3efc04b8c6 update OWNERS.
Signed-off-by: weili10 <liwei386@huawei.com>
2022-09-19 11:25:24 +00:00
shaoyf 1c60a5418a fix new_zeros new_full new_ones new_tensor when device='npu' 2022-09-19 19:13:05 +08:00
i-robot 283252d706 !1247 index算子IR变更(商分)
Merge pull request !1247 from 王晓/rc3_index
2022-09-17 10:36:03 +00:00
wangxiao ee8908e469 nonzero 3rd kind of op adapter 2022-09-17 09:47:30 +08:00
i-robot 5436f62167 !1246 【1.8.1算子适配】 MaskedSelect改为第三类算子适配
Merge pull request !1246 from hxf12345677/maskedselect
2022-09-16 15:10:16 +00:00
i-robot 383df14b5f !1242 【1.8.1算子适配】适配层添加 padv3 aicpu算子支持
Merge pull request !1242 from hxf12345677/padv31
2022-09-16 15:08:17 +00:00
i-robot 1c658ae65e !1245 【BugFix】修复avgpool2d 算子输出shape错误问题, 对不支持三维输入做增维操作
Merge pull request !1245 from hxf12345677/avgpool2d
2022-09-16 15:06:16 +00:00
hxf12345677 37cd3ae55b maskedselect算子改为第三类算子适配 2022-09-16 20:32:43 +08:00
i-robot f3c6cf7c9e !1237 【精度比对工具】文档完善
Merge pull request !1237 from 闫鹏全/master
2022-09-16 08:22:28 +00:00
i-robot 1c99b9b757 !1092 【高校贡献-西安交大软件学院】【Pytorch框架适配-Exp2】第二次提交
Merge pull request !1092 from 李明璐/Exp2
2022-09-16 07:14:30 +00:00
刘嘉巍 34bb5c2614 adapt ops for graph mode & add testcase 2022-09-16 14:31:58 +08:00
weili10 c7c34a3a54 !1248 回退 'Pull Request !1234 : 【BCM整改】去除Nllloss的过适配'
Merge pull request !1248 from weili10/revert-merge-1234-master
2022-09-16 02:51:23 +00:00
weili10 85049f1213 回退 'Pull Request !1234 : 【BCM整改】去除Nllloss的过适配' 2022-09-16 02:38:51 +00:00
i-robot 52c1f397ce !1240 index算子IR变更
Merge pull request !1240 from 王晓/index_new_3
2022-09-15 12:09:52 +00:00
hxf12345677 5acdefec48 【1.8.1算子适配】适配层添加 padv3 aicpu算子支持 2022-09-15 18:41:37 +08:00
hxf12345677 968376f803 avgpool2d 算子支持aicpu适配层修改 2022-09-15 18:37:49 +08:00
gd8426 570229f047 Exp2适配 2022-09-15 13:52:22 +08:00
i-robot b1cd14c745 !1243 Bugfix: Fix bug in test_memcpy.py
Merge pull request !1243 from 刘嘉巍/dev-bert
2022-09-14 09:16:48 +00:00
tianyumi 60dbac7071 index adapt to new Index IR 2022-09-13 16:21:55 +08:00
tianyumi a6055fcbae randperm adapt to StatelessRandperm to support seed 2022-09-13 15:32:10 +08:00
闫鹏全 14a496d500 精度对比工具文档完善 2022-09-13 10:06:59 +08:00
855 changed files with 45465 additions and 20641 deletions
+63 -33
View File
@@ -1,13 +1,7 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
project(TORCHNPU CXX C)
option(USE_GRAPH_MODE "enable graph mode" OFF)
if(USE_GRAPH_MODE)
add_definitions(-DUSE_GRAPH_MODE=1)
endif()
set(LINUX TRUE)
set(CMAKE_INSTALL_MESSAGE NEVER)
# set(CMAKE_VERBOSE_MAKEFILE ON)
@@ -84,6 +78,7 @@ endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=pedantic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=redundant-decls")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=old-style-cast")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__FILENAME__='\"$(notdir $(abspath $<))\"'")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
# These flags are not available in GCC-4.8.5. Set only when using clang.
@@ -140,16 +135,26 @@ else()
set(CXXFLAGS "-fstack-protector-all -Wl,-z,relro,-z,now,-s,-z,noexecstack -fPIE -pie ${CXXFLAGS}")
endif()
if (DEFINED BUILD_LIBTORCH)
add_compile_definitions(BUILD_LIBTORCH)
endif()
include_directories(${PROJECT_SOURCE_DIR})
include_directories(${PROJECT_SOURCE_DIR}/torch_npu/csrc/aten)
include_directories(${PROJECT_SOURCE_DIR}/third_party/hccl/inc)
include_directories(${PROJECT_SOURCE_DIR}/third_party/acl/inc)
if (NOT DEFINED BUILD_LIBTORCH)
include_directories(${PROJECT_SOURCE_DIR}/patch/include)
include_directories(${PROJECT_SOURCE_DIR}/patch/include/torch/csrc/distributed)
endif()
# Set installed PyTorch dir
if(DEFINED PYTORCH_INSTALL_DIR)
include_directories(${PYTORCH_INSTALL_DIR}/include)
include_directories(${PYTORCH_INSTALL_DIR}/include/torch/csrc/api/include/)
include_directories(${PYTORCH_INSTALL_DIR}/include/torch/csrc/api/include)
else()
message(FATAL_ERROR, "Cannot find installed PyTorch directory")
endif()
@@ -164,23 +169,33 @@ endif()
# sources
set(ATEN_SRCS)
set(CORE_SRCS)
set(DIST_SRCS)
set(FRAMEWORK_SRCS)
set(NPU_SRCS)
set(PROF_SRCS)
set(UTILS_SRCS)
if (NOT DEFINED BUILD_LIBTORCH)
set(DIST_SRCS)
set(NPU_SRCS)
set(PROF_SRCS)
set(UTILS_SRCS)
endif()
add_subdirectory(${TORCHNPU_ROOT}/aten)
add_subdirectory(${TORCHNPU_ROOT}/core)
add_subdirectory(${TORCHNPU_ROOT}/distributed)
add_subdirectory(${TORCHNPU_ROOT}/framework)
add_subdirectory(${TORCHNPU_ROOT}/npu)
add_subdirectory(${TORCHNPU_ROOT}/profiler)
add_subdirectory(${TORCHNPU_ROOT}/utils)
if (NOT DEFINED BUILD_LIBTORCH)
add_subdirectory(${TORCHNPU_ROOT}/distributed)
add_subdirectory(${TORCHNPU_ROOT}/npu)
add_subdirectory(${TORCHNPU_ROOT}/profiler)
add_subdirectory(${TORCHNPU_ROOT}/utils)
endif()
if (DEFINED BUILD_LIBTORCH)
set(CPP_SRCS ${ATEN_SRCS} ${CORE_SRCS} ${FRAMEWORK_SRCS})
else()
# Compile code with pybind11
set(CPP_SRCS ${ATEN_SRCS} ${CORE_SRCS} ${DIST_SRCS} ${FRAMEWORK_SRCS} ${NPU_SRCS} ${PROF_SRCS} ${UTILS_SRCS})
set(CPP_SRCS ${ATEN_SRCS} ${CORE_SRCS} ${DIST_SRCS} ${FRAMEWORK_SRCS} ${NPU_SRCS} ${PROF_SRCS} ${UTILS_SRCS})
endif()
add_library(${PLUGIN_NAME} SHARED ${CPP_SRCS})
@@ -188,27 +203,42 @@ link_directories(${PYTORCH_INSTALL_DIR}/lib)
link_directories(${TORCHNPU_THIRD_PARTY_ROOT}/acl/libs)
target_link_libraries(${PLUGIN_NAME} PUBLIC ${TORCHNPU_THIRD_PARTY_ROOT}/acl/libs/libhccl.so)
target_link_libraries(${PLUGIN_NAME} PUBLIC ${PYTORCH_INSTALL_DIR}/lib/libtorch_python.so)
if (NOT DEFINED BUILD_LIBTORCH)
target_link_libraries(${PLUGIN_NAME} PUBLIC ${PYTORCH_INSTALL_DIR}/lib/libtorch_python.so)
endif()
target_link_libraries(${PLUGIN_NAME} PUBLIC ${TORCHNPU_THIRD_PARTY_ROOT}/acl/libs/libascendcl.so)
target_link_libraries(${PLUGIN_NAME} PUBLIC ${TORCHNPU_THIRD_PARTY_ROOT}/acl/libs/libacl_op_compiler.so)
target_link_libraries(${PLUGIN_NAME} PUBLIC ${TORCHNPU_THIRD_PARTY_ROOT}/acl/libs/libge_runner.so)
target_link_libraries(${PLUGIN_NAME} PUBLIC ${TORCHNPU_THIRD_PARTY_ROOT}/acl/libs/libgraph.so)
target_link_libraries(${PLUGIN_NAME} PUBLIC ${TORCHNPU_THIRD_PARTY_ROOT}/acl/libs/libacl_tdt_channel.so)
target_link_libraries(${PLUGIN_NAME} PUBLIC torch torch_cpu c10 python3.7m)
set(ATEN_THREADING "OMP" CACHE STRING "ATen parallel backend")
message(STATUS "Using ATen parallel backend: ${ATEN_THREADING}")
if ("${ATEN_THREADING}" STREQUAL "OMP")
target_compile_definitions(${PLUGIN_NAME} PUBLIC "-DAT_PARALLEL_OPENMP=1")
elseif ("${ATEN_THREADING}" STREQUAL "NATIVE")
target_compile_definitions(${PLUGIN_NAME} PUBLIC "-DAT_PARALLEL_NATIVE=1")
elseif ("${ATEN_THREADING}" STREQUAL "TBB")
target_compile_definitions(${PLUGIN_NAME} PUBLIC "-DAT_PARALLEL_NATIVE_TBB=1")
if (DEFINED BUILD_LIBTORCH)
target_link_libraries(${PLUGIN_NAME} PUBLIC torch torch_cpu c10)
else()
message(FATAL_ERROR "Unknown ATen parallel backend: ${ATEN_THREADING}")
target_link_libraries(${PLUGIN_NAME} PUBLIC torch torch_cpu c10 python3.7m)
endif()
include(GNUInstallDirs)
target_compile_options(${PLUGIN_NAME} PRIVATE "-DC10_BUILD_MAIN_LIB")
install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(DEFINED ENV{BSCPP_OPS_ENABLE})
message(STATUS "env BSCPP_OPS_ENABLE exists")
target_link_libraries(${PLUGIN_NAME} PUBLIC bscpp_ops)
endif()
if (NOT DEFINED BUILD_LIBTORCH)
set(ATEN_THREADING "OMP" CACHE STRING "ATen parallel backend")
message(STATUS "Using ATen parallel backend: ${ATEN_THREADING}")
if ("${ATEN_THREADING}" STREQUAL "OMP")
target_compile_definitions(${PLUGIN_NAME} PUBLIC "-DAT_PARALLEL_OPENMP=1")
elseif ("${ATEN_THREADING}" STREQUAL "NATIVE")
target_compile_definitions(${PLUGIN_NAME} PUBLIC "-DAT_PARALLEL_NATIVE=1")
elseif ("${ATEN_THREADING}" STREQUAL "TBB")
target_compile_definitions(${PLUGIN_NAME} PUBLIC "-DAT_PARALLEL_NATIVE_TBB=1")
else()
message(FATAL_ERROR "Unknown ATen parallel backend: ${ATEN_THREADING}")
endif()
include(GNUInstallDirs)
target_compile_options(${PLUGIN_NAME} PRIVATE "-DC10_BUILD_MAIN_LIB")
install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
+12 -3
View File
@@ -1,12 +1,11 @@
approvers:
- blian
- nalinaly
- weili10
- you-ansheng
reviewers:
- shibo19
- Ronnie_zheng
- xiaxia3
- li_chao10
- petissue
- td__lihan
- ascendzyj
@@ -20,4 +19,14 @@ reviewers:
- fairwarning
- you-ansheng
- yinzijun
- weili10
- weili10
- granpad7
- clinglai
- shaoyf
- yanpengquan07
- xiong05
- liu-jiaweikf
- xiepeng20
- brightlyking
- chenhao_1209
- wbigat
+26 -21
View File
@@ -14,13 +14,13 @@ This project develops the PyTorch Adapter plugin to adapt Ascend to the PyTorch
yum install -y patch zlib-devel libffi-devel openssl-devel libjpeg-turbo-devel gcc-c++ sqlite-devel dos2unix openblas git dos2unix
yum install -y gcc==7.3.0 cmake==3.12.0
yum install -y gcc==7.5.0 cmake==3.12.0
## Ubuntu
apt-get install -y patch g++ make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev m4 dos2unix libopenblas-dev git dos2unix
apt-get install -y gcc==7.3.0 cmake==3.12.0
apt-get install -y gcc==7.5.0 cmake==3.12.0
>![](figures/icon-note.gif) **NOTE:**
>If an error occurs during the installation of the GCC and CMake dependency commands, use the source code for installation. For details, see the FAQ.
@@ -52,7 +52,7 @@ Install the official torch package, and then compile and install the plugin.
```sh
#x86_64
pip3 install torch==1.8.1+cpu # If an error is reported when you run the pip command to install PyTorch of the CPU version, manually download the .whl package from https://download.pytorch.org/whl/torch.
pip3 install torch==1.11.0+cpu # If an error is reported when you run the pip command to install PyTorch of the CPU version, manually download the .whl package from https://download.pytorch.org/whl/torch.
#AArch64
#The community does not provide the CPU installation package of the ARM architecture. For details, see the first FAQ to compile and install PyTorch using the source code.
@@ -62,7 +62,7 @@ Compile and generate the binary installation package of the PyTorch plugin.
Download code of the corresponding branch and go to the root directory of the plugin.
```
#
git clone -b v1.8.1-3.0.rc2 https://gitee.com/ascend/pytorch.git
git clone -b master https://gitee.com/ascend/pytorch.git
cd pytorch
# Specify the Python version packaging mode:
bash ci/build.sh --python=3.7
@@ -75,11 +75,11 @@ bash ci/build.sh --python=3.9
Install the **torch_npu** package generated in the **pytorch/dist** directory. *{arch}* indicates the architecture name.
```
pip3 install --upgrade dist/torch_npu-1.8.1rc2-cp37-cp37m-linux_{arch}.whl
pip3 install --upgrade dist/torch_npu-1.11.0-cp37-cp37m-linux_{arch}.whl
```
Download TorchVision.
```
pip3 install torchvision==0.9.1
pip3 install torchvision==0.12.0
```
@@ -137,7 +137,7 @@ python3 test_div.py
# (Optional) Installing the Mixed Precision Module
AscendPyTorch 1.8.1 integrates the AMP module and can be used for training with mixed precision. The differences between the AMP module and the Apex module are as follows. You can select a desired module. For details about how to compile and install the Apex module, see the related [**README.en**](https://gitee.com/ascend/apex) file.
AscendPyTorch 1.11.0 integrates the AMP module and can be used for training with mixed precision. The differences between the AMP module and the Apex module are as follows. You can select a desired module. For details about how to compile and install the Apex module, see the related [**README.en**](https://gitee.com/ascend/apex) file.
- AMP
- Dynamic loss scale: The loss scale value is dynamically calculated to determine whether overflow occurs.
@@ -184,23 +184,23 @@ The version branches of AscendPyTorch have the following maintenance phases:
| **v3.0.rc2** | Maintained | 2022-07-15 | Unmaintained <br> 2023-07-15 estimated |
# FAQs
## When the CPU architecture is ARM, PyTorch 1.8.1 cannot be installed using the PIP3 command because the community does not provide the torch package for the ARM CPU architecture. In this case, use the source code to compile and install PyTorch 1.8.1.
## When the CPU architecture is ARM, PyTorch 1.11.0 cannot be installed using the PIP3 command because the community does not provide the torch package for the ARM CPU architecture. In this case, use the source code to compile and install PyTorch 1.11.0.
Download the PyTorch 1.8.1 source package.
Download the PyTorch 1.11.0 source package.
```
git clone -b v1.8.1 https://github.com/pytorch/pytorch.git --depth=1 pytorch_v1.8.1
git clone -b v1.11.0 https://github.com/pytorch/pytorch.git --depth=1 pytorch_v1.11.0
```
Access the source package to obtain the passive dependency code.
```
cd pytorch_v1.8.1
cd pytorch_v1.11.0
git submodule sync
git submodule update --init --recursive
```
Compile and install PyTorch 1.8.1.
Compile and install PyTorch 1.11.0.
```
python3 setup.py install
@@ -316,7 +316,7 @@ When downloading GCC from some sources, you may be prompted by an error message
Perform the following steps as the **root** user.
1. Download **gcc-7.3.0.tar.gz** from [https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz](https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz).
1. Download **gcc-7.5.0.tar.gz** from [https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-7.5.0/gcc-7.5.0.tar.gz](https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-7.5.0/gcc-7.5.0.tar.gz).
2. GCC installation requires adequate temporary space. Run the following command to clear the **/tmp** directory in advance:
@@ -340,20 +340,20 @@ Perform the following steps as the **root** user.
4. Compile and install GCC.
1. Go to the directory where the source package **gcc-7.3.0.tar.gz** is located and run the following command to decompress it:
1. Go to the directory where the source package **gcc-7.5.0.tar.gz** is located and run the following command to decompress it:
```
tar -zxvf gcc-7.3.0.tar.gz
tar -zxvf gcc-7.5.0.tar.gz
```
2. Go to the extracted directory and download the GCC dependency packages:
```
cd gcc-7.3.0
cd gcc-7.5.0
./contrib/download_prerequisites
```
If an error is reported during the command execution, run the following commands in the **gcc-7.3.0/** directory to download the dependency packages:
If an error is reported during the command execution, run the following commands in the **gcc-7.5.0/** directory to download the dependency packages:
```
wget http://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2
@@ -373,13 +373,13 @@ Perform the following steps as the **root** user.
3. <a name="zh-cn_topic_0000001135347812_zh-cn_topic_0000001173199577_zh-cn_topic_0000001172534867_zh-cn_topic_0276688294_li1649343041310"></a>Run the configuration, compilation, and installation commands.
```
./configure --enable-languages=c,c++ --disable-multilib --with-system-zlib --prefix=/usr/local/linux_gcc7.3.0
./configure --enable-languages=c,c++ --disable-multilib --with-system-zlib --prefix=/usr/local/linux_gcc7.5.0
make -j15 # Check the number of CPUs by running **grep -w processor /proc/cpuinfo|wc -l**. In this example, the number is 15. You can set the parameters as required.
make install
```
>![](https://gitee.com/ascend/pytorch/raw/v1.8.1-3.0.rc2/docs/en/PyTorch%20Network%20Model%20Porting%20and%20Training%20Guide/public_sys-resources/icon-notice.gif) **NOTICE:**
>The **--prefix** option is used to specify the **linux\_gcc7.3.0** installation path, which is configurable. Do not set it to **/usr/local** or **/usr,** which is the default installation path for the GCC installed by using the software source. Otherwise, a conflict occurs and the original GCC compilation environment of the system is damaged. In this example, the installation path is set to **/usr/local/linux\_gcc7.3.0**.
>The **--prefix** option is used to specify the **linux\_gcc7.5.0** installation path, which is configurable. Do not set it to **/usr/local** or **/usr,** which is the default installation path for the GCC installed by using the software source. Otherwise, a conflict occurs and the original GCC compilation environment of the system is damaged. In this example, the installation path is set to **/usr/local/linux\_gcc7.5.0**.
4. Change the soft links.
```
@@ -398,14 +398,14 @@ Perform the following steps as the **root** user.
export LD_LIBRARY_PATH=${install_path}/lib64:${LD_LIBRARY_PATH}
```
**${install_path}** indicates the GCC 7.3.0 installation path configured in [3](#zh-cn_topic_0000001135347812_zh-cn_topic_0000001173199577_zh-cn_topic_0000001172534867_zh-cn_topic_0276688294_li1649343041310). In this example, the GCC 7.3.0 installation path is **/usr/local/gcc7.3.0/**.
**${install_path}** indicates the GCC 7.5.0 installation path configured in [3](#zh-cn_topic_0000001135347812_zh-cn_topic_0000001173199577_zh-cn_topic_0000001172534867_zh-cn_topic_0276688294_li1649343041310). In this example, the GCC 7.5.0 installation path is **/usr/local/gcc7.5.0/**.
>![](figures/icon-note.gif) **NOTE:**
>Skip this step if you do not need to use the compilation environment with GCC upgraded.
If the PyTorch compilation fails, check whether the soft link library is correct.
libstdc++->libstdc++.so.6.0.24(7.3.0)
libstdc++->libstdc++.so.6.0.24(7.5.0)
## libblas.so cannot be found.
@@ -488,6 +488,11 @@ To verify the torch_npu reference, switch to another directory. If you perform t
<img src="figures/FAQ torch_npu.png" style="zoom:150%;" />
## Multi card training is stuck in initialization stage until timeout
IPv6 address is used in the "init_process_group" function of multi card communication, for example ::1 (Note that the localhost may point to the IPv6 address)
Use IPv4 to avoid this problem
# Version Description
For details, see [Release Notes](https://gitee.com/ascend/pytorch/tree/master/docs/en/RELEASENOTE).
+101 -39
View File
@@ -14,13 +14,13 @@
yum install -y patch zlib-devel libffi-devel openssl-devel libjpeg-turbo-devel gcc-c++ sqlite-devel dos2unix openblas git dos2unix
yum install -y gcc==7.3.0 cmake==3.12.0
yum install -y gcc==7.5.0 cmake==3.12.0
## Ubuntu
apt-get install -y patch g++ make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev m4 dos2unix libopenblas-dev git dos2unix
apt-get install -y gcc==7.3.0 cmake==3.12.0
apt-get install -y gcc==7.5.0 cmake==3.12.0
@@ -30,19 +30,25 @@ apt-get install -y gcc==7.3.0 cmake==3.12.0
# Ascend配套软件
| AscendPyTorch版本 | CANN版本 | 支持PyTorch版本 | Gitee分支名称 |
| :------------ | :----------- | :----------- | ------------- |
| 2.0.2 | CANN 5.0.2 | 1.5.0.post2 | 2.0.2.tr5 |
| 2.0.3 | CANN 5.0.3 | 1.5.0.post3 | 2.0.3.tr5 |
| 2.0.4 | CANN 5.0.4 | 1.5.0.post4 | 2.0.4.tr5 |
| 3.0.rc1 | CANN 5.1.RC1 | 1.5.0.post5 | v1.5.0-3.0.rc1 |
| 3.0.rc1 | CANN 5.1.RC1 | 1.8.1.rc1 | v1.8.1-3.0.rc1 |
| 3.0.rc2 | CANN 5.1.RC2 | 1.5.0.post6 | v1.5.0-3.0.rc2 |
| 3.0.rc2 | CANN 5.1.RC2 | 1.8.1.rc2 | v1.8.1-3.0.rc2 |
| AscendPyTorch版本 | CANN版本 | 支持PyTorch版本 | Gitee分支名称 | AscendHub镜像版本 |
| :------------ | :----------- | :----------- | ------------- | ------------- |
| 2.0.2 | CANN 5.0.2 | 1.5.0.post2 | 2.0.2.tr5 | 21.0.2 |
| 2.0.3 | CANN 5.0.3 | 1.5.0.post3 | 2.0.3.tr5 | 21.0.3 |
| 2.0.4 | CANN 5.0.4 | 1.5.0.post4 | 2.0.4.tr5 | 21.0.4 |
| 3.0.rc1 | CANN 5.1.RC1 | 1.5.0.post5 | v1.5.0-3.0.rc1 | 22.0.RC1 |
| 3.0.rc1 | CANN 5.1.RC1 | 1.8.1.rc1 | v1.8.1-3.0.rc1 | \ |
| 3.0.rc2 | CANN 5.1.RC2 | 1.5.0.post6 | v1.5.0-3.0.rc2 | 22.0.RC2 |
| 3.0.rc2 | CANN 5.1.RC2 | 1.8.1.rc2 | v1.8.1-3.0.rc2 | 22.0.RC2-1.8.1 |
| 3.0.rc3 | CANN 6.0.RC1 | 1.5.0.post7 | v1.5.0-3.0.rc3 | \ |
| 3.0.rc3 | CANN 6.0.RC1 | 1.8.1.rc3 | v1.8.1-3.0.rc3 | 22.0.RC3-1.8.1 |
| 3.0.rc3 | CANN 6.0.RC1 | 1.11.0.rc1(beta) | v1.11.0-3.0.rc3 | \ |
| 3.0.0 | CANN 6.0.1 | 1.5.0.post8 | v1.5.0-3.0.0 | \ |
| 3.0.0 | CANN 6.0.1 | 1.8.1 | v1.8.1-3.0.0 | \ |
| 3.0.0 | CANN 6.0.1 | 1.11.0.rc2(beta) | v1.11.0-3.0.0 | \ |
# 安装方式
## 安装Pytorch依赖环境
## 安装PyTorch依赖环境
如果使用非root用户安装,用户需要在本步骤的每句命令后加**--user**,示例如:pip3 install pyyaml --user。
@@ -57,10 +63,14 @@ pip3 install wheel
```sh
#x86_64
pip3 install torch==1.8.1+cpu #若使用pip命令安装cpu版本PyTorch报错,请手动下载whl包安装,下载地址:(https://download.pytorch.org/whl/torch)
pip3 install torch==1.11.0+cpu #若使用pip命令安装cpu版本PyTorch报错,请手动下载whl包安装,下载地址:(https://download.pytorch.org/whl/torch)
#aarch64
#社区未提供arm架构cpu安装包,请参见FAQ第一条,使用源码编译安装pytorch
#aarch64(推荐使用镜像)
1.可在docker中使用AscendHub镜像仓库提供的基于PyTorch版本制作的基础镜像,包含训练、转换和推理等功能。
#镜像仓库地址:(https://ascendhub.huawei.com/#/detail/pytorch-modelzoo)
2.鲲鹏arm服务器可在鲲鹏开源软件文件共享中心获取编译好的PyTorch二进制安装包。
#鲲鹏文件共享中心地址:(https://mirrors.huaweicloud.com/kunpeng/archive/Ascend/PyTorch/)
3.社区未提供的arm架构cpu安装包,可参见FAQ第一条,使用源码编译安装pytorch。
```
编译生成pytorch插件的二进制安装包。
@@ -80,12 +90,12 @@ bash ci/build.sh --python=3.9
然后安装pytorch/dist下生成的插件torch_npu包,{arch}为架构名称。
```
pip3 install --upgrade dist/torch_npu-1.8.1rc2-cp37-cp37m-linux_{arch}.whl
pip3 install --upgrade dist/torch_npu-1.11.0-cp37-cp37m-linux_{arch}.whl
```
下载torchvision。
```
pip3 install torchvision==0.9.1
pip3 install torchvision==0.12.0
```
# 运行
@@ -141,7 +151,7 @@ python3 test_div.py
# 安装混合精度模块(可选)
AscendPyTorch1.8.1集成了AMP模块,也可用于混合精度训练等应用场景,与Apex模块的区别如下,请用户根据功能需要选择使用,若需安装Apex模块请参考相关[README文档](https://gitee.com/ascend/apex)进行编译安装Apex模块。
AscendPyTorch1.11.0集成了AMP模块,也可用于混合精度训练等应用场景,与Apex模块的区别如下,请用户根据功能需要选择使用,若需安装Apex模块请参考相关[README文档](https://gitee.com/ascend/apex)进行编译安装Apex模块。
- AMP
- 动态loss scale:动态计算loss scale的值并判断是否溢出。
@@ -181,30 +191,38 @@ Ascend PyTorch的版本分支有以下几种维护阶段:
| **分支名** | **当前状态** | **上线时间** | **后续状态** | **EOL 日期**|
|------------|--------------|----------------------|----------------------------------------|------------|
| **v2.0.2** | Maintained | 2021-07-29 | Unmaintained <br> 2022-07-29 estimated | |
| **v2.0.3** | Maintained | 2021-10-15 | Unmaintained <br> 2022-10-15 estimated | |
| **v2.0.4** | Maintained | 2022-01-15 | Unmaintained <br> 2023-01-15 estimated | |
| **v2.0.2** | EOL | 2021-07-29 | N/A | |
| **v2.0.3** | EOL | 2021-10-15 | N/A | |
| **v2.0.4** | Unmaintained | 2022-01-15 | EOL <br> 2023-04-15 estimated | |
| **v3.0.rc1** | Maintained | 2022-04-10 | Unmaintained <br> 2023-04-10 estimated | |
| **v3.0.rc2** | Maintained | 2022-07-15 | Unmaintained <br> 2023-07-15 estimated | |
| **v3.0.rc3** | Maintained | 2022-10-20 | Unmaintained <br> 2023-10-20 estimated | |
| **v3.0.0** | Maintained | 2023-1-18 | Unmaintained <br> 2024-1-18 estimated | |
# FAQ
## CPU架构为ARM架构时,由于社区未提供ARM架构CPU版本的torch包,无法使用PIP3命令安装PyTorch1.8.1,需要使用源码编译安装。
## CPU架构为ARM架构时,由于社区未提供ARM架构CPU版本的torch包,无法使用PIP3命令安装PyTorch,需要使用源码编译安装。
下载PyTorch v1.8.1源码包。
下载PyTorch v1.11.0源码包。
```
git clone -b v1.8.1 https://github.com/pytorch/pytorch.git --depth=1 pytorch_v1.8.1
git clone -b v1.11.0 https://github.com/pytorch/pytorch.git --depth=1 pytorch_v1.11.0
```
进入源码包获取被动依赖代码。
```
cd pytorch_v1.8.1
cd pytorch_v1.11.0
git submodule sync
git submodule update --init --recursive
```
配置环境变量
```
export USE_XNNPACK=0
```
执行编译安装。
```
@@ -324,7 +342,7 @@ pip3 install --upgrade te-0.4.0-py3-none-any.whl
以下步骤请在root用户下执行。
1. 下载gcc-7.3.0.tar.gz,下载地址为[https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz](https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz)。
1. 下载gcc-7.5.0.tar.gz,下载地址为[https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-7.5.0/gcc-7.5.0.tar.gz](https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-7.5.0/gcc-7.5.0.tar.gz)。
2. 安装gcc时候会占用大量临时空间,所以先执行下面的命令清空/tmp目录:
@@ -348,20 +366,20 @@ pip3 install --upgrade te-0.4.0-py3-none-any.whl
4. 编译安装gcc。
1. 进入gcc-7.3.0.tar.gz源码包所在目录,解压源码包,命令为:
1. 进入gcc-7.5.0.tar.gz源码包所在目录,解压源码包,命令为:
```
tar -zxvf gcc-7.3.0.tar.gz
tar -zxvf gcc-7.5.0.tar.gz
```
2. 进入解压后的文件夹,执行如下命令下载gcc依赖包:
```
cd gcc-7.3.0
cd gcc-7.5.0
./contrib/download_prerequisites
```
如果执行上述命令报错,需要执行如下命令在“gcc-7.3.0/“文件夹下下载依赖包:
如果执行上述命令报错,需要执行如下命令在“gcc-7.5.0/“文件夹下下载依赖包:
```
wget http://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2
@@ -381,20 +399,20 @@ pip3 install --upgrade te-0.4.0-py3-none-any.whl
3. <a name="zh-cn_topic_0000001135347812_zh-cn_topic_0000001173199577_zh-cn_topic_0000001172534867_zh-cn_topic_0276688294_li1649343041310"></a>执行配置、编译和安装命令:
```
./configure --enable-languages=c,c++ --disable-multilib --with-system-zlib --prefix=/usr/local/linux_gcc7.3.0
./configure --enable-languages=c,c++ --disable-multilib --with-system-zlib --prefix=/usr/local/linux_gcc7.5.0
make -j15 # 通过grep -w processor /proc/cpuinfo|wc -l查看cpu数,示例为15,用户可自行设置相应参数。
make install
```
>![](figures/icon-notice.gif) **须知:**
>其中“--prefix“参数用于指定linux\_gcc7.3.0安装路径,用户可自行配置,但注意不要配置为“/usr/local“及“/usr“,因为会与系统使用软件源默认安装的gcc相冲突,导致系统原始gcc编译环境被破坏。示例指定为“/usr/local/linux\_gcc7.3.0“。
>其中“--prefix“参数用于指定linux\_gcc7.5.0安装路径,用户可自行配置,但注意不要配置为“/usr/local“及“/usr“,因为会与系统使用软件源默认安装的gcc相冲突,导致系统原始gcc编译环境被破坏。示例指定为“/usr/local/linux\_gcc7.5.0“。
4. 修改软连接。
```
ln -s ${install_path}/gcc-7.3.0/bin/gcc /usr/bin/gcc
ln -s ${install_path}/gcc-7.3.0/bin/g++ /usr/bin/g++
ln -s ${install_path}/gcc-7.3.0/bin/c++ /usr/bin/c++
ln -s ${install_path}/gcc-7.5.0/bin/gcc /usr/bin/gcc
ln -s ${install_path}/gcc-7.5.0/bin/g++ /usr/bin/g++
ln -s ${install_path}/gcc-7.5.0/bin/c++ /usr/bin/c++
```
5.配置环境变量。
@@ -405,7 +423,7 @@ pip3 install --upgrade te-0.4.0-py3-none-any.whl
export LD_LIBRARY_PATH=${install_path}/lib64:${LD_LIBRARY_PATH}
```
其中$\{install\_path\}为[3.](#zh-cn_topic_0000001135347812_zh-cn_topic_0000001173199577_zh-cn_topic_0000001172534867_zh-cn_topic_0276688294_li1649343041310)中配置的gcc7.3.0安装路径,本示例为“/usr/local/gcc7.3.0/“。
其中$\{install\_path\}为[3.](#zh-cn_topic_0000001135347812_zh-cn_topic_0000001173199577_zh-cn_topic_0000001172534867_zh-cn_topic_0276688294_li1649343041310)中配置的gcc7.5.0安装路径,本示例为“/usr/local/gcc7.5.0/“。
>![](figures/icon-note.gif) **说明:**
>本步骤为用户在需要用到gcc升级后的编译环境时才配置环境变量。
@@ -413,7 +431,7 @@ pip3 install --upgrade te-0.4.0-py3-none-any.whl
若存在pytorch编译不过,请检查软连接的库是否正确。
libstdc++->libstdc++.so.6.0.24(7.3.0)
libstdc++->libstdc++.so.6.0.24(7.5.0)
## 找不到libblas.so问题
@@ -485,7 +503,7 @@ warning如下图所示,由Tensor.set_data浅拷贝操作触发。主要原因
该warning不影响模型的精度和性能,可以忽略。
待NPU 设备号合入社区或者后续Pytorch版本`_has_compatible_shallow_copy_type`注册方式发生变动,该warning会被解决。
待NPU 设备号合入社区或者后续PyTorch版本`_has_compatible_shallow_copy_type`注册方式发生变动,该warning会被解决。
![输入图片说明](https://images.gitee.com/uploads/images/2022/0701/153621_2b5080c4_7902902.png)
@@ -493,9 +511,53 @@ warning如下图所示,由Tensor.set_data浅拷贝操作触发。主要原因
验证torch_npu的引入,请切换至其他目录进行,在编译目录执行会提示如下错误。
<img src="figures/FAQ torch_npu.png" style="zoom:150%;" />
## 在执行import torch_npu时出现ModuleNotFooundError: NO module named '_lzma'报错问题
在python命令行下,执行import torch_npu测试时,出现ModuleNotFooundError: NO module named '_lzma'问题,可能由于Python环境失效,重装Python即可。<img src="figures/QA.png" />
## 编译过程中出现XNNPACK相关的Make Error报错
编译原生pytorch时,未配置相关环境变量,导致编译不成功。
![](figures/QA1.png)
1. 执行命令设置环境变量
```
export USE_XNNPACK=0
```
2. 执行命令清除当前编译内容
```
make clean
```
3. 重新编译
## 编译时出现Breakpad error: field 'regs' has incomplete type 'google_breakpad::user_regs_struct'报错
编译原生pytorch时,未配置相关环境变量,导致编译不成功。
1. 执行命令配置环境变量
```
export BUILD_BREAKPAD=0
```
2. 执行命令清除当前编译内容
```
make clean
```
3. 重新编译
## 多卡训练初始化阶段卡顿至超时
init_process_group 函数中使用了IPV6地址,例如::1(注意localhost 可能指向IPv6的地址),使用IPv4可以避免这个问题
# 版本说明
版本说明请参阅[ReleseNote](docs/zh/RELEASENOTE)
+225
View File
@@ -0,0 +1,225 @@
# Copyright (c) 2020 Huawei Technologies Co., Ltd
# All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://opensource.org/licenses/BSD-3-Clause
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import multiprocessing
import glob
import os
import re
import shutil
import subprocess
import sys
import traceback
import platform
from sysconfig import get_paths
from distutils.version import LooseVersion
from distutils import file_util
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
def which(thefile):
path = os.environ.get("PATH", os.defpath).split(os.pathsep)
for d in path:
fname = os.path.join(d, thefile)
fnames = [fname]
if sys.platform == 'win32':
exts = os.environ.get('PATHEXT', '').split(os.pathsep)
fnames += [fname + ext for ext in exts]
for name in fnames:
if os.access(name, os.F_OK | os.X_OK) and not os.path.isdir(name):
return name
return None
def get_cmake_command():
def _get_version(cmd):
for line in subprocess.check_output([cmd, '--version']).decode('utf-8').split('\n'):
if 'version' in line:
return LooseVersion(line.strip().split(' ')[2])
raise RuntimeError('no version found')
"Returns cmake command."
cmake_command = 'cmake'
if platform.system() == 'Windows':
return cmake_command
cmake3 = which('cmake3')
cmake = which('cmake')
if cmake3 is not None and _get_version(cmake3) >= LooseVersion("3.12.0"):
cmake_command = 'cmake3'
return cmake_command
elif cmake is not None and _get_version(cmake) >= LooseVersion("3.12.0"):
return cmake_command
else:
raise RuntimeError('no cmake or cmake3 with version >= 3.12.0 found')
def get_build_type():
build_type = 'Release'
if os.getenv('DEBUG', default='0').upper() in ['ON', '1', 'YES', 'TRUE', 'Y']:
build_type = 'Debug'
if os.getenv('REL_WITH_DEB_INFO', default='0').upper() in ['ON', '1', 'YES', 'TRUE', 'Y']:
build_type = 'RelWithDebInfo'
return build_type
def get_pytorch_dir():
try:
import torch
return os.path.dirname(os.path.abspath(torch.__file__))
except Exception:
_, _, exc_traceback = sys.exc_info()
frame_summary = traceback.extract_tb(exc_traceback)[-1]
return os.path.dirname(frame_summary.filename)
def generate_bindings_code(base_dir, verbose):
generate_code_cmd = ["bash", os.path.join(base_dir, 'generate_code.sh'), verbose]
if subprocess.call(generate_code_cmd) != 0:
print(
'Failed to generate ATEN bindings: {}'.format(generate_code_cmd),
file=sys.stderr)
sys.exit(1)
def build_stub(base_dir):
build_stub_cmd = ["sh", os.path.join(base_dir, 'third_party/acl/libs/build_stub.sh')]
if subprocess.call(build_stub_cmd) != 0:
print(
'Failed to build stub: {}'.format(build_stub_cmd),
file=sys.stderr)
sys.exit(1)
def clean_generated_files():
f_ignore = open(os.path.join(BASE_DIR, '.gitignore'), 'r')
ignores = f_ignore.read()
pat = re.compile(r'^#( BEGIN NOT-CLEAN-FILES )?')
for wildcard in filter(None, ignores.split('\n')):
match = pat.match(wildcard)
if match:
if match.group(1):
# Marker is found and stop reading .gitignore.
break
# Ignore lines which begin with '#'.
else:
for filename in glob.glob(wildcard):
shutil.rmtree(filename, ignore_errors=True)
f_ignore.close()
clean_files = ['torch_npu/csrc/aten/RegisterCPU.cpp', 'torch_npu/csrc/aten/RegisterNPU.cpp',
'torch_npu/csrc/aten/RegisterAutogradNPU.cpp', 'torch_npu/csrc/aten/NpuNativeFunctions.h']
for file in clean_files:
if os.path.exists(os.path.join(BASE_DIR, file)):
os.remove(os.path.join(BASE_DIR, file))
if os.path.exists(os.path.join(BASE_DIR, "libtorch")):
shutil.rmtree(os.path.join(BASE_DIR, "libtorch"))
def run_cmake():
cmake = get_cmake_command()
if cmake is None:
raise RuntimeError(
"CMake must be installed to build the following extensions: ")
build_dir = os.path.join(BASE_DIR, "build")
build_type_dir = os.path.join(build_dir, get_build_type())
output_lib_path = os.path.join(build_type_dir, "packages/torch_npu/lib")
os.makedirs(build_type_dir, exist_ok=True)
os.makedirs(output_lib_path, exist_ok=True)
cmake_args = [
'-DCMAKE_BUILD_TYPE=' + get_build_type(),
'-DCMAKE_INSTALL_PREFIX=' + os.path.abspath(output_lib_path),
'-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + os.path.abspath(output_lib_path),
'-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=' + os.path.abspath(output_lib_path),
'-DTORCHNPU_INSTALL_LIBDIR=' + os.path.abspath(output_lib_path),
'-DPYTHON_INCLUDE_DIR=' + get_paths()['include'],
'-DPYTORCH_INSTALL_DIR=' + get_pytorch_dir(),
'-DBUILD_LIBTORCH=' + "ON"]
build_args = ['-j', str(multiprocessing.cpu_count())]
subprocess.check_call([cmake, BASE_DIR] + cmake_args, cwd=build_type_dir, env=os.environ)
subprocess.check_call(['make'] + build_args, cwd=build_type_dir, env=os.environ)
def copy_file(infile, outfile, preserve_mode=1, preserve_times=1, link=None, level=1):
"""Copy a file respecting verbose, dry-run and force flags. (The
former two default to whatever is in the Distribution object, and
the latter defaults to false for commands that don't define it.)
"""
return file_util.copy_file(infile, outfile, preserve_mode, preserve_times, True, link)
def copy_hpp():
def get_src_py_and_dst():
ret = []
header_files = [
"torch_npu/csrc/aten/*.h",
"torch_npu/csrc/aten/*/*.h",
"torch_npu/csrc/aten/*/*/*.h",
"torch_npu/csrc/core/*.h",
"torch_npu/csrc/core/*/*.h",
"torch_npu/csrc/core/*/*/*.h",
"torch_npu/csrc/framework/*.h",
"torch_npu/csrc/framework/*/*.h",
"torch_npu/csrc/framework/*/*/*.h",
"third_party/acl/inc/*/*.h",
"third_party/acl/inc/*/*/*.h"
]
glob_header_files = []
for regex_pattern in header_files:
glob_header_files += glob.glob(os.path.join(BASE_DIR, regex_pattern), recursive=True)
for src in glob_header_files:
dst = os.path.join(
os.path.join(BASE_DIR, f"libtorch/include/torch_npu"),
os.path.relpath(src, os.path.join(BASE_DIR, "torch_npu")))
os.makedirs(os.path.dirname(dst), exist_ok=True)
ret.append((src, dst))
return ret
ret = get_src_py_and_dst()
for src, dst in ret:
copy_file(src, dst)
def copy_lib():
lib_file = [f"build/{get_build_type()}/packages/torch_npu/lib/*.*"]
glob_lib_files = []
for regex_pattern in lib_file:
glob_lib_files += glob.glob(os.path.join(BASE_DIR, regex_pattern), recursive=True)
dst_path = os.path.join(BASE_DIR, f"libtorch/lib")
os.makedirs(dst_path, exist_ok=True)
for src in glob_lib_files:
_, src_file_name = os.path.split(src)
copy_file(src, os.path.join(dst_path, src_file_name))
def build_libtorch_npu():
clean_generated_files()
generate_bindings_code(BASE_DIR, "True")
build_stub(BASE_DIR)
run_cmake()
copy_hpp()
copy_lib()
if __name__ == "__main__":
build_libtorch_npu()
+65 -32
View File
@@ -23,6 +23,7 @@ from abc import ABCMeta, abstractmethod
BASE_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
DEFAULT_UT_FILE = os.path.join(BASE_DIR, 'ci/pytorch_resnet.py')
TEST_OPS = os.path.join(BASE_DIR, 'test/test_ops.py')
class AccurateTest(metaclass=ABCMeta):
@@ -64,7 +65,7 @@ class OpStrategy(AccurateTest):
if filename.find('KernelNpu') >= 0:
feature_line = filename.split('KernelNpu')[0]
features = re.findall('[A-Z][^A-Z]*', feature_line)
regex = '*' + '*'.join(["%s" % feature.lower() for feature in features]) + '*'
regex = '*' + '*'.join([f"{feature.lower()}" for feature in features]) + '*'
return AccurateTest.find_ut_by_regex(regex)
return []
@@ -75,9 +76,7 @@ class DirectoryStrategy(AccurateTest):
"""
def identify(self, modify_file):
second_dir = modify_file.split("/")[0]
if second_dir == 'test':
return [os.path.join(BASE_DIR, modify_file)]
return []
return [os.path.join(BASE_DIR, modify_file)] if second_dir == 'test' else []
class CopyOptStrategy(AccurateTest):
@@ -94,7 +93,10 @@ class CopyOptStrategy(AccurateTest):
class TestMgr():
def __init__(self):
self.modify_files = []
self.ut_files = []
self.test_files = {
'ut_files': [],
'op_ut_files': []
}
def load(self, modify_files):
with open(modify_files) as f:
@@ -104,20 +106,22 @@ class TestMgr():
def analyze(self):
for modify_file in self.modify_files:
self.ut_files += DirectoryStrategy().identify(modify_file)
self.ut_files += OpStrategy().identify(modify_file)
self.ut_files += CopyOptStrategy().identify(modify_file)
unique_files = set(self.ut_files)
self.test_files['ut_files'] += DirectoryStrategy().identify(modify_file)
self.test_files['ut_files'] += CopyOptStrategy().identify(modify_file)
self.test_files['ut_files'] += OpStrategy().identify(modify_file)
self.test_files['op_ut_files'] += OpStrategy().identify(modify_file)
unique_files = set(self.test_files['ut_files'])
exist_ut_file = []
for changed_file in unique_files:
if os.path.exists(changed_file):
exist_ut_file.append(changed_file)
self.ut_files = exist_ut_file
self.ut_files.append(DEFAULT_UT_FILE)
exist_ut_file = [
changed_file
for changed_file in unique_files
if os.path.exists(changed_file)
]
self.test_files['ut_files'] = exist_ut_file
self.test_files['ut_files'].append(DEFAULT_UT_FILE)
def get_ut_files(self):
return self.ut_files
def get_test_files(self):
return self.test_files
def print_modify_files(self):
print("modify files:")
@@ -126,46 +130,74 @@ class TestMgr():
def print_ut_files(self):
print("ut files:")
for ut_file in self.ut_files:
for ut_file in self.test_files['ut_files']:
print(ut_file)
def print_op_ut_files(self):
print("op ut files:")
for op_ut_file in self.test_files['op_ut_files']:
print(op_ut_file)
def exec_ut(ut_files):
def exec_ut(files):
"""
执行单元测试文件,其中存在失败,则标识异常并打印相关信息
"""
def change_dir_and_exec(ut_path):
ut_dir = os.path.dirname(ut_path)
ut_file = os.path.basename(ut_path)
def get_ut_name(ut_file):
return ut_file.split('/')[-1].split('.')[0].lstrip('test_')
def change_dir_and_exec(ut_path, is_op_ut=False):
if is_op_ut:
ut_dir = os.path.dirname(TEST_OPS)
cmd = f'python3 -m unittest test_ops.py -v -k {ut_path}_'
else:
ut_dir = os.path.dirname(ut_path)
ut_file = os.path.basename(ut_path)
cmd = f'python3 {ut_file}'
os.chdir(ut_dir)
cmd = "python3 {}".format(ut_file)
p = subprocess.Popen(['python3', ut_file], stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
p = subprocess.Popen(cmd.split(' '), stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
try:
msg = p.communicate(timeout=300)
msg = p.communicate(timeout=2000)
ret = p.poll()
if ret:
print(msg)
stdout = msg[0].decode('utf-8')
stderr = msg[1].decode('utf-8') if msg[1] else msg[1]
print(stdout, stderr)
except subprocess.TimeoutExpired:
p.kill()
p.terminate()
ret = 1
print("Timeout: Command '" + cmd + "' timed out after 300 seconds")
print(f"Timeout: Command '{cmd}' timed out after 2000 seconds")
except Exception as err:
ret = 1
print(err)
return ret
ut_files = files['ut_files']
op_ut_files = files['op_ut_files']
ret_status = 0
exec_infos = []
for ut_file in ut_files:
temp_ret = change_dir_and_exec(ut_file)
if temp_ret:
ret_status = temp_ret
exec_infos.append("exec ut {} failed.".format(ut_file))
else:
exec_infos.append("exec ut {} success.".format(ut_file))
for op_ut_file in op_ut_files:
ut_name = get_ut_name(op_ut_file)
op_ut_ret = change_dir_and_exec(ut_name, True)
if op_ut_ret:
ret_status = op_ut_ret
exec_infos.append("exec ut test_ops.py {} failed.".format(ut_name))
else:
exec_infos.append("exec ut test_ops.py {} success.".format(ut_name))
print("***** Total result:")
for exec_info in exec_infos:
print(exec_info)
@@ -177,10 +209,11 @@ if __name__ == "__main__":
test_mgr = TestMgr()
test_mgr.load(cur_modify_files)
test_mgr.analyze()
cur_ut_files = test_mgr.get_ut_files()
cur_test_files = test_mgr.get_test_files()
test_mgr.print_modify_files()
test_mgr.print_ut_files()
test_mgr.print_op_ut_files()
ret_ut = exec_ut(cur_ut_files)
sys.exit(ret_ut)
ret_ut = exec_ut(cur_test_files)
sys.exit(ret_ut)
@@ -58,12 +58,10 @@ def name(func: FunctionSchema, *, faithful_name_for_out_overloads: bool = False)
# types. Returns None if the type in question is not a value type.
def valuetype_type(t: Type, *, binds: ArgName) -> Optional[NamedCType]:
if isinstance(t, BaseType):
if t.name == BaseTy.Tensor:
if t.name == BaseTy.Tensor or t.name == BaseTy.Scalar:
return None
elif t.name in BaseTypeToCppMapping:
return NamedCType(binds, BaseCType(BaseTypeToCppMapping[t.name]))
else:
raise AssertionError(f"unsupported type {repr(t)}")
# All other BaseType currently map directly to BaseCppTypes.
return NamedCType(binds, BaseCType(BaseTypeToCppMapping[t.name]))
elif isinstance(t, OptionalType):
elem = valuetype_type(t.elem, binds=binds)
if elem is None:
@@ -205,7 +203,7 @@ JIT_TO_CPP_DEFAULT = {
'None': 'c10::nullopt', # UGH this one is type directed
'Mean': 'at::Reduction::Mean',
'[]': '{}',
'contiguous_format': 'MemoryFormat::Contiguous',
'contiguous_format': 'c10::MemoryFormat::Contiguous',
'long': 'at::kLong',
}
@@ -58,25 +58,35 @@ def returns_type(rs: Sequence[Return]) -> CType:
# At present, there is no difference. But there could be!
return cpp.returns_type(rs)
def jit_arguments(func: FunctionSchema) -> List[Argument]:
def to_argument(a: Union[Argument, TensorOptionsArguments, SelfArgument]) -> List[Argument]:
if isinstance(a, Argument):
return [a]
elif isinstance(a, SelfArgument):
return [a.argument]
elif isinstance(a, TensorOptionsArguments):
return [a.dtype, a.layout, a.device, a.pin_memory]
else:
assert_never(a)
return list(concat_map(to_argument, itertools.chain(
func.arguments.positional,
func.arguments.kwarg_only,
func.arguments.out)))
def argument(a: Union[Argument, SelfArgument, TensorOptionsArguments], *, is_out: bool) -> List[Binding]:
should_default = not is_out
if isinstance(a, Argument):
default: Optional[str] = None
if should_default and a.default is not None:
default = cpp.default_expr(a.default, a.type)
return [
Binding(
nctype=argument_type(a, binds=a.name),
name=a.name,
default=default,
argument=a)
]
elif isinstance(a, SelfArgument):
return argument(a.argument, is_out=is_out)
elif isinstance(a, TensorOptionsArguments):
return (
argument(a.dtype, is_out=is_out) +
argument(a.layout, is_out=is_out) +
argument(a.device, is_out=is_out) +
argument(a.pin_memory, is_out=is_out)
)
else:
assert_never(a)
def arguments(func: FunctionSchema) -> List[Binding]:
return [
Binding(
nctype=argument_type(a, binds=a.name),
name=a.name,
argument=a,
) for a in jit_arguments(func)]
args: List[Union[Argument, TensorOptionsArguments, SelfArgument]] = []
args.extend(func.arguments.positional)
args.extend(func.arguments.kwarg_only)
args.extend(func.arguments.out)
return [r for arg in args for r in argument(arg, is_out=func.is_out_fn())]
@@ -17,8 +17,7 @@
from typing import Union, Sequence, List, Optional
from codegen.model import (Argument, FunctionSchema, Return,
SelfArgument, TensorOptionsArguments, Type, UseC10Dispatcher,
assert_never)
SelfArgument, TensorOptionsArguments, Type)
from codegen.api.types import (ArgName, BaseCType, Binding,
ConstRefCType, NamedCType, CType, MutRefCType, ListCType,
@@ -26,6 +25,7 @@ from codegen.api.types import (ArgName, BaseCType, Binding,
deviceT, boolT, scalarTypeT)
from codegen.api import cpp
from codegen import local
from codegen.model import assert_never
# This file describes the translation of JIT schema to the native functions API.
# This looks a lot like the C++ API (which makes historical sense, because the
@@ -53,6 +53,10 @@ def argumenttype_type(t: Type, *, mutable: bool, binds: ArgName) -> NamedCType:
return NamedCType(binds, ConstRefCType(tensor_type))
elif str(t) == 'Tensor?[]':
return NamedCType(binds, ConstRefCType(ListCType(OptionalCType(BaseCType(tensorT)))))
elif str(t) == 'Scalar':
return NamedCType(binds, ConstRefCType(BaseCType(scalarT)))
elif str(t) == 'Scalar?':
return NamedCType(binds, ConstRefCType(OptionalCType(BaseCType(scalarT))))
return cpp.argumenttype_type(t, mutable=mutable, binds=binds)
def returns_type(rs: Sequence[Return]) -> CType:
@@ -120,15 +124,4 @@ def arguments(func: FunctionSchema) -> List[Binding]:
args: List[Union[Argument, TensorOptionsArguments, SelfArgument]] = []
args.extend(func.arguments.non_out)
args.extend(func.arguments.out)
return [r for arg in args for r in argument(arg, is_out=func.is_out_fn())]
def native_arguments(func: FunctionSchema, dispatch: UseC10Dispatcher) -> List[Binding]:
args: List[Union[Argument, TensorOptionsArguments, SelfArgument]] = []
if dispatch is UseC10Dispatcher.full:
args.extend(func.arguments.non_out)
args.extend(func.arguments.out)
else:
args.extend(func.arguments.out)
args.extend(func.arguments.non_out)
return [r for arg in args for r in argument(arg, is_out=func.is_out_fn())]
@@ -641,7 +641,7 @@ def argument_type_str(t: Type, *, simple_type: bool = False) -> str:
BaseTy.Tensor: 'Tensor',
BaseTy.int: 'int64_t',
BaseTy.float: 'double',
BaseTy.str: 'std::string'
BaseTy.str: 'c10::string_view'
}
if t.name in base_dict:
return base_dict[t.name]
@@ -1048,7 +1048,7 @@ def arg_parser_unpack_method(t: Type, has_default: bool) -> str:
BaseTy.int: 'toInt64',
BaseTy.bool: 'toBool',
BaseTy.float: 'toDouble',
BaseTy.str: 'string'
BaseTy.str: 'stringView'
}
if t.name in [BaseTy.Tensor, BaseTy.Stream, BaseTy.Storage,
BaseTy.Scalar, BaseTy.Dimname]:
@@ -49,7 +49,7 @@ intT = BaseCppType('', 'int64_t')
doubleT = BaseCppType('', 'double')
boolT = BaseCppType('', 'bool')
voidT = BaseCppType('', 'void')
stringT = BaseCppType('std', 'string')
stringT = BaseCppType('c10', 'string_view')
generatorT = BaseCppType('at', 'Generator')
scalarTypeT = BaseCppType('at', 'ScalarType')
tensorT = BaseCppType('at', 'Tensor')
@@ -366,7 +366,11 @@ return {sig.name()}({', '.join(e.expr for e in translate(cpp_sig.arguments(), si
device_check = RegisterDispatchKey.gen_device_check(f.device_check, list(device_check_args), name)
device_guard = "// DeviceGuard omitted" # default
record_func_def = "torch_npu::profiler::NPURecordFunction guard;"
record_func_def = """
#ifndef BUILD_LIBTORCH
torch_npu::profiler::NPURecordFunction guard;
#endif
"""
if f.device_guard and is_cuda_dispatch_key(self.backend_index.dispatch_key):
has_tensor_options = any(isinstance(a.argument, TensorOptionsArguments) for a in args)
if has_tensor_options:
@@ -36,7 +36,6 @@ from codegen.api.signature import (CppSignature, CppSignatureGroup, kernel_signa
import codegen.api.meta as meta
import codegen.api.cpp as cpp
import codegen.api.structured as structured
import codegen.api.native as native_arguments
from codegen.api.translate import translate
from codegen.selective_build.selector import SelectiveBuilder
from codegen.api.types import (BaseCType, TupleCType, BaseCppType)
@@ -19,15 +19,19 @@ from codegen.api.types import (BaseCType, TupleCType, OptionalCType, BaseCppType
from codegen.api.signature import DispatcherSignature, NativeSignature
from codegen.model import SchemaKind, NativeFunction
from codegen.api.native import native_arguments
from codegen.api.native import arguments
backend = None
def transfer_args_of_wrapper_func_to_cpu(sig: DispatcherSignature, func: NativeFunction) -> Tuple[str, List[str]]:
convert: str = f"// Convert args to cpu in order to use at::native kernel \n " \
f"std::cout << \"Cur kernel: {sig.func.name} is running on cpu.\" << std::endl; \n "
f"static auto warn_once = [](){{ \n " \
f"std::cout << \"Warning: kernel [{sig.func.name}] is not supported by NPU currently. " \
f"Now this kernel is running on CPU.\" << std::endl; \n " \
f"return true; \n " \
f"}}(); \n "
args_names: List[str] = []
args = native_arguments(sig.func, func.use_c10_dispatcher)
args = arguments(sig.func)
for arg in args:
arg_type = str(arg.type)
if 'Tensor' not in arg_type:
@@ -126,4 +130,4 @@ auto cpu_ret = {func_call};
else:
assert False, f'Do not support cur func type {sig.func.kind()}'
return ret_code
return ret_code
@@ -41,6 +41,8 @@ def create_backend_index(backend_ops: List[str],
for op in backend_ops:
op_name = OperatorName.parse(op)
assert op_name in native_funcs_map, f"Found an invalid operator name: {op_name}"
if os.environ.get('BSCPP_OPS_ENABLE') is None and native_funcs_map[op_name].bscpp_op:
continue
# See Note [External Backends Follow Dispatcher API]
kernel_name = dispatcher.name(native_funcs_map[op_name].func)
# TODO: allow structured external backends later.
@@ -153,7 +155,8 @@ def parse_backend_yaml(
valid_keys = ['backend', 'cpp_namespace', 'extra_headers', 'supported', 'autograd', 'custom', 'custom_autograd']
true_backend = yaml_values.pop('backend', None)
yaml_backend = yaml_values.pop('backend', None)
true_backend = 'XLA' if yaml_backend=='NPU' else yaml_backend
assert true_backend is not None, 'You must provide a value for "backend"'
backend = "NPU"
@@ -242,16 +245,10 @@ def error_on_missing_kernels(
expected_backend_kernel_name_counts[dispatcher.name(native_f.func)].append(native_f)
missing_kernels_err_msg = ""
unsupported_ops_list = ""
for expected_name, funcs in expected_backend_kernel_name_counts.items():
expected_overload_count = len(funcs)
actual_overload_count = actual_backend_kernel_name_counts[expected_name]
if actual_overload_count == 0:
for func in funcs:
backend_indices[backend_key].index.pop(func.func.name, None)
backend_indices[autograd_key].index.pop(func.func.name, None)
unsupported_ops_list += f"{func.func.name}\n"
elif expected_overload_count != actual_overload_count:
if expected_overload_count != actual_overload_count:
def create_decl(f: NativeFunction) -> str:
with native_function_manager(f):
return DispatcherSignature.from_schema(f.func).decl()
@@ -262,8 +259,7 @@ but expected {expected_overload_count} kernel(s). The expected function schemas
{expected_schemas_str}
"""
assert missing_kernels_err_msg == "", missing_kernels_err_msg
if unsupported_ops_list != "":
print(f"Unsupported Ops List:\n{unsupported_ops_list}")
def error_on_cpu_kernels(
cur_backend_key: DispatchKey,
@@ -283,6 +279,7 @@ def error_on_cpu_kernels(
for func in funcs:
backend_indices[DispatchKey.CPU].index.pop(func.func.name, None)
def main() -> None:
parser = argparse.ArgumentParser(description='Generate backend stub files')
parser.add_argument(
@@ -301,6 +298,7 @@ def main() -> None:
run(options.to_cpu, options.source_yaml, options.output_dir, options.dry_run, options.impl_path)
def run(to_cpu: str, source_yaml: str, output_dir: str, dry_run: bool, impl_path: Optional[str]) -> None:
template_dir = os.path.join(pathlib.Path(__file__).parent.absolute(), "templates")
@@ -323,6 +321,8 @@ def run(to_cpu: str, source_yaml: str, output_dir: str, dry_run: bool, impl_path
backend_indices = parsed_backend_yaml.backend_indices
selector = SelectiveBuilder.get_nop_selector()
if backend_key is not None:
backend_dispatch_key: DispatchKey = backend_key
autograd_dispatch_key: DispatchKey = autograd_key
@@ -393,7 +393,7 @@ def run(to_cpu: str, source_yaml: str, output_dir: str, dry_run: bool, impl_path
grouped_native_functions
)),
})
if to_cpu.upper() in ['OFF', '0', 'NO', 'FALSE', 'F', 'N']:
return
@@ -441,5 +441,6 @@ def run(to_cpu: str, source_yaml: str, output_dir: str, dry_run: bool, impl_path
)),
})
if __name__ == '__main__':
main()
@@ -21,6 +21,7 @@
import argparse
import os
import re
from collections import defaultdict, namedtuple
from typing import Dict, Optional, List, Tuple, Set, Sequence, Callable
@@ -138,6 +139,9 @@ def parse_custom_yaml(custom_path: str) -> ParsedYaml:
@with_native_function
def should_generate_py_binding(f: NativeFunction) -> bool:
if os.environ.get('BSCPP_OPS_ENABLE') is None and f.bscpp_op:
return False
name = cpp.name(f.func)
for skip_regex in SKIP_PYTHON_BINDINGS:
if skip_regex.match(name):
@@ -344,6 +348,9 @@ static PyObject * ${pycname}(PyObject* self_, PyObject* args, PyObject* kwargs)
}, /*traceable=*/${traceable});
torch::ParsedArgs<${max_args}> parsed_args;
auto _r = parser.parse(${self_}, args, kwargs, parsed_args);
if(_r.has_torch_function()) {
return torch::handle_torch_function(_r, args, kwargs, THPVariableFunctionsModule, "torch");
}
switch (_r.idx) {
${dispatch}
}
@@ -371,6 +378,9 @@ static PyObject * ${pycname}(PyObject* self_, PyObject* args, PyObject* kwargs)
}, /*traceable=*/${traceable});
torch::ParsedArgs<${max_args}> parsed_args;
auto _r = parser.parse(${self_}, args, kwargs, parsed_args);
if(_r.has_torch_function()) {
return torch::handle_torch_function(_r, args, kwargs, THPVariableFunctionsModule, "torch");
}
${dispatch}
${method_footer}
}
+52 -27
View File
@@ -95,6 +95,7 @@ class DispatchKey(Enum):
PrivateUse3 = auto()
EndOfBackendKeys = PrivateUse3
ZeroTensor = auto()
Meta = auto()
BackendSelect = auto()
Named = auto()
@@ -172,6 +173,19 @@ class DeviceCheckType(Enum):
NoCheck = 0
ExactSame = 1
class Tag(Enum):
inplace_view = 0
def __str__(self) -> str:
return self.name
@staticmethod
def parse(value: str) -> 'Tag':
for k, v in Tag.__members__.items():
if k == value:
return v
raise AssertionError(f'unknown tag {value}')
# The basic input to the code generation is native_functions.yaml.
# The name "native", BTW, comes from the distinction between native
# functions and legacy TH functions. The legacy TH functions are gone,
@@ -193,10 +207,6 @@ class NativeFunction:
# classes for expository clarity.)
func: 'FunctionSchema'
# Corresponds to the 'use_c10_dispatcher' field. The default
# is 'full'
use_c10_dispatcher: UseC10Dispatcher
# Whether or not to generate mutable tensor arguments like regular
# ones
use_const_ref_for_mutable_tensors: bool
@@ -273,6 +283,14 @@ class NativeFunction:
has_composite_implicit_autograd_kernel: bool
has_composite_explicit_autograd_kernel: bool
# Tags are used to describe semantic information about (groups of) operators,
# That aren't easily inferrable directly from the operator's schema.
# For now operators have at most one tag.
tag: Optional['Tag']
# Whether or not the NativeFunction is bishengcpp kernel
bscpp_op: bool
# NB: The benefit of defining a dataclass is that we automatically get
# a constructor defined for all the fields we specify. No need
# to explicitly write it out.
@@ -295,19 +313,6 @@ class NativeFunction:
cpp_no_default_args = set(cpp_no_default_args_list)
return cpp_no_default_args
def parse_use_dispatcher(e):
use_c10_dispatcher_s = e.pop('use_c10_dispatcher', None)
assert use_c10_dispatcher_s != 'full', \
"No need to specify 'use_c10_dispatcher: full' anymore. This is the default now. Just remove the line."
if use_c10_dispatcher_s is None:
use_c10_dispatcher = UseC10Dispatcher.full
elif use_c10_dispatcher_s == 'hacky_wrapper_for_legacy_signatures':
use_c10_dispatcher = UseC10Dispatcher.hacky_wrapper_for_legacy_signatures
else:
raise AssertionError(f'use_c10_dispatcher must be full or hacky_wrapper_for_legacy_signatures,'
f' got {use_c10_dispatcher_s}')
return use_c10_dispatcher
def parse_variants(e):
variants_s = e.pop('variants', 'function')
assert isinstance(variants_s, str)
@@ -323,7 +328,6 @@ class NativeFunction:
func = parse_func(e)
cpp_no_default_args = parse_cpp_no_default_args(e)
use_c10_dispatcher = parse_use_dispatcher(e)
variants = parse_variants(e)
use_const_ref_for_mutable_tensors = e.pop('use_const_ref_for_mutable_tensors', False)
@@ -374,6 +378,15 @@ class NativeFunction:
precomputed = parse_precomputed(e, structured)
def parse_tag(e, structured):
tag_str = e.pop('tags', None)
assert tag_str is None or isinstance(tag_str, str), f'not a str: {tag_str}'
tag = Tag.parse(tag_str) if tag_str else None
return tag
tag = parse_tag(e, structured)
bscpp_op = e.pop("bscpp_op", False)
from codegen.api import cpp
def parse_dispatch(e, func, manual_kernel_registration, structured_delegate, structured):
@@ -433,7 +446,7 @@ class NativeFunction:
f"if structured_delegate, then must not have {key} in dispatch dictionary " \
"(it is delegated!)"
assert_last(e, structured_delegate, dispatch)
return NativeFunction(func=func, use_c10_dispatcher=use_c10_dispatcher,
return NativeFunction(func=func,
use_const_ref_for_mutable_tensors=use_const_ref_for_mutable_tensors,
variants=variants, structured=structured, structured_delegate=structured_delegate,
structured_inherits=structured_inherits, precomputed=precomputed,
@@ -441,7 +454,8 @@ class NativeFunction:
python_module=python_module, category_override=category_override, device_guard=device_guard,
device_check=device_check, cpp_no_default_args=cpp_no_default_args, is_abstract=is_abstract,
has_composite_implicit_autograd_kernel=has_composite_implicit_autograd_kernel,
has_composite_explicit_autograd_kernel=has_composite_explicit_autograd_kernel), backend_metadata
has_composite_explicit_autograd_kernel=has_composite_explicit_autograd_kernel, tag=tag,
bscpp_op=bscpp_op), backend_metadata
def validate_unstructured(self) -> None:
@@ -481,9 +495,6 @@ class NativeFunction:
if a.default is not None}
invalid_args = set.difference(self.cpp_no_default_args, defaulted_arguments)
assert len(invalid_args) == 0, f'Invalid cpp_no_default_args: {invalid_args}'
if self.structured or self.structured_delegate:
assert self.use_c10_dispatcher is UseC10Dispatcher.full, \
"Structured kernels MUST be use_c10_dispatcher: full; port your argument order"
if self.structured_inherits is not None:
assert self.structured, "structured_inherits must also imply structured: True"
if str(self.func.name).startswith('_foreach'):
@@ -682,7 +693,7 @@ class BackendIndex:
elif isinstance(g, NativeFunctionsGroup):
f = self.primary(g)
else:
assert_never(f)
assert_never(g)
if f.func.name not in self.index:
return None
return self.index[f.func.name]
@@ -771,7 +782,9 @@ class FunctionSchema:
def parse(func: str) -> 'FunctionSchema':
# We should probably get a proper parser here
assert ' -> ' in func, "function schema missing return type (spaces are mandatory)"
func_decl, return_decl = [x.strip() for x in func.split(' -> ')]
last_index = func.rfind(" -> ")
func_decl = func[:last_index]
return_decl = func[last_index + len(" -> "):]
ops, args = func_decl.split('(', 1)
assert args[-1] == ")", "Expecting closing )"
args = args[:-1]
@@ -912,19 +925,31 @@ class Annotation:
# we can conveniently assume it is canonically ordered
alias_set: Tuple[str, ...]
is_write: bool
alias_set_after: str
@staticmethod
def parse(ann: str) -> 'Annotation':
m = re.match(r'^([a-z])(!?)(!?)$', ann)
# Only handling afterSet == Wildcard for now
becomes_wildcard_index = ann.find(" -> *")
if becomes_wildcard_index != -1:
after_set = "*"
# TODO: im not good enough with regexes to ignore -> *
m = re.match(r'^([a-z])(!?)(!?)$',
ann[:becomes_wildcard_index] + ann[becomes_wildcard_index + len(" -> *"):])
else:
after_set = ""
m = re.match(r'^([a-z])(!?)(!?)$', ann)
assert m is not None, f'unrecognized alias annotation {ann}'
alias_set = (m.group(1),)
is_write = m.group(2) == '!'
r = Annotation(alias_set=alias_set, is_write=is_write)
r = Annotation(alias_set=alias_set, is_write=is_write, alias_set_after=after_set)
assert str(r) == ann, f'{r} != {ann}'
return r
def __str__(self) -> str:
alias_set = '|'.join(self.alias_set)
if self.alias_set_after:
alias_set = f'{alias_set}{" -> "}{self.alias_set_after}'
is_write = '!' if self.is_write else ''
return f'{alias_set}{is_write}'
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,52 @@
// Copyright (c) 2023 Huawei Technologies Co., Ltd
// Copyright (c) 2022, Facebook CORPORATION.
// All rights reserved.
//
// Licensed under the BSD 3-Clause License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/BSD-3-Clause
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#ifndef __SCRIPTS_CODEGEN_TEMPLATES_DISPATCHKEYNATIVEFUNCTIONS__
#define __SCRIPTS_CODEGEN_TEMPLATES_DISPATCHKEYNATIVEFUNCTIONS__
#include <ATen/Tensor.h>
#include <ATen/ATen.h>
#include <c10/core/Device.h>
namespace at_npu {
namespace key {
static constexpr c10::DeviceType NativeDeviceType = c10::DeviceType::XLA;
static constexpr c10::DispatchKey NativeDispatchKey = c10::DispatchKey::XLA;
static constexpr c10::DispatchKey NativeAutogradDispatchKey = c10::DispatchKey::AutogradXLA;
static constexpr c10::Backend NativeBackend = c10::Backend::XLA;
static const std::string npu_device_str = "npu";
static const std::string default_device_str = "xla";
static bool isDeviceTensor(const at::Tensor &tensor) {
return tensor.is_xla();
}
} // namespace key
} // namespace at_npu
// ${generated_comment}
namespace ${cpp_namespace} {
struct ${class_name} {
${dispatch_declarations}
};
} // namespace ${cpp_namespace}
#endif
@@ -33,7 +33,6 @@
#include <ATen/WrapDimUtils.h>
#include <ATen/Dispatch.h>
#include <c10/util/Half.h>
#include <c10/core/TensorImpl.h>
#include <c10/core/UndefinedTensorImpl.h>
#include <c10/util/Optional.h>
#include <ATen/Tensor.h>
@@ -46,11 +45,12 @@
#include <utility>
#include <ATen/Config.h>
#include <ATen/core/op_registration/hacky_wrapper_for_legacy_signatures.h>
#include <torch/library.h>
#include "torch_npu/csrc/profiler/utils.h"
$legacy_th_headers
#ifndef BUILD_LIBTORCH
#include "torch_npu/csrc/profiler/utils.h"
#endif
$external_backend_headers
$namespaced_headers
@@ -1,3 +1,19 @@
// Copyright (c) 2020 Huawei Technologies Co., Ltd
// Copyright (c) 2019, Facebook CORPORATION.
// All rights reserved.
//
// Licensed under the BSD 3-Clause License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/BSD-3-Clause
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ${generated_comment}
// Python bindings for torch.* functions implemented through ATen.
@@ -31,6 +47,7 @@
#include <torch/csrc/utils/structseq.h>
#include <torch/csrc/utils/cuda_lazy_init.h>
#include <ATen/ATen.h>
#include <ATen/record_function.h>
#include <functional>
#include <initializer_list>
@@ -39,6 +56,7 @@
#include "torch_npu/csrc/aten/NPUNativeFunctions.h"
#include "torch_npu/csrc/utils/LazyInit.h"
#include "torch_npu/csrc/utils/DeviceParser.h"
using at::Tensor;
using at::Device;
@@ -13,18 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import numpy
import torch
import torch_npu
from torch_npu.utils.device_guard import torch_device_guard, device
@torch_device_guard
def _device(*args, **kwargs):
new_device = torch_npu.new_device(*args, **kwargs)
if new_device.type == torch.npu.native_device:
return device(type=torch_npu.npu.npu_device, index=new_device.index)
return new_device
from torch_npu.utils.device_guard import torch_device_guard
@torch_device_guard
@@ -62,26 +55,31 @@ def _npu_dropout_gen_mask(*args, **kwargs):
return torch_npu.npu_dropout_gen_mask(*args, **kwargs)
@torch_device_guard
def _new_device(*args, **kwargs):
return torch_npu._C.device(*args, **kwargs)
def jit_script(obj, optimize=None, _frames_up=0, _rcb=None):
# (Ascend) Disable extension of torch.jit.script
return obj
def _as_tensor(*args, **kwargs):
if isinstance(args[0], torch.Tensor):
dst_device = args[0].device
else:
dst_device = "cpu"
if kwargs and "device" in kwargs:
dst_device = kwargs.get("device")
if "npu" in str(dst_device):
if isinstance(args[0], numpy.ndarray):
return torch.from_numpy(args[0]).to(dst_device)
else:
return args[0].to(dst_device)
return torch._C._VariableFunctions.as_tensor(*args, **kwargs)
dst_device = kwargs.pop("device")
return torch._C._VariableFunctions.as_tensor(*args, **kwargs).to(dst_device)
${device_methods_def_py_dispatch}
def add_torch_funcs():
torch.device = _device
torch.tensor = _tensor
torch.full = _full
torch.randint = _randint
@@ -91,5 +89,6 @@ def add_torch_funcs():
torch.npu_dropout_gen_mask = _npu_dropout_gen_mask
torch.jit.script = jit_script
torch.as_tensor = _as_tensor
torch.new_device = _new_device
${device_methods_def_py}
+1
View File
@@ -375,6 +375,7 @@
| 255 | torch.trapz | Supported |
| 256 | torch.triangular_solve | Supported |
| 257 | torch.vdot | Supported |
| 258 | torch.aminmax | Supported |
## Utilities
@@ -438,7 +438,7 @@ The following uses the torch.add() operator as an example to describe the develo
at::Tensor result = OpPreparation::ApplyTensorWithFormat(
outputSize,
outputTensor.options(),
CalcuOpUtil::get_tensor_npu_format(outputTensor));
CalcuOpUtil::GetTensorNpuFormat(outputTensor));
// calculate the output result of the NPU
add_out_npu_nocheck(result, self, other, alpha);
@@ -454,7 +454,7 @@ The following uses the torch.add() operator as an example to describe the develo
auto outputSize = input_same_output_size(self);
// construct the output tensor of the NPU
at::Tensor result = OpPreparation::ApplyTensorWithFormat(
outputSize, self.options(), CalcuOpUtil::get_tensor_npu_format(self));
outputSize, self.options(), CalcuOpUtil::GetTensorNpuFormat(self));
// calculate the output result of the NPU
adds_out_npu_nocheck(result, self, other, alpha);
@@ -472,7 +472,7 @@ The following uses the torch.add() operator as an example to describe the develo
{
c10::SmallVector<at::Tensor, N> inputs = {self, other};
c10::SmallVector<at::Tensor, N> outputs = {self};
CalcuOpUtil::check_memory_over_laps(inputs, outputs);
CalcuOpUtil::CheckMemoryOverLaps(inputs, outputs);
if (!NpuUtils::check_match(&self))
{
@@ -516,7 +516,7 @@ The following uses the torch.add() operator as an example to describe the develo
at::Scalar alpha,
at::Tensor &result)
{
bool isSelfWrapped = CalcuOpUtil::is_scalar_wrapped_to_tensor(self);
bool isSelfWrapped = CalcuOpUtil::IsScalarWrappedToTensor(self);
at::Tensor outputTensor;
if (not isSelfWrapped)
@@ -531,7 +531,7 @@ The following uses the torch.add() operator as an example to describe the develo
OpPreparation::CheckOut(
{self},
result,
CalcuOpUtil::get_tensor_npu_format(result),
CalcuOpUtil::GetTensorNpuFormat(result),
outputTensor.scalar_type(),
outputSize);
File diff suppressed because it is too large Load Diff
@@ -43,15 +43,18 @@ apt-get install -y gcc==7.3.0 cmake==3.12.0
# Ascend配套软件<a name="Ascend配套软件"></a>
| AscendPyTorch版本 | CANN版本 | 支持PyTorch版本 | Gitee分支名称 |
| :---------------- | :----------- | :-------------- | -------------- |
| 2.0.2 | CANN 5.0.2 | 1.5.0.post2 | 2.0.2.tr5 |
| 2.0.3 | CANN 5.0.3 | 1.5.0.post3 | 2.0.3.tr5 |
| 2.0.4 | CANN 5.0.4 | 1.5.0.post4 | 2.0.4.tr5 |
| 3.0.rc1 | CANN 5.1.RC1 | 1.5.0.post5 | v1.5.0-3.0.rc1 |
| 3.0.rc1 | CANN 5.1.RC1 | 1.8.1.rc1 | v1.8.1-3.0.rc1 |
| 3.0.rc2 | CANN 5.1.RC2 | 1.5.0.post6 | v1.5.0-3.0.rc2 |
| 3.0.rc2 | CANN 5.1.RC2 | 1.8.1.rc2 | v1.8.1-3.0.rc2 |
| AscendPyTorch版本 | CANN版本 | 支持PyTorch版本 | Gitee分支名称 |
| :---------------- | :----------- | :-------------- | --------------- |
| 2.0.2 | CANN 5.0.2 | 1.5.0.post2 | 2.0.2.tr5 |
| 2.0.3 | CANN 5.0.3 | 1.5.0.post3 | 2.0.3.tr5 |
| 2.0.4 | CANN 5.0.4 | 1.5.0.post4 | 2.0.4.tr5 |
| 3.0.rc1 | CANN 5.1.RC1 | 1.5.0.post5 | v1.5.0-3.0.rc1 |
| 3.0.rc1 | CANN 5.1.RC1 | 1.8.1.rc1 | v1.8.1-3.0.rc1 |
| 3.0.rc2 | CANN 5.1.RC2 | 1.5.0.post6 | v1.5.0-3.0.rc2 |
| 3.0.rc2 | CANN 5.1.RC2 | 1.8.1.rc2 | v1.8.1-3.0.rc2 |
| 3.0.rc3 | CANN 6.0.RC1 | 1.5.0.post7 | v1.5.0-3.0.rc3 |
| 3.0.rc3 | CANN 6.0.RC1 | 1.8.1.rc3 | v1.8.1-3.0.rc3 |
| 3.0.rc3 | CANN 6.0.RC1 | 1.11.0.rc1 | v1.11.0-3.0.rc3 |
# 安装方式<a name="安装方式"></a>
@@ -475,6 +478,51 @@ warning如下图所示,由Tensor.set_data浅拷贝操作触发。主要原因
<img src="figures/FAQ torch_npu.png" style="zoom:150%;" />
## 在执行import torch_npu时出现ModuleNotFooundError: NO module named '_lzma'报错问题
5在python命令行下,执行import torch_npu测试时,出现ModuleNotFooundError: NO module named '_lzma'问题,可能由于Python环境失效,重装Python即可。<img src="figures/QA.png" />
## 编译过程中出现XNNPACK相关的Make Error报错
编译原生pytorch时,未配置相关环境变量,导致编译不成功。
![](figures/QA1.png)
1. 执行命令设置环境变量
```
export USE_XNNPACK=0
```
2. 执行命令清除当前编译内容
```
make clean
```
3. 重新编译
## 编译时出现Breakpad error: field 'regs' has incomplete type 'google_breakpad::user_regs_struct'报错
编译原生pytorch时,未配置相关环境变量,导致编译不成功。
1. 执行命令配置环境变量
```
export BUILD_BREAKPAD=0
```
2. 执行命令清除当前编译内容
```
make clean
```
3. 重新编译
## 多卡训练初始化阶段卡顿至超时
init_process_group 函数中使用了IPV6地址,例如::1(注意localhost 可能指向IPv6的地址),使用IPv4可以避免这个问题
# 版本说明<a name='版本说明'></a>
Binary file not shown.

After

Width:  |  Height:  |  Size: 377 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 KiB

@@ -1,923 +0,0 @@
# 概述
用户可以从Ascend ModelZoo获得PyTorch训练模型,但不支持多机多卡训练,需要根据模型的实际代码进行修改。本文帮助用户快速实现Pytorch模型在多机多卡上使用DDP(Distributed Data Parallel)模式训练。
# 训练流程
PyTorch模型多机多卡训练流程一般包括准备环境、准备模型、修改模型、启动训练四个部分。
1. 准备环境。
准备多机多卡训练的软件、硬件、网络环境,包括开发和运行环境搭建、集群组网链接、芯片IP设置、防火墙设置等。
2. 准备模型。
准备PyTorch模型、数据加载器、优化器等训练需要的模块,从[开源社区](https://gitee.com/ascend/modelzoo/tree/master/built-in/PyTorch)获取,也可以自行实现。
3. 修改模型。
在基础模型上进行修改,添加DDP需要的代码和环境变量,使模型支持在多机多卡训练。
4. 启动训练。
实现在多机多卡环境启动模型训练并查看训练日志。
# 快速上手
## 概述
通过示例帮助用户快速了解PyTorch模型是如何在多机多卡上训练的。该示例使用自定义模型实现两台计算机8卡训练。两台计算机分别命名为AI Server0、AI Server1,每台计算机上的8个Ascend 910处理器命名为device 0~7。
## 准备环境
首先您需要具有至少两台装有Ascend 910处理器的计算机,并保证每台计算机都正确的安装NPU固件和驱动。
1. 准备开发和运行环境。
在每台计算机上分别完成开发和运行环境准备。
- 完成CANN开发和运行环境的安装,请参见《CANN 软件安装指南》,支持5.0.3以后版本。
- 安装适配NPU的PyTorch,安装方法请参见《PyTorch安装指南》。
2. 准备组网。
通过交换机或光口直连的方式完成计算设备组网搭建,搭建方法请参见《[数据中心训练场景组网](https://support.huawei.com/enterprise/zh/doc/EDOC1100221993/229cc0e4)》。
该示例中采用两台计算机8卡进行训练,故可以采用光口直连的方式准备组网。
3. 配置device IP
在AI Server0上配置device IP。
```shell
hccn_tool -i 0 -ip -s address 192.168.100.101 netmask 255.255.255.0
hccn_tool -i 1 -ip -s address 192.168.101.101 netmask 255.255.255.0
hccn_tool -i 2 -ip -s address 192.168.102.101 netmask 255.255.255.0
hccn_tool -i 3 -ip -s address 192.168.103.101 netmask 255.255.255.0
hccn_tool -i 4 -ip -s address 192.168.100.100 netmask 255.255.255.0
hccn_tool -i 5 -ip -s address 192.168.101.100 netmask 255.255.255.0
hccn_tool -i 6 -ip -s address 192.168.102.100 netmask 255.255.255.0
hccn_tool -i 7 -ip -s address 192.168.103.100 netmask 255.255.255.0
```
在AI Server1上配置device IP。
```shell
hccn_tool -i 0 -ip -s address 192.168.100.111 netmask 255.255.255.0
hccn_tool -i 1 -ip -s address 192.168.101.111 netmask 255.255.255.0
hccn_tool -i 2 -ip -s address 192.168.102.111 netmask 255.255.255.0
hccn_tool -i 3 -ip -s address 192.168.103.111 netmask 255.255.255.0
hccn_tool -i 4 -ip -s address 192.168.100.110 netmask 255.255.255.0
hccn_tool -i 5 -ip -s address 192.168.101.110 netmask 255.255.255.0
hccn_tool -i 6 -ip -s address 192.168.102.110 netmask 255.255.255.0
hccn_tool -i 7 -ip -s address 192.168.103.110 netmask 255.255.255.0
```
4. 配置防火墙
- Ubuntu系统防火墙关闭命令
```shell
ufw disable
- Redhat或CentOS 7系统防火墙关闭命令
```shell
systemctl stop firewalld
## 准备模型
该示例创建一个简单的模型,供用户快速了解多机多卡训练。用户也可以从[开源社区](https://gitee.com/ascend/modelzoo/tree/master/built-in/PyTorch)获取基于Ascned NPU的PyTorch训练模型。
1. DDP模型。
实现一个简单的样例main.py用于多机多卡训练。
```python
import argparse
import os
import torch
import torch_npu
import torchvision
import torch.nn as nn
import torch.nn.functional as F
import torch.distributed as dist
from torch.nn.parallel import DistributedDataParallel as DDP
### 1.基础模块 ###
# 搭建模型
class ToyModel(nn.Module):
def __init__(self):
super(ToyModel, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(6, 16, 5)
self.fc1 = nn.Linear(16 * 5 * 5, 120)
self.fc2 = nn.Linear(120, 84)
self.fc3 = nn.Linear(84, 10)
def forward(self, x):
x = self.pool(F.relu(self.conv1(x)))
x = self.pool(F.relu(self.conv2(x)))
x = x.view(-1, 16 * 5 * 5)
x = F.relu(self.fc1(x))
x = F.relu(self.fc2(x))
x = self.fc3(x)
return x
# 获取数据集方法
def get_dataset():
transform = torchvision.transforms.Compose([
torchvision.transforms.ToTensor(),
torchvision.transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
])
my_trainset = torchvision.datasets.CIFAR10(root='./data', train=True,
download=True, transform=transform)
train_sampler = torch.utils.data.distributed.DistributedSampler(my_trainset)
trainloader = torch.utils.data.DataLoader(my_trainset,
batch_size=16, num_workers=2, sampler=train_sampler)
return trainloader
### 2. 初始化参数、数据、模型、损失函数、优化器 ####
# 获取local_rank和addr参数
parser = argparse.ArgumentParser()
parser.add_argument("--local_rank", default=-1, type=int)
parser.add_argument("--addr", default='127.0.0.1', type=str, help='master addr')
FLAGS = parser.parse_args()
local_rank = FLAGS.local_rank
addr = FLAGS.addr
# 设置系统的Master地址和端口
os.environ['MASTER_ADDR'] = addr
os.environ['MASTER_PORT'] = '29501'
# DDP backend初始化
loc = 'npu:{}'.format(local_rank)
torch.npu.set_device(loc)
dist.init_process_group(backend='hccl') # hccl是NPU设备上的后端
# 准备数据,要在DDP初始化之后进行
trainloader = get_dataset()
# 实例化模型
model = ToyModel().to(loc)
# 加载模型权重,在构造DDP模型之前,且只需要在master上加载就行了。
ckpt_path = None
if dist.get_rank() == 0 and ckpt_path is not None:
model.load_state_dict(torch.load(ckpt_path))
# 构造DDP model
model = DDP(model, device_ids=[local_rank], output_device=local_rank)
# 初始化优化器,在构造DDP model之后,用model初始化optimizer。
optimizer = torch.optim.SGD(model.parameters(), lr=0.001)
# 初始化损失函数
loss_func = nn.CrossEntropyLoss().to(loc)
### 3. 网络训练 ###
model.train()
iterator = range(100)
for epoch in iterator:
trainloader.sampler.set_epoch(epoch)
for data, label in trainloader:
data, label = data.to(local_rank), label.to(local_rank)
optimizer.zero_grad()
prediction = model(data)
loss = loss_func(prediction, label)
loss.backward()
print("loss = %0.3f \n" % loss)
optimizer.step()
# 1. save模型的时候,和DP模式一样,有一个需要注意的点:保存的是model.module而不是model。
# 因为model其实是DDP model,参数是被`model=DDP(model)`包起来的。
# 2. 只需要在进程0上保存一次就行了,避免多次保存重复的东西。
if dist.get_rank() == 0:
torch.save(model.module.state_dict(), "%d.ckpt" % epoch)
```
2. 在单机多卡上运行训练,确保模型正确。
1. 用户自行安装模型脚本需要的Python第三方库。
2. 配置NPU环境变量,env_npu.sh脚本请参见附录。
```shell
source env_npu.sh
```
3. 使用torch.distributed.launch执行main.py如下命令在单机多卡上训练模型。
```shell
python -m torch.distributed.launch --nproc_per_node 8 main.py
```
`--nproc_per_node` 为训练卡的数量。
运行成功后,模型在该设备的8张NPU上进行训练。
## 修改模型
该快速上手提供的示例,已经对多机多卡训练进行了适配,不需要对脚本进行修改。其他模型的多机多卡适配修改,请参考”多机多卡训练“章节。
## 启动训练
1. 将main.py模型脚本上传至AI Server0和AI Server1任意路径下。
2. 查询服务器的host IP:
```shell
hostname -I
```
打印出所有IP,第一个为IP当前服务器的host IP。
比如:AI Server0服务器的host IP为:192.168.xx.22, AI Server1服务器的host IP为:192.168.xx.23。
3. 使用AI Server0为master节点,我们现在拉起2 x 8的集群。
在AI server0服务器上启动命令:
```shell
# 设置环境变量,env_npu.sh脚本内容从附录获取
source env_npu.sh
# 关闭HCCL通道白名单
export HCCL_WHITELIST_DISABLE=1
# HCCL初始化通信网卡IP,设置为当前服务器的host IP
export HCCL_IF_IP=192.168.xx.22
#
python3.7 -m torch.distributed.launch --nnodes=2 --node_rank=0 --nproc_per_node 8 --master_addr 192.168.xx.22 --master_port 29501 main.py --addr 192.168.xx.22
```
在AI server1服务器上启动命令:
```shell
# 设置环境变量,env_npu.sh脚本内容从附录获取
source env_npu.sh
# 关闭HCCL通道白名单
export HCCL_WHITELIST_DISABLE=1
# HCCL初始化通信网卡IP,设置为当前服务器的host IP
export HCCL_IF_IP=192.168.xx.23
python3.7 -m torch.distributed.launch --nnodes=2 --node_rank=1 --nproc_per_node 8 --master_addr 192.168.xx.22 --master_port 29501 main.py --addr 192.168.xx.22
```
参数说明。
--nnode:指定用来分布式训练脚本的节点数。
--node_rank:多节点分布式训练时,指定当前节点的 rank。
--nproc_per_node:指定当前节点上,使用GPU训练的进程数。
--master_addr:master节点(rank为0)的地址,应该为ip地址或者node 0 的 hostname。
--master_port:指定分布式训练中,master 节点使用的端口号。
--addr:main.py 脚本的入参,输入master节点的host IP。
3. host日志查看
host日志保存在`~/ascend/log`路径下,用户可以到该路径下查看每个host的device日志。
通过该简单的示例您已经完成了多机多卡模型的训练。
# 多机多卡训练
## 常用概念及参数介绍
pytorch分布式训练基本概念
| 基本概念 | 说明 |
| ---------- | ------------------------------------------------------------ |
| AI Server | 带有Ascend 910处理器的计算机,多台计算机用AI Server0+序号表示,如AI Server0、AI Server1。 |
| device | AI Server上Ascend 910卡,多卡用device 0、device 1……device 7表示。 |
| host | AI Server主机。 |
| master | 在多台AI Server选取一台作为master,作为数据通信的主机。 |
| group | 即进程组。默认情况下,只有一个组,采用用默认的就行。 |
| world size | 表示全局的进程并行数,可通过torch.distributed.get_world_size()获取, 在不同进程里,该值是一样的。 |
| rank | 表示当前进的序号, 用于进程间通讯。比如是2x8的集群,world size 就是16,rank在每个进程里依次是0,1,2,…,15。 |
| local_rank | 每台机子上的进程的序号。机器一上有0,1,2,3,4,5,6,7,机器二上也有0,1,2,3,4,5,6,7。一般情况下,你需要用这个local_rank来设置当前模型是跑在当前机器的哪块GPU/NPU上面的。 |
使用torch.distributed.launch启动多卡训练时的参数
| 参数名称 | 说明 |
| ------------------ | ------------------------------------------------------------ |
| **nnodes** | 指定用来分布式训练脚本的节点数 |
| **node_rank** | 多节点分布式训练时,指定当前节点的 rank |
| **nproc_per_node** | 指定当前节点上,使用GPU训练的进程数。建议将该参数设置为当前节点的GPU数量,这样每个进程都能单独控制一个GPU,效率最高。 |
| **master_addr** | master节点(rank为0)的地址,应该为ip地址或者node 0 的 hostname。对于单节点多进程训练的情况,该参数可以设置为 127.0.0.1。 |
| **master_port**: | 指定分布式训练中,master 节点使用的端口号,必须与其他应用的端口号不冲突。 |
## 多机多卡训练流程
### 准备环境
首先您需要具有至少两台AI Server(装有Ascend 910处理器的计算机),并保证每台计算机已安装正确版本的NPU固件和驱动。
1. 准备开发和运行环境。
在每台计算机上分别完成开发和运行环境准备。
- 完成CANN开发和运行环境的安装,请参见《CANN 软件安装指南》,支持5.0.3以后版本。
- 安装适配NPU的PyTorch,安装方法请参见《PyTorch安装指南》。
2. 准备组网。
集群训练由多台装有Ascend 910处理器的计算机完成(最多128台),需要配合交换机组成数据面全连接主备网络,支持8 x n卡训练场景,2台机器可以采用光口直连的方式。搭建方法请参见《[数据中心训练场景组网](https://support.huawei.com/enterprise/zh/doc/EDOC1100221993/229cc0e4)》。
3. 配置device IP
使用hccn_tool工具配置device IP,hccn_tool工具CANN软件以提供。
```shell
hccn_tool -i 0 -ip -s address 192.168.100.111 netmask 255.255.255.0
```
配置device IP需遵守以下规则:
1. AI Server中的第0/4,1/5,2/6,3/7号device需处于同一网段,第0/1/2/3号device在不同网段,第4/5/6/7号device在不同网段。
2. 对于集群场景,各AI Server对应的位置的device需处于同一网段,AI Server0和AI Server1的0号网卡需处于同一网段、1号网卡需要在同一网段
3. 每个IP都不能冲突,相同网段下的IP需在最后8位做区分
使用hccn_tool工具验证device IP是否配置正确。
- 查询每个device的ip。
```shell
hccn_tool -i 0 -ip –g
```
打印查询结果:
> ipaddr:192.168.100.101
>
> netmask:255.255.255.0
- 使用hccn_tool 确保2机器的卡间连通性,从device0 - devcie7 测试8次,确保所有两机间所有卡都连通。
```shell
hccn_tool -i 0 -netdetect -s address xx.xx.xx.xx
hccn_tool -i 0 -net_health –g
```
-i:device序号
-s address:xx.xx.xx.xx是另外一台机器的device i的IP
如果返回`success`则表示已经连通。
4. 配置防火墙
在进行HCCL通信的时候可能出现防火墙拦截通信端口导致通信超时,因此在运行pytorch的集群训练的时候需要注意将服务器上的防火墙关闭。
- Ubuntu系统防火墙关闭命令
```shell
ufw disable
```
- Redhat或CentOS 7系统防火墙关闭命令
```shell
systemctl stop firewalld
```
### 准备模型
准备模型阶段主要有两种方式。
- 从[开源社区](https://gitee.com/ascend/modelzoo/tree/master/built-in/PyTorch)下载PyTorch训练模型
从开源社区获取的模型已经支持单机多卡训练,请用户参照“修改模型”小节需要修改的项目,根据具体模型完成相应修改。
- 手动搭建PyTorch训练模型
1. 准备PyTorch训练模型、数据加载器
准备PyTorch模型。
```python
class ToyModel(nn.Module):
def __init__(self):
...
def forward(self,x):
...
```
准备数据获取方法。
```python
def get_dataset():
transform = torchvision.transforms.Compose([
torchvision.transforms.ToTensor(),
torchvision.transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
])
my_trainset = torchvision.datasets.CIFAR10(root='./data', train=True,
download=True, transform=transform)
trainloader = torch.utils.data.DataLoader(my_trainset,batch_size=16,)
return trainloader
trainloader=get_dataset()
```
2. 实例化模型
```python
# 实例化模型
model = ToyModel().to(loc)
# 加载模型权重
if ckpt_path is not None:
model.load_state_dict(torch.load(ckpt_path))
```
3. 准备损失函数和优化器。
```python
# 初始化优化器,在构造DDP model之后,用model初始化optimizer。
optimizer = torch.optim.SGD(model.parameters(), lr=0.001)
# 初始化损失函数
loss_func = nn.CrossEntropyLoss().to(loc)
```
4. 训练模型
```python
### 3. 网络训练 ###
model.train()
iterator = range(100)
for epoch in iterator:
for data, label in trainloader:
data, label = data.to(local_rank), label.to(local_rank)
optimizer.zero_grad()
prediction = model(data)
loss = loss_func(prediction, label)
loss.backward()
print("loss = %0.3f \n" % loss)
optimizer.step()
torch.save(model.state_dict(), "%d.ckpt" % epoch)
```
### 修改模型
模型修改主要涉及以下6项,包括master ip地址和端口的设置,distributed初始化,模型DDP初始化,数据DDP初始化,优化器初始化,DDP模型训练方法修改。请用户结合初始模型代码,灵活修改。
1. 设置master ip地址和端口,在NPU进行分布式训练使用HCCL进行通信,在PyTorch中使用的是自动拓扑探测的HCCL通信机制,即不需要使用RANK_TABLE_FLIE,但是其依赖于host侧的网卡进行通信,因此需要在代码中设置环境变量来设置通信网卡。
```python
os.environ['MASTER_ADDR'] = xxx.xxx.xxx.xxx
os.environ['MASTER_PORT'] = 'xxx'
```
MASTER_ADDR:设置为集群中master的IP(任意挑选一台作为master即可)
MASTER_PORT:设置为master的一个空闲端口
master ip地址和端口在模型代码中一般会设置为传参的形式,也有可能某些开源代码中设置为"127.0.0.1",需要进行修改。
上述变量需在调用torch.distributed.init_process_group()之前声明。
2. distributed初始化
PyTorch中使用`dist.init_process_group(backend='hccl', world_size=world_size, rank=rank)`来初始化线程组其中参数含义如下。
`backend`:进行分布式训练的使用的通信协议,在NPU上只能使用"hccl"
`world_size`:进行训练时使用的device的总数
`rank`: 当前初始化的device的rank_id,也就是全局的逻辑ID
有两种方法启动多卡训练,分别初始化的方法如下。
- 使用torch.distributed.launch启动多卡训练。
```python
import torch.distributed as dist
dist.init_process_group(backend='hccl') # hccl是NPU设备上的后端
```
- 使用mp.spawn启动多卡训练。
```python
import torch.distributed as dist
def main_worker(pid_idx, device_nums_per_node, args):
args.distributed_rank = args.rank * device_nums_per_node + pid_idx
dist.init_process_group(backend=args.dist_backend, world_size=args.distributed_world_size, rank=args.distributed_rank)
```
其中:
`pid_idx`:device序号。
`device_nums_per_node`:每个AI Server的device数量。
3. 模型DDP初始化
```python
# 实例化模型
model = ToyModel().to(loc)
# 加载模型权重,在构造DDP模型之前,且只需要在master上加载。
if dist.get_rank() == 0 and ckpt_path is not None:
model.load_state_dict(torch.load(ckpt_path))
# 构造DDP model
model = DDP(model, device_ids=[local_rank], output_device=local_rank)
```
4. 数据DDP初始化
```python
def get_dataset():
transform = torchvision.transforms.Compose([
torchvision.transforms.ToTensor(),
torchvision.transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
])
my_trainset = torchvision.datasets.CIFAR10(root='./data', train=True,
download=True, transform=transform)
train_sampler = torch.utils.data.distributed.DistributedSampler(my_trainset)
trainloader = torch.utils.data.DataLoader(my_trainset,
batch_size=16, num_workers=2, sampler=train_sampler)
return trainloader
trainloader = get_dataset()
```
5. 损失方法、优化器。
```python
# 初始化优化器,在构造DDP model之后,用model初始化optimizer。
optimizer = torch.optim.SGD(model.parameters(), lr=0.001)
# 初始化损失函数
loss_func = nn.CrossEntropyLoss().to(loc)
```
6. DDP模型训练
```python
model.train()
iterator = range(100)
for epoch in iterator:
# 设置epoch
trainloader.sampler.set_epoch(epoch)
for data, label in trainloader:
data, label = data.to(local_rank), label.to(local_rank)
optimizer.zero_grad()
prediction = model(data)
loss = loss_func(prediction, label)
loss.backward()
print("loss = %0.3f \n" % loss)
optimizer.step()
# 1. save模型的时候,和DP模式一样,有一个需要注意的点:保存的是model.module而不是model。
# 因为model其实是DDP model,参数是被`model=DDP(model)`包起来的。
# 2. 只需要在进程0上保存一次就行了,避免多次保存重复的东西。
if dist.get_rank() == 0:
torch.save(model.module.state_dict(), "%d.ckpt" % epoch)
```
### 启动训练
启动训练提供两种方式,手动启动和shell脚本启动
- 手动启动(使用torch.distributed.launch方式启动)
1. 配置NPU 环境变量,请参考附录提供的env_npu.sh脚本
2. 添加环境变量,多机训练需要增加`HCCL_WHITELIST_DISABLE`和`HCCL_IF_IP`环境变量。
- HCCL_WHITELIST_DISABLE:HCCL通道白名单,一般性设置为1表示关闭白名单。
- HCCL_IF_IP:HCCL初始化通信网卡IP,设置为当前服务器的host网卡IP。
3. 将修改的模型脚本上传至每个AI Server
4. 在每个AI Server上安装必要Python库
5. 任选一个AI Server作为masker节点,并查询每个AI Server的IP。
6. 在每个AI server服务器上启动命令
```
python3 -m torch.distributed.launch --nnodes=${nnodes} --node_rank=i --nproc_per_node 8 --master_addr 192.168.xx.22 --master_port 29501 main.py --addr 192.168.xx.22
```
其中:
--nnodes:用来分布式训练脚本的AI server数。
--node_rank:AI server的序号,每个AI server有对应的序号。
--nproc_per_node:每个AI server的device数量。
--master_addr:作为maskter节点的AI server IP地址。
--master_port: 作为maskter节点的AI server 端口号。
main.py:请修改为启动脚本名称。
--addr :传入启动脚本的参数,master IP地址。
- 使用OpenMPI启动
1. 安装 OpenMPI开源库
多机多卡环境下分布式训练部署依赖于OpenMPI开源库,参与模型训练的每台服务器都需要安装OpenMPI开源库。目前OpenMPI开源库的版本要求为4.0.1、4.0.2或4.0.3。
执行`mpirun --version`命令检查是否已安装OpenMPI。如果返回`mpirun (Open MPI) 4.0.2 Report bugs to http://www.open-mpi.org/community/help/` ,说明已经安装。如果已安装,且版本为4.0.1、4.0.2或4.0.3其中一个,则无需再安装。
否则请按照如下步骤安装OpenMPI:
1. 访问如下链接下载OpenMPI软件包。例如openmpi-4.0.2.tar.bz2。
https://www.open-mpi.org/software/ompi/v4.0/
2. 以root用户登录安装环境。
3. 将下载的OpenMPI软件包上传到安装环境的某一目录下。
4. 进入软件包所在目录,执行如下命令解压软件包。
```shell
tar -jxvf openmpi-4.0.2.tar.bz2
```
5. 进入解压后的目录,执行如下命令配置、编译和安装。
```shell
./configure --prefix=/usr/local/mpirun4.0.2
make
make install
```
其中“--prefix”参数用于指定OpenMPI安装路径,用户根据实际情况进行修改。
6. 执行vi ~/.bashrc命令,打开.bashrc文件,在文件的最后添加如下环境变量。
```shell
export OPENMPI=/usr/local/mpirun4.0.2
export LD_LIBRARY_PATH=$OPENMPI/lib
export PATH=$OPENMPI/bin:$PATH
```
其中“/usr/local/mpirun4.0.2”为OpenMPI安装路径,用户需要根据实际进行修改。
执行:wq!命令保存文件并退出。
7. 执行如下命令使环境变量生效。
```
source ~/.bashrc
```
8. 安装完成之后,执行如下命令查看安装版本,如果返回正确的版本信息,则说明安装成功。
```
mpirun --version
```
2. 配置AI Server SSH免密登录
如果使用OpenMPI在多机多卡环境下分布式训练部署,需要在每两台服务器之间配置SSH免密登录,确保服务器之间可以互通。具体操作步骤如下:
1. 以root用户登录每台服务器。
2. 配置集群中主机间的可信度。
打开并编辑**/etc/ssh/ssh_config**文件,在文件最后增加如下字段:
```
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
```
3. 在每台服务器上分别打开**/etc/hosts**文件,在该文件中添加本服务器对应的IP地址和主机名,且需要添加到该文件的首行。如果文件中已添加,则跳过此步骤。添加内容示例如下:
```
xxx.xxx.xxx.111 ubuntu
```
其中xxx.xxx.xxx.111为该服务器的IP地址,ubuntu为主机名。
4. 在第一台服务器执行如下命令生成公钥(例如第一台服务器IP为xxx.xxx.xxx.111)。
```
cd ~/.ssh/ # 若没有该目录,请先执行一次ssh localhost
ssh-keygen -t rsa # 生成秘钥,会出现提示,连续点击3次"Enter"即可
mv id_rsa.pub authorized_keys # 将生成的秘钥id_rsa.pub重命名为公钥authorized_keys
```
5. 在其他每台服务器上都生成秘钥,并复制到第一台服务器的authorized_keys文件中。
1. 在其他每台服务器上执行如下命令生成秘钥。
cd ~/.ssh/
ssh-keygen -t rsa
2. 将其他每台服务器上生成的秘钥文件id_rsa.pub下载到本地,并复制该文件中的秘钥。
3. 在第一台服务器内执行如下命令打开公钥文件authorized_keys,将[5.b](#li361025101116 "link to:#li361025101116
ctrl +click to jump")复制的其他每台服务器的秘钥粘贴到第一台服务器的公钥后面。
```
vi ~/.ssh/authorized_keys
```
执行**:wq!**保存该文件。
6. 在其他每台服务器上执行如下命令将第一台服务器制作好的公钥复制到其他每台服务器内。
cd ~/.ssh/
scp root@xxx.xxx.xxx.111:~/.ssh/authorized_keys ./
7. 在每台服务器执行如下命令测试免密登录。
```
ssh 用户名@IP地址
```
例如:在第一台服务器xxx.xxx.xxx.111免密登录服务器xxx.xxx.xxx.222,执行**ssh root@xxx.xxx.xxx.222**命令。
若显示类似如下信息,说明已免密登录服务器xxx.xxx.xxx.222。
```
Linux ubuntu 4.19.28 #1 SMP Tue Jun 23 19:05:23 EDT 2020 x86_64
The programs included with the ubuntu GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
ubuntu GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Sep 15 14:37:21 2020 from 10.254.88.75
```
执行**exit**命令可以退出登录,若显示类似如下信息,说明已退出登录。
```
logout
Connection to xxx.xxx.xxx.222 closed.
```
3. 使用OpenMPI拉起模型训练。
1. 分别为每一个AI server编写启动脚本,如train.sh,并将启动脚本分别移到相应AI server的同一路径下。
```
# 配置NPU环境变量,env_npu.sh脚本参见附录
source env_npu.sh
#关闭HCCL通道白名单
export HCCL_WHITELIST_DISABLE=1
# HCCL初始化通信网卡IP,设置为当前服务器的host IP
export HCCL_IF_IP=xxx.xxx.xx.xxx
python3 -m torch.distributed.launch --nnodes=${nnodes} --node_rank=i --nproc_per_node 8 --master_addr xxx.xxx.xx.xxx --master_port 29501 main.py --addr xxx.xxx.xx.xxx
```
脚本参数请参见手动启动。
2. 编写启动脚本
```
# 配置mpirun环境变量
export PATH=$PATH:/usr/local/mpirun4.0.2/bin
# 执行mpirun工具
mpirun -H xxx.xxx.xxx.xxx:1,xxx.xxx.xxx.xxx:1 \
--bind-to none -map-by slot \
--mca btl_tcp_if_exclude lo,docker0,endvnic\
--allow-run-as-root \
--prefix /usr/local/mpirun4.0.2/ \
./train.sh
```
其中
-H:每个AI server的IP:启动进程数。
--bind-to:绑定进程的策略。
--mca:特定上下文的MCA参数,arg0为参数名,arg1为参数值。
--allow-run-as-root:允许使用root用户运行。
--prefix:mpirun4.0.2路径。
./train.sh:各个AI server的启动脚本路径。
4.
训练成功后可以查看日志信息。
host日志保存在`~/ascend/log`路径下,用户可以到该路径下查看每个host的device日志。
# 附录
NPU环境变量配置脚本env_npu.sh,可使用该脚本进行运行和开发环境变量的配置。
```shell
#!/bin/bash
export install_path=/usr/local/Ascend
if [ -d ${install_path}/toolkit ]; then
export LD_LIBRARY_PATH=/usr/include/hdf5/lib/:/usr/local/:/usr/local/lib/:/usr/lib/:${install_path}/fwkacllib/lib64/:${install_path}/driver/lib64/common/:${install_path}/driver/lib64/driver/:${install_path}/add-ons:${path_lib}:${LD_LIBRARY_PATH}
export PATH=${install_path}/fwkacllib/ccec_compiler/bin:${install_path}/fwkacllib/bin:$PATH
export PYTHONPATH=${install_path}/fwkacllib/python/site-packages:${install_path}/tfplugin/python/site-packages:${install_path}/toolkit/python/site-packages:$PYTHONPATH
export PYTHONPATH=/usr/local/python3.7.5/lib/python3.7/site-packages:$PYTHONPATH
export ASCEND_OPP_PATH=${install_path}/opp
else
if [ -d ${install_path}/nnae/latest ];then
export LD_LIBRARY_PATH=/usr/local/:/usr/local/python3.7.5/lib/:/usr/local/openblas/lib:/usr/local/lib/:/usr/lib64/:/usr/lib/:${install_path}/nnae/latest/fwkacllib/lib64/:${install_path}/driver/lib64/common/:${install_path}/driver/lib64/driver/:${install_path}/add-ons/:/usr/lib/aarch64_64-linux-gnu:$LD_LIBRARY_PATH
export PATH=$PATH:${install_path}/nnae/latest/fwkacllib/ccec_compiler/bin/:${install_path}/nnae/latest/toolkit/tools/ide_daemon/bin/
export ASCEND_OPP_PATH=${install_path}/nnae/latest/opp/
export OPTION_EXEC_EXTERN_PLUGIN_PATH=${install_path}/nnae/latest/fwkacllib/lib64/plugin/opskernel/libfe.so:${install_path}/nnae/latest/fwkacllib/lib64/plugin/opskernel/libaicpu_engine.so:${install_path}/nnae/latest/fwkacllib/lib64/plugin/opskernel/libge_local_engine.so
export PYTHONPATH=${install_path}/nnae/latest/fwkacllib/python/site-packages/:${install_path}/nnae/latest/fwkacllib/python/site-packages/auto_tune.egg/auto_tune:${install_path}/nnae/latest/fwkacllib/python/site-packages/schedule_search.egg:$PYTHONPATH
export ASCEND_AICPU_PATH=${install_path}/nnae/latest
else
export LD_LIBRARY_PATH=/usr/local/:/usr/local/lib/:/usr/lib64/:/usr/lib/:/usr/local/python3.7.5/lib/:/usr/local/openblas/lib:${install_path}/ascend-toolkit/latest/fwkacllib/lib64/:${install_path}/driver/lib64/common/:${install_path}/driver/lib64/driver/:${install_path}/add-ons/:/usr/lib/aarch64-linux-gnu:$LD_LIBRARY_PATH
export PATH=$PATH:${install_path}/ascend-toolkit/latest/fwkacllib/ccec_compiler/bin/:${install_path}/ascend-toolkit/latest/toolkit/tools/ide_daemon/bin/
export ASCEND_OPP_PATH=${install_path}/ascend-toolkit/latest/opp/
export OPTION_EXEC_EXTERN_PLUGIN_PATH=${install_path}/ascend-toolkit/latest/fwkacllib/lib64/plugin/opskernel/libfe.so:${install_path}/ascend-toolkit/latest/fwkacllib/lib64/plugin/opskernel/libaicpu_engine.so:${install_path}/ascend-toolkit/latest/fwkacllib/lib64/plugin/opskernel/libge_local_engine.so
export PYTHONPATH=${install_path}/ascend-toolkit/latest/fwkacllib/python/site-packages/:${install_path}/ascend-toolkit/latest/fwkacllib/python/site-packages/auto_tune.egg/auto_tune:${install_path}/ascend-toolkit/latest/fwkacllib/python/site-packages/schedule_search.egg:$PYTHONPATH
export ASCEND_AICPU_PATH=${install_path}/ascend-toolkit/latest
fi
fi
#将Host日志输出到串口,0-关闭/1-开启
export ASCEND_SLOG_PRINT_TO_STDOUT=0
#设置默认日志级别,0-debug/1-info/2-warning/3-error
export ASCEND_GLOBAL_LOG_LEVEL=3
#设置Event日志开启标志,0-关闭/1-开启
export ASCEND_GLOBAL_EVENT_ENABLE=0
#设置是否开启taskque,0-关闭/1-开启
export TASK_QUEUE_ENABLE=1
#HCCL白名单开关,1-关闭/0-开启
export HCCL_WHITELIST_DISABLE=1
#设置device侧日志登记为error
${install_path}/driver/tools/msnpureport -g error -d 0
${install_path}/driver/tools/msnpureport -g error -d 1
${install_path}/driver/tools/msnpureport -g error -d 2
${install_path}/driver/tools/msnpureport -g error -d 3
${install_path}/driver/tools/msnpureport -g error -d 4
${install_path}/driver/tools/msnpureport -g error -d 5
${install_path}/driver/tools/msnpureport -g error -d 6
${install_path}/driver/tools/msnpureport -g error -d 7
#关闭Device侧Event日志
${install_path}/driver/tools/msnpureport -e disable
path_lib=$(python3.7 -c """
import sys
import re
result=''
for index in range(len(sys.path)):
match_sit = re.search('-packages', sys.path[index])
if match_sit is not None:
match_lib = re.search('lib', sys.path[index])
if match_lib is not None:
end=match_lib.span()[1]
result += sys.path[index][0:end] + ':'
result+=sys.path[index] + '/torch/lib:'
print(result)"""
)
echo ${path_lib}
export LD_LIBRARY_PATH=/usr/local/python3.7.5/lib/:${path_lib}:$LD_LIBRARY_PATH
```
@@ -0,0 +1,318 @@
# PyTorch毕昇C++算子开发指南
- [简介](#简介md)
- [环境准备](#环境准备md)
- [C++ Extension方式开发算子](#Extension方式开发算子md)
- [环境准备](#环境准备md)
- [示例:add算子实现](#add算子md)
- [示例:add算子编译](#add算子安装代码md)
- [示例:add算子测试](#add算子测试md)
- [框架联合编译方式开发算子](#框架联合编译方式开发算子md)
- [FAQ](#FAQmd)
- [示例add算子编译失败](#python-setup_py-install失败md)
- [示例add算子测试失败](#python-test_add_bisheng_py失败md)
<h2 id="简介md">简介</h2>
毕昇C++提供了面向昇腾芯片的通用编程模型抽象,让开发者可以使用标准C++语法编写适用于昇腾芯片的算子。
昇腾PyTorch支持C++ Extension和框架联合编译两种方式开发毕昇C++算子,该文档介绍了怎么在PyTorch中使用毕昇C++开发算子。
<h2 id="环境准备md">环境准备</h2>
在PyTorch框架中开发毕昇C++算子环境准备包括两部分内容:一是CANN和毕昇C++的安装,二是PyTorch框架安装:
- CANN和毕昇C++的安装:当前毕昇C++内置于CANN 6.3.T100版本,安装CANN时同时安装毕昇C++,使用CANN内置脚本配置CANN环境变量时会同时配置毕昇C++环境变量。
- CANN 6.3.T100下载地址及毕昇C++文档请参考:[CANN 6.3.T100(毕昇C++)安装包及文档](https://support.huawei.com/enterprise/zh/ascend-computing/cann-pid-251168373/software/259218207?idAbsPath=fixnode01%7C23710424%7C251366513%7C22892968%7C251168373);
- CANN安装请参考昇腾社区文档中环境安装环节[《CANN软件安装》](https://www.hiascend.com/document?tag=community-developer)
- 安装后运行CANN安装目录下的`set_env.sh`自动配置CANN和毕昇C++相关环境变量。
安装CANN并完成环境变量配置后可以查看CANN和毕昇C++的环境变量:
```
echo $BISHENG_CPP_HOME
echo $ASCEND_HOME_PATH
```
- 参考README里编译安装原生PyTorch和昇腾PyTorch
<h2 id="Extension方式开发算子md">C++ Extension方式开发算子</h2>
<h3 id="环境准备md">环境准备</h3>
参考前文安装CANN、毕昇C++和PyTorch,并配置环境变量
<h3 id="add算子md">示例:add算子实现</h3>
add_bisheng.cpp
```
// Copyright (c) 2023 Huawei Technologies Co., Ltd
// All rights reserved.
//
// Licensed under the BSD 3-Clause License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/BSD-3-Clause
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <sycl/sycl.hpp>
#include <acl/acl.h>
#include <torch/extension.h>
#include <torch_npu/csrc/core/npu/NPUStream.h>
using namespace at;
using namespace sycl;
using namespace sycl::access;
template <typename T>
using LocalAccessor = accessor<T, 1, mode::read_write, target::local>;
template <typename T, int group_count, typename kernel_name>
void add_bisheng_kernel(queue &sycl_queue, const T *in1, const T *in2, T *out, size_t length) {
sycl_queue.submit([&](handler &cgh)
{
LocalAccessor<T> local_in1(length, cgh);
LocalAccessor<T> local_in2(length, cgh);
LocalAccessor<T> local_out(length, cgh);
cgh.parallel_for_work_group<kernel_name>(sycl::range<1> { group_count }, [=](group<1> grp) {
const auto gid = grp.get_id(0);
const auto idx_base = gid * length;
[[loop::parallel]] for (size_t i = 0; i < length; ++i) {
local_in1[i] = in1[i + idx_base];
local_in2[i] = in2[i + idx_base];
local_out[i] = local_in1[i] + local_in2[i];
out[i + idx_base] = local_out[i];
}
}); });
sycl_queue.wait();
}
template <class T, class kernel_name>
Tensor add_bisheng_launch(const Tensor &self, const Tensor &other) {
Tensor result = at::empty(self.sizes(), self.options());
const T *self_ptr = static_cast<T *>(self.storage().data_ptr().get());
const T *other_ptr = static_cast<T *>(other.storage().data_ptr().get());
T *result_ptr = static_cast<T *>(result.storage().data_ptr().get());
aclrtContext acl_context;
aclrtGetCurrentContext(&acl_context);
sycl::context sycl_context = sycl::make_context<sycl::backend::cce>(acl_context);
int device_id = 0;
aclrtGetDevice(&device_id);
auto npu_stream = c10_npu::getCurrentNPUStream(device_id);
auto acl_stream = npu_stream.stream();
queue sycl_queue = sycl::make_queue<sycl::backend::cce>(acl_stream, sycl_context);
const T *input1 = self_ptr;
const T *input2 = other_ptr;
constexpr size_t group_count = 1;
size_t len = result.numel() / group_count;
add_bisheng_kernel<T, group_count, kernel_name>(sycl_queue, input1, input2, result_ptr, len);
return result;
}
Tensor add_bisheng(const Tensor &self, const Tensor &other) {
if (self.scalar_type() == at::kHalf) {
return add_bisheng_launch<half, class addhalf>(self, other);
} else if (self.scalar_type() == at::kFloat) {
return add_bisheng_launch<float, class addfloat>(self, other);
} else {
return add_bisheng_launch<int64_t, class addint>(self, other);
}
}
PYBIND11_MODULE(add_bisheng, m) {
m.def("add", &add_bisheng, "x + y");
}
```
<h3 id="add算子安装代码md">示例:add算子编译</h3>
python setup.py install
```
# Copyright (c) 2023 Huawei Technologies Co., Ltd
# All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://opensource.org/licenses/BSD-3-Clause
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from setuptools import setup
from torch.utils.cpp_extension import BuildExtension
from torch_npu.utils.cpp_extension import BiShengExtension
setup(
name='add_bisheng',
ext_modules=[
BiShengExtension(
name='add_bisheng',
sources=['add_bisheng.cpp']),
],
cmdclass={
'build_ext': BuildExtension
})
```
<h3 id="add算子测试md">示例:add算子测试</h3>
python test_add_bisheng.py
```
# Copyright (c) 2023 Huawei Technologies Co., Ltd
# All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://opensource.org/licenses/BSD-3-Clause
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import time
import torch
import torch_npu
JIT_COMPILE_EXTENSION = True
if JIT_COMPILE_EXTENSION:
from torch_npu.utils.cpp_extension import load
module = load(name="add_bisheng", sources=["./add_bisheng.cpp"], verbose=1)
else:
# python setup.py install
import add_bisheng as module
torch.manual_seed(0)
npu_device = os.environ.get('SET_NPU_DEVICE')
if npu_device is None:
torch.npu.set_device("npu:0")
else:
torch.npu.set_device(f"npu:{npu_device}")
a = torch.rand(2, 10).npu()
b = torch.rand(2, 10).npu()
print("A: " + str(a))
print("B: " + str(b))
add_result = module.add(a, b)
print("add_result: " + str(add_result))
print("\n")
a = torch.randint(0, 10, (2, 10)).npu()
b = torch.randint(0, 10, (2, 10)).npu()
print("A int: " + str(a))
print("B int: " + str(b))
add_result = module.add(a, b)
print("add_result int: " + str(add_result))
print("\n")
a = torch.rand(2, 10).half()
b = torch.rand(2, 10).half()
a = a.npu()
b = b.npu()
print("A half: " + str(a))
print("B half: " + str(b))
add_result = module.add(a, b)
print("add_result half: " + str(add_result))
```
<h2 id="框架联合编译方式开发算子md">框架联合编译方式开发算子</h2>
- 在torch_npu/csrc/aten/npu_native_functions.yaml增加接口定义, 参考:bscpp_add
```
- func: bscpp_add(Tensor self, Tensor other) -> Tensor
bscpp_op: True
```
- 在torch_npu/csrc/aten/bscpp_ops目录下增加算子实现CPP文件,参考:AddKernel.cpp
- 编译框架:
```
# BSCPP_SYCL_TARGET设置请参考毕昇C++文档
BSCPP_OPS_ENABLE=1 BSCPP_SYCL_TARGET=ascend_910-cce bash ci/build.sh
```
- 安装框架:
```
pip install --upgrade --force-reinstall dist/*.whl
```
<h2 id="FAQmd">FAQ</h2>
- **[示例add算子编译失败](#python-setup_py-install失败md)**
- **[示例add算子测试失败](#python-test_add_bisheng_py失败md)**
<h3 id="python-setup_py-install失败md">示例add算子编译失败</h3>
#### 现象描述
/opt/BiShengCPP/bin/clang: error while loading shared libraries: libtinfo.so.6: cannot open shared object file: No such file or directory
#### 处理方法
复制libtinfo.so.6到 ${BISHENTCPP_ROOT}/lib
```
(***111) root@ubuntu:/home/***/add_bisheng# find / -name "libtinfo.so.6"
/root/miniconda3/pkgs/ncurses-6.3-h2f4d8fa_2/lib/libtinfo.so.6
/root/miniconda3/pkgs/ncurses-6.3-h998d150_3/lib/libtinfo.so.6
/root/miniconda3/envs/pt181/lib/libtinfo.so.6
/root/miniconda3/envs/pt111/lib/libtinfo.so.6
/root/miniconda3/envs/***111/lib/libtinfo.so.6
/root/miniconda3/lib/libtinfo.so.6
/home/syf/miniconda3/pkgs/ncurses-6.3-h2f4d8fa_2/lib/libtinfo.so.6
/home/syf/miniconda3/pkgs/ncurses-6.3-h998d150_3/lib/libtinfo.so.6
/home/syf/miniconda3/lib/libtinfo.so.6
(***111) root@ubuntu:/home/***/add_bisheng# cp /root/miniconda3/lib/libtinfo.so.6 ${BISHENTCPP_ROOT}/lib
```
<h3 id="python-test_add_bisheng_py失败md">示例add算子测试失败</h3>
#### 现象描述
```
ERROR: setUpClass (__main__.test_add_bisheng)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/miniconda3/envs/***111/lib/python3.7/site-packages/torch_npu/testing/testcase.py", line 71, in setUpClass
self.npu_device = set_npu_device()
File "/root/miniconda3/envs/***111/lib/python3.7/site-packages/torch_npu/testing/common_utils.py", line 83, in set_npu_device
torch.npu.set_device(npu_device)
File "/root/miniconda3/envs/***111/lib/python3.7/site-packages/torch_npu/npu/utils.py", line 149, in set_device
torch_npu._C._npu_setDevice(torch.device(device).index)
RuntimeError: Initialize:/home/***/PyTorch/torch_npu/csrc/core/npu/sys_ctrl/npu_sys_ctrl.cpp:97 NPU error, error code is 507033
EL0003: The argument is invalid.
Solution: Try again with a valid argument.
TraceBack (most recent call last):
Failed to open device, retCode=0x7020014, deviceId=0.[FUNC:Init][FILE:device.cc][LINE:227]
Check param failed, dev can not be NULL![FUNC:DeviceRetain][FILE:runtime.cc][LINE:2133]
Check param failed, dev can not be NULL![FUNC:PrimaryContextRetain][FILE:runtime.cc][LINE:1946]
Check param failed, ctx can not be NULL![FUNC:PrimaryContextRetain][FILE:runtime.cc][LINE:1973]
Check param failed, context can not be null.[FUNC:NewDevice][FILE:api_impl.cc][LINE:1315]
new device failed, retCode=0x7010006[FUNC:SetDevice][FILE:api_impl.cc][LINE:1336]
rtSetDevice execute failed, reason=[device retain error][FUNC:FuncErrorReason][FILE:error_message_manage.cc][LINE:49]
open device 0 failed, runtime result = 507033.[FUNC:ReportCallError][FILE:log_inner.cpp][LINE:161]
ctx is NULL![FUNC:GetDevErrMsg][FILE:api_impl.cc][LINE:3490]
rtGetDevMsg execute failed, reason=[context pointer null][FUNC:FuncErrorReason][FILE:error_message_manage.cc][LINE:49]
```
#### 处理方法
export SET_NPU_DEVICE=1
@@ -200,7 +200,7 @@ PyTorch算子开发包含TBE算子开发和PyTorch框架下的算子适配。
<h4 id="概述md">概述</h4>
当前制定的NPU适配派发原则是NPU算子的派发不经过框架公共函数,直接派发成NPU适配的函数,即算子执行调用栈中只包含NPU适配的函数调用,不包含框架公共函数。PyTorch框架在编译时,会根据 native\_functions.yaml 的定义,按框架中定义的类型和设备分发原则,生成相应的新算子的中间层的调用说明。对于NPU,会生成在 build/aten/src/ATen/NPUType.cpp。
当前制定的NPU适配派发原则是NPU算子的派发不经过框架公共函数,直接派发成NPU适配的函数,即算子执行调用栈中只包含NPU适配的函数调用,不包含框架公共函数。PyTorch框架在编译时,会根据 native\_functions.yaml 的定义,按框架中定义的类型和设备分发原则,生成相应的新算子的中间层的调用说明。对于NPU,会生成在 torch_npu/csrc/aten/RegisterNPU.cpp。
<h4 id="PyTorch1-8-1-注册算子开发md">PyTorch1.8.1 注册算子开发</h4>
@@ -208,7 +208,7 @@ PyTorch算子开发包含TBE算子开发和PyTorch框架下的算子适配。
1. 打开native\_functions.yaml文件。
native\_functions.yaml 文件中,定义了所有算子函数原型,包括函数名称和参数等信息,每个算子函数支持不同硬件平台的派发信息。该文件所在路径为pytorch/aten/src/ATen/native/native\_functions.yaml。
native\_functions.yaml 文件中,定义了所有算子函数原型,包括函数名称和参数等信息,每个算子函数支持不同硬件平台的派发信息。该文件所在路径为scripts/codegen/native\_functions.yaml。
2. 确定需要派发函数。
- yaml 中已存在的算子
@@ -446,7 +446,7 @@ custom_autograd: # 自定义继承自Function的自定义算子
at::Tensor result = OpPreparation::ApplyTensorWithFormat(
outputSize,
outputTensor.options(),
CalcuOpUtil::get_tensor_npu_format(outputTensor));
CalcuOpUtil::GetTensorNpuFormat(outputTensor));
// calculate the output result of the NPU
add_out_npu_nocheck(result, self, other, alpha);
@@ -462,7 +462,7 @@ custom_autograd: # 自定义继承自Function的自定义算子
auto outputSize = input_same_output_size(self);
// construct the output tensor of the NPU
at::Tensor result = OpPreparation::ApplyTensorWithFormat(
outputSize, self.options(), CalcuOpUtil::get_tensor_npu_format(self));
outputSize, self.options(), CalcuOpUtil::GetTensorNpuFormat(self));
// calculate the output result of the NPU
adds_out_npu_nocheck(result, self, other, alpha);
@@ -480,7 +480,7 @@ custom_autograd: # 自定义继承自Function的自定义算子
{
c10::SmallVector<at::Tensor, N> inputs = {self, other};
c10::SmallVector<at::Tensor, N> outputs = {self};
CalcuOpUtil::check_memory_over_laps(inputs, outputs);
CalcuOpUtil::CheckMemoryOverLaps(inputs, outputs);
if (!NpuUtils::check_match(&self))
{
@@ -524,7 +524,7 @@ custom_autograd: # 自定义继承自Function的自定义算子
at::Scalar alpha,
at::Tensor &result)
{
bool isSelfWrapped = CalcuOpUtil::is_scalar_wrapped_to_tensor(self);
bool isSelfWrapped = CalcuOpUtil::IsScalarWrappedToTensor(self);
at::Tensor outputTensor;
if (not isSelfWrapped)
@@ -539,7 +539,7 @@ custom_autograd: # 自定义继承自Function的自定义算子
OpPreparation::CheckOut(
{self},
result,
CalcuOpUtil::get_tensor_npu_format(result),
CalcuOpUtil::GetTensorNpuFormat(result),
outputTensor.scalar_type(),
outputSize);
@@ -688,7 +688,7 @@ pip3 install --upgrade torch_npu-1.8.1rc1-cp37-cp37m-linux_{arch}.whl
3. 执行测试用例脚本
进入test\_add.py所在的目录,执行:
进入test\_add.py所在的目录/test/test_network_ops,执行:
```
python3.7 test_add.py
@@ -831,7 +831,7 @@ pip3.7 install torchvision --no-deps
至此步骤,不应该有错误,屏幕应该输出 "add" 中增加的日志打印。若出错,请完成代码清理排查,保证无新开发的代码影响测试。
3. 将新开发的“自定义TBE算子”合并到"cann"中,在对应的在算子入口增加日志打印,作为运行标识。
4. 完成上面的"cann"编译、安装,调用“python3.7.5 test\_add.py”进行测试。
4. 完成上面的"cann"编译、安装,调用“python3.7 test\_add.py”进行测试。
>![](public_sys-resources/icon-note.gif) **说明:**
>根据Ascend的设计逻辑,用户开发安装的“custom”算子包优先级高于“built-in”的内置算子包,在运行加载时,会优先加载调度“custom”包中的算子。过程中,若解析“custom”中的算子信息文件失败,则会跳过“custom”算子包,不加载调度任何“custom”算子包中的任何算子。
@@ -839,11 +839,11 @@ pip3.7 install torchvision --no-deps
>- 若此步骤出错,或屏幕未输出 "add" 中增加的日志打印,则说明新开发的“自定义TBE算子”有错误,影响了“自定义算子包”的加载,建议**优先排查新开发的“自定义TBE算子”中的“算子信息定义”是否正确**。
>- 若此步骤正确,至少说明 **新开发的“自定义TBE算子”中的“算子信息定义”不影响运行**。
5. 调用“python3.7.5 xxx\_testcase.py”进行测试;
5. 调用“python3.7 xxx\_testcase.py”进行测试,xxx为新增算子名称;
>![](public_sys-resources/icon-note.gif) **说明:**
>- 若屏幕正常输出新开发的“自定义TBE算子”中增加的日志打印,则至少说明调度到了新开发的算子。
>- 若屏幕未输出新开发的“自定义TBE算子”中增加的日志打印,则问题可能出现在“PyTorch适配”中,需要排查这一部分的实现代码,较多的可能会出现在“XxxxKernelNpu.cpp”中的输入、输出未能正确适配。
>- 若屏幕未输出新开发的“自定义TBE算子”中增加的日志打印,则问题可能出现在“PyTorch适配”中,需要排查这一部分的实现代码,较多的可能会出现在“XxxxKernelNpu.cpp”中的输入、输出未能正确适配,XxxxKernelNpu.cpp为新增算子信息文件。
@@ -859,7 +859,7 @@ pip3.7 install torchvision --no-deps
1. 打开安装在用户目录下的算子包安装目录。
```
cd ~/.local/Ascend/opp/op_impl/built-in/ai_core/tbe/impl
cd /usr/local/Ascend/ascend-toolkit/op_impl/build-in/ai_core/tbe/config/ascend910/
ll
```
@@ -0,0 +1,366 @@
# **PyTorch精度对比和溢出检测工具使用指南**
- [**PyTorch精度对比工具使用指南**](#pytorch精度对比工具使用指南)
- [**使用场景**](#使用场景)
- [**前提条件**](#前提条件)
- [**注意事项**](#注意事项)
- [**精度比对基本原理**](#精度比对基本原理)
- [**算子匹配条件**](#算子匹配条件)
- [**计算精度评价指标**](#计算精度评价指标)
- [**快速上手样例参考**](#快速上手样例参考)
## **使用场景**
在同一模型或算子调试过程中,遇到算子相关的计算精度问题,定位时费时费力,所以推出了一个精度比对工具。
精度对比工具,通过在PyTorch模型中注入hook,跟踪计算图中算子的前向传播与反向传播时的输入与输出,排查存在计算精度误差,进行问题的精准定位。
主要的使用场景包括:
- 同一模型,从cpu(或npu)移植到npu中存在精度下降问题,对比npu芯片中的算子计算数值与cpu芯片中的算子计算数值,进行问题定位。
- 同一模型,进行迭代(模型、算子或设备迭代)时存在的精度下降问题,对比相同模型在迭代前后版本的算子计算数值,进行问题定位。
以gpu为参照定位精度问题,使用ptdbg_ascend插件来进行数据dump和比对,请参考[ptdbg_ascend](https://gitee.com/ascend/tools/tree/master/ptdbg_ascend)。
## **前提条件**
已完成PyTorch Adapter插件的编译安装,具体操作请参考[《AscendPyTorch安装指南》](../PyTorch安装指南/PyTorch安装指南.md)。
## **注意事项**
训练脚本中使用torch.utils.data.DataLoader加载数据时,请将num_workers参数设为0。
```python
from torch.utils.data import DataLoader
loader=DataLoader(...,num_workers=0,...)
```
## **精度比对基本原理**
普遍适用的方法是以模型为单位,采用hook机制挂在模型的上。当模型在CPU上进行正向传播时跟踪并dump每一层的数值输入与输出,在反向传播时跟踪并dump每一层的梯度输入值与输出值;同样的当模型在NPU中进行计算时采用相同的方式记录下相应的数据,通过对比dump出的数值,计算余弦相似度和均方根误差的方式,
定位和排查NPU算子存在的计算精度问题。
精度比对工具dump数据说明:在实际使用场景中网络模型通常较大,基于整网全量数据的dump,耗时长且储存文件大。因此内部默认使用部分网络参数和统计量的方式dump数据来提升效率。如需dump全量数据,请将register_hook函数中的sample参数设为False(默认为True)。
![图1:精度比对逻辑图](figures/module_compare.png)
图1即为精度对比的基本逻辑,思路清晰明了,但其中存在较多的细节问题:
1. 需要对大量的变量进行控制,要确保模型结构参数等相同。
2. 相同的模型在不同的硬件设备上进行运算时可能会出现相同的计算会调用不同的底层算子,造成npu算子可能出现的不匹配情形。
3. NPU与CPU/GPU的计算结果误差可能会随着模型的执行不断累积,最终会出现同一个算子因为输入的数据差异较大而无法匹配对比计算精度的情况。
其中细节问题2可能表现如下图2:
![图2:算子映射匹配](figures/op_compare.png)
由于可能会出现融合算子,所以在算子的逐一匹配时可能会出现错误匹配或无法匹配的问题,例如图2中NPU算子npu_op_1与npu_op_2无法和cpu_op_k进行匹配,才去跳过的方式,直到到npu_op_3和cpu_op_3才从新对齐开始匹配。
### **算子匹配条件**
判断运行在cpu和npu上的两个算子是否相同采用的步骤如下:
1. 两个算子的名字是否相同
1. 两个算子的输入输出Tensor数量和各个Tensor的shape是否相同
通常满足以上的两个条件,就认为是同一个算子,成功进行算子的匹配,后续进行相应的计算精度比对。
### **计算精度评价指标**
在进行计算精度匹配时,基本共识为默认CPU或GPU的算子计算结果是准确的,最终比对生成的csv文件中主要包括以下的几个属性:
| Name | Npu Tensor Dtype | Bench Tensor Dtype | Npu Tensor Shape | Bench Tensor Shape | Cosine | RMSE | MAPE |
| :---: | :--------------: | :----------------: | :--------------: | :----------------: | :----: | :---: | :---: |
其中主要使用算子Name、Dtype、Shape用于描述算子的基本特征,Cosine(余弦相似)、RMSE(均方根误差)、MAPE(绝对百分比误差)作为评价计算精度的主要评估指标:
1. 余弦相似度(通过计算两个向量的余弦值来判断其相似度):
$$
\Large
cos(\theta) = \frac{\sum_{i=1}^{n} (\hat{y_{i}} \times y_{i})}
{\sqrt{\sum_{i=1}^{n}\hat{y_{i}}} \times \sqrt{\sum_{i=1}^{n}y_{i}^{2}}}
$$
当余弦夹角数值越接近于1说明计算出的两个张量越相似,在计算中可能会存在nan,主要由于可能会出现其中一个向量为0
2. 均方根误差(RMSE):
$$
\Large
RMSE = \sqrt{\frac{1}{n} \sum_{i=1}^{n} (\hat{y_{i}} - y_{i})^{2}}
$$
当均方根误差越接近0表示其计算的平均误差越小
3. 平均绝对百分比误差(MAPE):
$$
\Large
MAPE = \frac{1}{n} \sum_{i=1}^{n}|\frac{\hat{y_{i}} - y_{i}}{y_{i}}|
$$
绝对百分比误差衡量计算误差的百分比,越接近0越好,但当其中的实际计算结果中存在0时是无法进行计算的
## **快速上手样例参考**
相关函数导入
```python
from torch_npu.hooks import set_dump_path, seed_all, register_hook, wrap_acc_cmp_hook
from torch_npu.hooks.tools import compare
```
相关函数说明:
```python
seed_all(seed=1234)->None
功能:
设置随机数种子, 固定网络初始化中的随机数
参数:
seed: 随机数种子
例子:
>>>seed_all()
>>>seed_all(1234)
```
```python
set_dump_path(fpath=None)->None
功能:
设置dump数据文件
参数:
fpath: dump数据文件
例子:
>>>set_dump_path("./cpu_module_op.pkl")
>>>set_dump_path("/home/xxx/npu_module_op.pkl")
```
```python
register_hook(model, hook, **kwargs)->None
功能:
对模型注入hooks, 开启dump数据功能
参数:
model: 需要dump数据的网络模型
hook: 需要注册的函数, 精度比对工具使用wrap_acc_cmp_hook函数
sample:是否使用数据采样方式dump数据, 默认为True
例子:
>>>register_hook(model, wrap_acc_cmp_hook)
>>>register_hook(model, wrap_acc_cmp_hook, sample=False)
>>>register_hook(model, wrap_acc_cmp_hook, sample=True)
```
```python
compare(pkl_path1, pkl_path2, output_path, shape_flag=False)->None
功能:
对dump下来的两份数据进行比对
参数:
pkl_path1: 模型dump数据文件1
pkl_path2: 模型dump数据文件2
output_path: 精度比对结果文件输出路径
shape_flag: False时只使用算子名字进行匹配, True时使用算子名称, 输入输出大小进行匹配
例子:
>>>compare("./npu_module_op.pkl", "./cpu_module_op.pkl", "./module_result.csv")
```
使用精度比对工具进行模型的精度比对,样例代码如下:
```python
# 根据需要import包
import os
import torch
import torch.nn as nn
from torch_npu.hooks import set_dump_path, seed_all, register_hook, wrap_acc_cmp_hook
from torch_npu.hooks.tools import compare
# 定义一个简单的网络
class ModuleOP(nn.Module):
def __init__(self) -> None:
super().__init__()
self.linear_1 = nn.Linear(in_features=2, out_features=2)
self.linear_2 = nn.Linear(in_features=2, out_features=1)
self.relu = nn.ReLU()
def forward(self, x):
x1 = self.linear_1(x)
x2 = self.linear_2(x1)
r1 = self.relu(x2)
return r1
module = ModuleOP()
# 对模型注入forwar和backward的hooks,采样功能默认开启,如需关闭,请使用register_hook(model_cpu, wrap_acc_cmp_hook, sample=False)
register_hook(model_cpu, wrap_acc_cmp_hook)
seed_all()
x = torch.randn(2, 2)
# cpu上计算,dump数据
set_dump_path("./cpu_module_op.pkl")
out = module(x)
loss = out.sum()
loss.backward()
module.npu()
x = x.npu()
# npu上计算,dump数据
set_dump_path("./npu_module_op.pkl")
out = module(x)
loss = out.sum()
loss.backward()
# 对比dump出的数据精度,生成csv文件
compare("./npu_module_op.pkl", "./cpu_module_op.pkl", "./module_result.csv")
```
使用精度比对工具进行torchvision下现有模型的计算精度比对,整体思路相同,其中cpu和npu的对比思路与npu和npu的对比思路也是相同,以resnet50模型为例代码如下:
```python
import os
import copy
import torch
import torch.nn as nn
from torchvision import models, datasets, transforms
from torch_npu.hooks import set_dump_path, seed_all, register_hook, wrap_acc_cmp_hook
from torch_npu.hooks.tools import compare
# 选取需要的模型
model_cpu = models.resnet50()
model_cpu.eval()
model_npu = copy.deepcopy(model_cpu)
model_npu.eval()
seed_all()
# 对该计算进行hook注入和数据dump,采样功能默认开启,如需关闭,请使用register_hook(model_cpu, wrap_acc_cmp_hook, sample=False)
register_hook(model_cpu, wrap_acc_cmp_hook)
register_hook(model_npu, wrap_acc_cmp_hook)
# 需要根据不同的模型输入和标签生成相应的tensor(或读取实际数据),损失函数等,如果是随机生成的标签需要保证数据的有效性
inputs = torch.randn(1, 3, 244, 244)
labels = torch.randn(1).long()
criterion = nn.CrossEntropyLoss()
# cpu
set_dump_path("./cpu_resnet50_op.pkl")
output = model_cpu(inputs)
loss = criterion(output, labels)
loss.backward()
# npu
set_dump_path("./npu_resnet50_op.pkl")
model_npu.npu()
inputs = inputs.npu()
labels = labels.npu()
output = model_npu(inputs)
loss = criterion(output, labels)
loss.backward()
# 对比dump出的数据精度,生成csv文件
compare("./npu_resnet50_op.pkl", "./cpu_resnet50_op.pkl", "./resnet50_result.csv")
```
如需对生成的pkl文件解析读取数据,可参考下列代码
```python
import json
pkl_file=open("./cpu_resnet50_op.pkl",'r')
tensor_line=pkl_file.readline() # 读取行数据
tensor_data=json.loads(tensor_line)
print(tensor_data[0]) # 算子名称
print(tensor_data[1]) # 对应数据
print(tensor_data[2]) # 数据类型
print(tensor_data[3]) # 数据尺寸
```
基于step粒度控制精度对比数据导出,通过在register_hook方法设置schedule参数控制需要导出数据的step。
* **schedule**用于控制使能的step,入参分别为:**起始step(begin=0)、终止step(end=sys.maxsize)、步长(stride=1)**,例:
schedule() 使能所有step;
schedule(4, 10, 2) 使能的step为:4,6,8,10;
schedule(begin=5, stride=3) 使能的step为:5,8,11,14...;
schedule(end=10, stride=3) 使能的step为:0,3,6,9。
* 变量step_num用于记录step数,调用**step_schedule.step**使变量step_num加1,step_num初始值为0;**step_schedule.reset_step**初始化step_num为0。
```python
from torch_npu.hooks import register_hook, wrap_acc_cmp_hook, schedule, step_schedule
# add step schedule, begin=4 end=10 stride=2
register_hook(model, wrap_acc_cmp_hook, schedule=schedule(4, 10, 2))
for epoch in range(num_train_epochs):
# init step_num as 0
step_schedule.reset_step()
for step, inputs in enumerate(dataloader):
output = model(inputs)
loss = output.sum()
loss.backward()
# step_num increase 1
step_schedule.step()
```
异步算子数据导出wrap_async_datadump_hook(仅应用于npu算子导出);针对精度对比工具同步tensor数据导出,npu同cpu数据同步耗时较长的问题,利用npu上tdtchannel实现tensor数据的异步导出。
* 通过register_hook方法注册异步导出hook wrap_async_datadump_hook,并通过path参数指定导出tensor数据的路径;导出算子较多时,可以通过capacity参数调整异步导出队列长度,默认3,参数范围3~2048。
* 导出的文件名为:唯一索引_算子名_前反向_输入输出_shape_stride_offset_format.npy,例:16_Functional_relu_backward_input0_shape[2,1]_stride[1,1]_offset[0]_format[2].npy;导出的文件可以使用numpy.load方便导入。
* wrap_async_datadump_hook依赖OutfeedEnqueueOpV2算子,该算子不支持runtime2.0;需设置环境变量规避**export RUNTIME_V2_BLACKLIST=OutfeedEnqueueOpV2**。
```python
from torch_npu.hooks import register_hook, wrap_async_datadump_hook, schedule, step_schedule
# register wrap_async_datadump_hook and add datadump path
register_hook(module, wrap_async_datadump_hook, path='./output', schedule=schedule(1, 2))
# load datadump data by numpy
numpy.load('./output/16_Functional_relu_backward_input0_shape[2,1]_stride[1,1]_offset[0]_format[2].npy')
```
- [**PyTorch溢出检测工具使用指南**](#pytorch精度对比工具使用指南)
- [**使用场景**](#使用场景)
- [**前提条件**](#前提条件)
- [**基本原理**](#基本原理)
- [**使用方法**](#使用方法)
- [**快速上手样例参考**](#快速上手样例参考)
## **使用场景**
在模型训练或调测中,遇到溢出问题,定位费时费力,可以使用溢出检测工具,快速定位溢出层位置。
溢出检测工具,通过在pytorch模型中注入hook,监测网络每一层是否有溢出问题,从而进行问题的精准定位。
## **前提条件**
已完成PyTorch Adapter插件的编译安装,具体操作请参考[《AscendPyTorch安装指南》](../PyTorch安装指南/PyTorch安装指南.md)。
## **基本原理**
采用hook机制,对模型每一层执行前向和反向的过程调用溢出检测函数。溢出检测函数通过设定全局溢出标志位来判断是否有数值溢出情况,若有溢出,则会抛出error,输出对应api层名字,且在当前目录下自动生成含有溢出信息的文件。
## **使用方法**
步骤1:引入库代码
```python
from torch_npu.hooks import register_hook, wrap_checkoverflow_hook
```
步骤2:对模型注册溢出检测函数hook
```python
register_hook(model,wrap_checkoverflow_hook)
```
## **快速上手样例参考**
使用溢出检测工具进行模型的溢出问题定位,样例代码如下:
```python
import os
import copy
import torch
import torch.nn as nn
from torchvision import models, datasets, transforms
#import溢出检测工具相关函数
from torch_npu.hooks import register_hook, wrap_checkoverflow_hook
# 需要定位问题的网络模型
model = models.resnet50()
model.npu()
#对模型注册溢出检测函数hook
register_hook(model,wrap_checkoverflow_hook)
inputs = torch.randn(1, 3, 244, 244)
labels = torch.randn(1).long()
criterion = nn.CrossEntropyLoss()
inputs = inputs.npu()
labels = labels.npu()
output = model_npu(inputs)
loss = criterion(output, labels)
loss.backward()
@@ -11,6 +11,7 @@
华为对自有训练模型算子进行了优化,其中包括算子消除、算子融合、算子拆分等,以更好的适配NPU等训练设备。
因此在模型迁移的过程中,有时会遇到自有实现的算子运算的结果与业界标准算子运算结果存在偏差,精度不达标的问题,需要借助计算精度比对工具得出模型中的哪些算子在GPU和NPU的计算中会存在较大的差异,从而重点分析这些算子的表现性能,帮助开发人员快速定位并解决算子精度问题。
此外在进行模型版本迭代、底层算子迭代、计算设备(npu)迭代时也可能会引入计算精度的问题,有时会遇到新实现的算子运算的结果与要被替代的算子运算结果存在偏差等,需要借助计算精度对比工具得出那些算子在不同的版本或在不同的设备上存在较大的计算差异,从而快速定位计算精度问题。
## **已有的精度对比脚本工具**
目前已经有一些可以进行精度比对的脚本示例,其主要思路都是相同的,包括整网对比和单算子对比,如图所示。
@@ -1,184 +0,0 @@
# **PyTorch精度对比工具使用指南**
- [**PyTorch精度对比工具使用指南**](#pytorch精度对比工具使用指南)
- [**使用场景**](#使用场景)
- [**前提条件**](#前提条件)
- [**精度比对基本原理**](#精度比对基本原理)
- [**算子匹配条件**](#算子匹配条件)
- [**计算精度评价指标**](#计算精度评价指标)
- [**快速上手样例参考**](#快速上手样例参考)
## **使用场景**
在同一模型或算子调试过程中,遇到算子相关的计算精度问题,定位时费时费力,所以推出了一个精度比对工具。
精度对比工具,通过在PyTorch模型中注入hook,跟踪计算图中算子的前向传播与反向传播时的输入与输出,对比npu芯片中的算子计算数值与cpu(gpu)芯片中的算子计算数值进行对比,排查npu算子在npu芯片中存在计算精度误差,进行问题的精准定位。
## **前提条件**
已完成PyTorch Adapter插件的编译安装,具体操作请参考[《AscendPyTorch安装指南》](../PyTorch安装指南/PyTorch安装指南.md)。
## **精度比对基本原理**
普遍适用的方法是以模型为单位,采用hook机制挂在模型的上。当模型在CPU(或GPU)上进行正向传播时跟踪并dump每一层的数值输入与输出,在反向传播时跟踪并dump每一层的梯度输入值与输出值;同样的当模型在NPU中进行计算时采用相同的方式记录下相应的数据,通过对比dump出的数值,计算余弦相似度和均方根误差的方式,
定位和排查NPU算子存在的计算精度问题。
![图1:精度比对逻辑图](figures/module_compare.png)
图1即为精度对比的基本逻辑,思路清晰明了,但其中存在较多的细节问题:
1. 需要对大量的变量进行控制,要确保模型结构参数等相同。
2. 相同的模型在不同的硬件设备上进行运算时可能会出现相同的计算会调用不同的底层算子,造成npu算子可能出现的不匹配情形。
3. NPU与CPU/GPU的计算结果误差可能会随着模型的执行不断累积,最终会出现同一个算子因为输入的数据差异较大而无法匹配对比计算精度的情况。
其中细节问题2可能表现如下图2:
![图2:算子映射匹配](figures/op_compare.png)
由于可能会出现融合算子,所以在算子的逐一匹配时可能会出现错误匹配或无法匹配的问题,例如图2中NPU算子npu_op_1与npu_op_2无法和cpu_op_k进行匹配,才去跳过的方式,直到到npu_op_3和cpu_op_3才从新对齐开始匹配。
### **算子匹配条件**
判断运行在cpu和npu上的两个算子是否相同采用的步骤如下:
1. 两个算子的名字是否相同
1. 两个算子的输入输出Tensor数量和各个Tensor的shape是否相同
通常满足以上的两个条件,就认为是同一个算子,成功进行算子的匹配,后续进行相应的计算精度比对。
### **计算精度评价指标**
在进行计算精度匹配时,基本共识为默认CPU或GPU的算子计算结果是准确的,最终比对生成的csv文件中主要包括以下的几个属性:
| Name | Npu Tensor Dtype | Bench Tensor Dtype | Npu Tensor Shape | Bench Tensor Shape | Cosine | RMSE | MAPE |
| :---: | :--------------: | :----------------: | :--------------: | :----------------: | :----: | :---: | :---: |
其中主要使用算子Name、Dtype、Shape用于描述算子的基本特征,Cosine(余弦相似)、RMSE(均方根误差)、MAPE(绝对百分比误差)作为评价计算精度的主要评估指标:
1. 余弦相似度(通过计算两个向量的余弦值来判断其相似度):
$$
\Large
cos(\theta) = \frac{\sum_{i=1}^{n} (\hat{y_{i}} \times y_{i})}
{\sqrt{\sum_{i=1}^{n}\hat{y_{i}}} \times \sqrt{\sum_{i=1}^{n}y_{i}^{2}}}
$$
当余弦夹角数值越接近于1说明计算出的两个张量越相似
2. 均方根误差(RMSE):
$$
\Large
RMSE = \sqrt{\frac{1}{n} \sum_{i=1}^{n} (\hat{y_{i}} - y_{i})^{2}}
$$
当均方根误差越接近0表示其计算的平均误差越小
3. 平均绝对百分比误差(MAPE):
$$
\Large
MAPE = \frac{1}{n} \sum_{i=1}^{n}|\frac{\hat{y_{i}} - y_{i}}{y_{i}}|
$$
绝对百分比误差衡量计算误差的百分比,越接近0越好,但当其中的实际计算结果中存在0时是无法进行计算的
## **快速上手样例参考**
使用精度比对工具进行模型的精度比对,样例代码如下:
```python
# 根据需要import包
import os
import torch
import torch.nn as nn
from torch_npu.hooks import set_dump_path, seed_all, register_acc_cmp_hook
from torch_npu.hooks.tools import compare
# 定义一个简单的网络
class ModuleOP(nn.Module):
def __init__(self) -> None:
super().__init__()
self.linear_1 = nn.Linear(in_features=2, out_features=2)
self.linear_2 = nn.Linear(in_features=2, out_features=1)
self.relu = nn.ReLU()
def forward(self, x):
x1 = self.linear_1(x)
x2 = self.linear_2(x1)
r1 = self.relu(x2)
return r1
# 对该网络进行hook注入和数据dump
module = ModuleOp()
register_acc_cmp_hook(module) # 对模型注入forwar和backward的hooks
seed_all()
x = torch.randn(2, 2)
# cpu上计算,dump数据
set_dump_path("./cpu_module_op.pkl")
out = module(x)
loss = out.sum()
loss.backward()
set_dump_path("./npu_mpdule_op.pkl")
# npu上计算,dump数据
module.npu()
x = x.npu()
out = module(x)
loss = out.sum()
loss.backward()
# 对比dump出的数据精度,生成csv文件
compare("./npu_module_op.pkl", "./cpu_module_op.pkl", "./module_result.csv")
```
使用精度比对工具进行torchvision下现有模型的计算精度比对,整体思路相同,以resnet50模型为例代码如下:
```python
import os
import copy
import torch
import torch.nn as nn
from torchvision import models, datasets, transforms
from torch_npu.hooks import set_dump_path, seed_all, register_acc_cmp_hook
from torch_npu.hooks.tools import compare
# 选取需要的模型
model_cpu = models.resnet50()
model_cpu.eval()
model_npu = copy.deepcopy(model_cpu)
model_npu.eval()
# 对该计算进行hook注入和数据dump
register_acc_cmp_hook(model_cpu)
register_acc_cmp_hook(model_npu)
seed_all()
# 需要根据不同的模型输入和标签生成相应的tensor(或读取实际数据),损失函数等
inputs = torch.randn(1, 3, 244, 244)
labels = torch.randn(1).long()
criterion = nn.CrossEntropyLoss()
# cpu
set_dump_path("./cpu_resnet50_op.pkl")
output = model_cpu(inputs)
loss = criterion(output, labels)
loss.backward()
# npu
set_dump_path("./npu_resnet50_op.pkl")
model_npu.npu()
inputs = inputs.npu()
labels = labels.npu()
output = model_npu(inputs)
loss = criterion(output, labels)
loss.backward()
# 对比dump出的数据精度,生成csv文件
compare("./npu_resnet50_op.pkl", "./cpu_resnet50_op.pkl", "./resnet50_result.csv")
```
File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Some files were not shown because too many files have changed in this diff Show More