Compare commits
822
Commits
master
...
v2.1.0-6.0.rc1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
750d5d1266 | ||
|
|
ee82e49903 | ||
|
|
7204abe508 | ||
|
|
4d165bae77 | ||
|
|
feb60c2392 | ||
|
|
b723de3a6c | ||
|
|
03a4f92fec | ||
|
|
ac14c1825f | ||
|
|
e264902680 | ||
|
|
0f3bf7a472 | ||
|
|
df80c3646f | ||
|
|
4ecd50b298 | ||
|
|
7c4136d8f7 | ||
|
|
9d02644e64 | ||
|
|
ae2e23965b | ||
|
|
a10a34c06f | ||
|
|
44f25cdd1b | ||
|
|
98e8569091 | ||
|
|
e1a2065168 | ||
|
|
c948877962 | ||
|
|
5ef706f033 | ||
|
|
122abc2455 | ||
|
|
d7630f43ba | ||
|
|
0c877e96aa | ||
|
|
359b73ab16 | ||
|
|
b715ae963c | ||
|
|
7ce623627b | ||
|
|
65e1eb403b | ||
|
|
f6c8901bfb | ||
|
|
86e4a9777e | ||
|
|
9959bc6012 | ||
|
|
0d6679567e | ||
|
|
0d6c69f420 | ||
|
|
7192b1988f | ||
|
|
955def62fe | ||
|
|
cf5e2e8851 | ||
|
|
d6b27714fa | ||
|
|
c7d8ef17e3 | ||
|
|
9f29db7417 | ||
|
|
d1fd727744 | ||
|
|
8301485bc1 | ||
|
|
a7b59f6f14 | ||
|
|
4273a61584 | ||
|
|
05759212ab | ||
|
|
ea671a9c49 | ||
|
|
3a79f7e5d0 | ||
|
|
af8a32f556 | ||
|
|
1263131e15 | ||
|
|
03108b427c | ||
|
|
ec26771139 | ||
|
|
5a3c2e38be | ||
|
|
a44bfb0eb4 | ||
|
|
69d0620997 | ||
|
|
673665f367 | ||
|
|
15f503e3b1 | ||
|
|
59a37e49fe | ||
|
|
d02358615f | ||
|
|
94e3028335 | ||
|
|
d4bb416cc9 | ||
|
|
289cb47895 | ||
|
|
61219d083a | ||
|
|
2d3019a093 | ||
|
|
382050cc95 | ||
|
|
03a3bb12eb | ||
|
|
36a71cf4d9 | ||
|
|
5db3bb978e | ||
|
|
98bfc6a673 | ||
|
|
9974f816ad | ||
|
|
9aae5cf471 | ||
|
|
cd5857771f | ||
|
|
4eb1074bbc | ||
|
|
a318233ed7 | ||
|
|
1e1bf08e01 | ||
|
|
abf8986a51 | ||
|
|
9cf6f699ab | ||
|
|
ee7381aa17 | ||
|
|
a54bf3febb | ||
|
|
e10fe016de | ||
|
|
1ecfc61ce6 | ||
|
|
8c53a1f72f | ||
|
|
3cca352bdd | ||
|
|
0a48feb975 | ||
|
|
f708f5fc52 | ||
|
|
5e0dda4fa9 | ||
|
|
c5f320b2c0 | ||
|
|
09ab02a60d | ||
|
|
49e2b93a70 | ||
|
|
f5ee551c9e | ||
|
|
cda222fb4c | ||
|
|
d0cbb24a12 | ||
|
|
4a274d33f5 | ||
|
|
891a3a07b5 | ||
|
|
4ff2d29fac | ||
|
|
04492398ed | ||
|
|
a7837f482b | ||
|
|
d0298e13b1 | ||
|
|
b4151d0be8 | ||
|
|
33144de22b | ||
|
|
641ede6fac | ||
|
|
de312660c7 | ||
|
|
584a1bb028 | ||
|
|
55391766e6 | ||
|
|
d34ff37174 | ||
|
|
4a046a061f | ||
|
|
7cebd04414 | ||
|
|
a0b21d61b9 | ||
|
|
c60c2d989d | ||
|
|
049d5cdb8f | ||
|
|
9a5e543369 | ||
|
|
65f4661b73 | ||
|
|
8c4ff8dd6a | ||
|
|
433d881478 | ||
|
|
829388ccab | ||
|
|
c3976d42b4 | ||
|
|
09b1dc8dd1 | ||
|
|
416d94a478 | ||
|
|
1b7b0bd595 | ||
|
|
1afd7d2e90 | ||
|
|
7433807097 | ||
|
|
77a94eee6e | ||
|
|
9e5a0fed79 | ||
|
|
33594b884a | ||
|
|
92d25130f2 | ||
|
|
997b490d9f | ||
|
|
db78727356 | ||
|
|
446b665f42 | ||
|
|
60e45196ad | ||
|
|
01ae91d800 | ||
|
|
056e97dbe9 | ||
|
|
0e26ad2ae8 | ||
|
|
14bf45e106 | ||
|
|
4b4cbe26b0 | ||
|
|
206af5b0e3 | ||
|
|
31e7b23917 | ||
|
|
534baca20a | ||
|
|
2a96c92ee6 | ||
|
|
2d71088a18 | ||
|
|
470951aeea | ||
|
|
218c8ad316 | ||
|
|
dbad4206ea | ||
|
|
9ae2a52183 | ||
|
|
401e51f506 | ||
|
|
ecc6249ab2 | ||
|
|
d9741c2cd7 | ||
|
|
4f6c1bce5d | ||
|
|
822d5b9d8f | ||
|
|
a230e1a29d | ||
|
|
7de2578cb6 | ||
|
|
55598a317c | ||
|
|
34d6e576a9 | ||
|
|
77b467252a | ||
|
|
7705c9d82a | ||
|
|
f9d36f7695 | ||
|
|
f8328fe651 | ||
|
|
ee0ae1964e | ||
|
|
bbad3f46e6 | ||
|
|
0ec8a8c29f | ||
|
|
14d491ab2c | ||
|
|
bf4479b04a | ||
|
|
2c988ce2bc | ||
|
|
831d5e39de | ||
|
|
17c9d8276c | ||
|
|
d0058bdc80 | ||
|
|
e6caab0d72 | ||
|
|
316d82d325 | ||
|
|
dbc388b3af | ||
|
|
38de3754f7 | ||
|
|
fe34ddf8a3 | ||
|
|
9835ca809d | ||
|
|
e09dc72376 | ||
|
|
332098551c | ||
|
|
bd833fa19f | ||
|
|
4f9eb9fb5b | ||
|
|
486c70f17c | ||
|
|
eda7ddd402 | ||
|
|
dd18736c72 | ||
|
|
6008b703aa | ||
|
|
0d9c675ed6 | ||
|
|
b988b1acb4 | ||
|
|
b44c991d5c | ||
|
|
4c18986e63 | ||
|
|
217914985e | ||
|
|
cc26c99654 | ||
|
|
800845a7cf | ||
|
|
97251638ea | ||
|
|
22885fd968 | ||
|
|
80fece3559 | ||
|
|
65d21f1ed8 | ||
|
|
e53e90dbab | ||
|
|
92be04fe4e | ||
|
|
c8f3162a7b | ||
|
|
1db706eb95 | ||
|
|
3787b0c313 | ||
|
|
6aecd65ba2 | ||
|
|
b88f10214b | ||
|
|
024095f7f8 | ||
|
|
d27ecada98 | ||
|
|
804455ab38 | ||
|
|
5bc25f138b | ||
|
|
dba8413e20 | ||
|
|
8bd5fca096 | ||
|
|
30dad14ead | ||
|
|
1bcb239bdc | ||
|
|
2d0364681a | ||
|
|
1693589ed3 | ||
|
|
d37d2baf91 | ||
|
|
e792eb4911 | ||
|
|
ff4f484e6b | ||
|
|
0b6a11df78 | ||
|
|
325c68ca08 | ||
|
|
6636d9ad95 | ||
|
|
39ce62c1fc | ||
|
|
439c9d4768 | ||
|
|
dc89ca928a | ||
|
|
cf9a3d2ace | ||
|
|
97c51368c2 | ||
|
|
2f59a1a52c | ||
|
|
3f546052af | ||
|
|
afb1971fa7 | ||
|
|
157ceda1d5 | ||
|
|
08441fad37 | ||
|
|
b860750cbc | ||
|
|
92bffbe15b | ||
|
|
0c207b021d | ||
|
|
a30eba9ea8 | ||
|
|
07be99217a | ||
|
|
046613446f | ||
|
|
73323dad06 | ||
|
|
7a3f28eccb | ||
|
|
828aa4f903 | ||
|
|
fee61752fa | ||
|
|
2b021d2aa4 | ||
|
|
6f1cfabd56 | ||
|
|
84c9fefbcb | ||
|
|
4bcb55ef91 | ||
|
|
de33c8ffe7 | ||
|
|
cf68632d8e | ||
|
|
13ed28171c | ||
|
|
34d812ae45 | ||
|
|
0d3bd7d3d5 | ||
|
|
e90d263182 | ||
|
|
9226dea1a9 | ||
|
|
fb5dafdc87 | ||
|
|
18392222ee | ||
|
|
a8f32bd3ab | ||
|
|
030b3ae595 | ||
|
|
70d599c4a6 | ||
|
|
adc7212ba1 | ||
|
|
b0cce6f315 | ||
|
|
f444644be1 | ||
|
|
90f97c9b76 | ||
|
|
d9c7f8b619 | ||
|
|
b62d2b9cbb | ||
|
|
620bcf1555 | ||
|
|
4588337732 | ||
|
|
2856523168 | ||
|
|
3217794ab2 | ||
|
|
b2bbead88d | ||
|
|
252a3755a3 | ||
|
|
00855fe789 | ||
|
|
d17a531d60 | ||
|
|
92c4954a93 | ||
|
|
002f1f6d9d | ||
|
|
742257c745 | ||
|
|
464e3fcbac | ||
|
|
4258ecd361 | ||
|
|
4f53dec57e | ||
|
|
7fcd009089 | ||
|
|
ea4eea2f5b | ||
|
|
93dd1a8361 | ||
|
|
2129351803 | ||
|
|
a8ece37fda | ||
|
|
42099ec4f3 | ||
|
|
0f223c5c38 | ||
|
|
42502303cb | ||
|
|
c8d1cb5a50 | ||
|
|
dec4d3dd95 | ||
|
|
7299d6d9b7 | ||
|
|
9a369b0ddc | ||
|
|
9c176bc557 | ||
|
|
63b4421f9e | ||
|
|
06a908463a | ||
|
|
4f5a172421 | ||
|
|
2a89a16c4e | ||
|
|
c26a0c6562 | ||
|
|
c1f96a6cf9 | ||
|
|
c438c912a3 | ||
|
|
3f8fcaa39d | ||
|
|
c1a4b148be | ||
|
|
4d9fd391da | ||
|
|
f21eb9a52c | ||
|
|
7a45abf447 | ||
|
|
cd62eeaeca | ||
|
|
e4a6b2b00a | ||
|
|
4d4bdcd907 | ||
|
|
084a93313a | ||
|
|
71fdf345f2 | ||
|
|
d525dd60cd | ||
|
|
a032837e3f | ||
|
|
cdffd15058 | ||
|
|
cb5474bc65 | ||
|
|
7afe384eee | ||
|
|
f3595f20a9 | ||
|
|
c4e2e2c690 | ||
|
|
55900e80c5 | ||
|
|
2e7851faa7 | ||
|
|
ca89019cb7 | ||
|
|
0139318344 | ||
|
|
db4c1e0095 | ||
|
|
4cf34d3a91 | ||
|
|
04457a925f | ||
|
|
d791b36a07 | ||
|
|
9c4a3a6710 | ||
|
|
d1c8df5681 | ||
|
|
ca7cb6e54e | ||
|
|
7447049533 | ||
|
|
9362400908 | ||
|
|
e4c61154f9 | ||
|
|
2faaadff04 | ||
|
|
2a77dac407 | ||
|
|
b88cd9c08f | ||
|
|
4a5ad9a563 | ||
|
|
4bb49b21c3 | ||
|
|
c55913ec57 | ||
|
|
fa22cc00a3 | ||
|
|
f29960f1b6 | ||
|
|
fa1bc3c540 | ||
|
|
88809834a3 | ||
|
|
52ef5fc5d2 | ||
|
|
0509deaf25 | ||
|
|
9b2759b6be | ||
|
|
2dc58a3a0a | ||
|
|
b465d94688 | ||
|
|
e16cfb628b | ||
|
|
8d4347daae | ||
|
|
70383c0bbb | ||
|
|
f30cbb019f | ||
|
|
be2e343ff0 | ||
|
|
ce19b0a334 | ||
|
|
c6d57da5a5 | ||
|
|
71a156299d | ||
|
|
508f7effef | ||
|
|
09650ba299 | ||
|
|
20eb6492ad | ||
|
|
bd35275d48 | ||
|
|
0884955315 | ||
|
|
4acf6e9e51 | ||
|
|
e9bc6c5dd0 | ||
|
|
ed4a85df28 | ||
|
|
c514ae7c0d | ||
|
|
6d8dd25ee5 | ||
|
|
6b76e0922b | ||
|
|
716e728f8c | ||
|
|
85c87f6a70 | ||
|
|
96048095cb | ||
|
|
bbb817131e | ||
|
|
5947280f16 | ||
|
|
f32db1b3a7 | ||
|
|
18a76f2bee | ||
|
|
3e08b5fcfc | ||
|
|
13086c2858 | ||
|
|
c1714ecffd | ||
|
|
5bfd2f13b6 | ||
|
|
6b96a04430 | ||
|
|
f8e923ab55 | ||
|
|
a43b67943f | ||
|
|
be15110e19 | ||
|
|
30e0b5f9d1 | ||
|
|
da629f6df7 | ||
|
|
3152cb8936 | ||
|
|
3eff2dab30 | ||
|
|
bcd6b5c7fd | ||
|
|
8aba3040c1 | ||
|
|
7678b4f2ba | ||
|
|
b390de830d | ||
|
|
ef8695ab08 | ||
|
|
9e188b60a0 | ||
|
|
4cb5cf1991 | ||
|
|
fa3b94899a | ||
|
|
2e8e9f1d8c | ||
|
|
7a9c5be922 | ||
|
|
b933689ed5 | ||
|
|
845a5b05fd | ||
|
|
7c09ae141d | ||
|
|
b0533aa892 | ||
|
|
7b8519e7c1 | ||
|
|
dd4b4d7c95 | ||
|
|
d3e83926ff | ||
|
|
87766d035f | ||
|
|
dc747a0359 | ||
|
|
042fa2c8a7 | ||
|
|
fb950244e3 | ||
|
|
9bb8b8d77e | ||
|
|
9919eee091 | ||
|
|
aaae4468d5 | ||
|
|
86440876b6 | ||
|
|
35000ff899 | ||
|
|
c912d402be | ||
|
|
b0d9fb312d | ||
|
|
cdbb5ad81f | ||
|
|
2233c3b21f | ||
|
|
e18b6eaa57 | ||
|
|
1887c5a274 | ||
|
|
db883cedb8 | ||
|
|
5fc9111a0c | ||
|
|
b8350e5bc4 | ||
|
|
889198313e | ||
|
|
b5fe032541 | ||
|
|
d806efcfed | ||
|
|
6e5d3810cf | ||
|
|
0491c043c9 | ||
|
|
a54bab63ba | ||
|
|
39f29d5ea4 | ||
|
|
5f301650dd | ||
|
|
575af7aaba | ||
|
|
2b07c5f7ac | ||
|
|
54dc22785c | ||
|
|
6dad2028e6 | ||
|
|
de32feff7e | ||
|
|
a05475f956 | ||
|
|
4d894431bc | ||
|
|
7aaaebe215 | ||
|
|
d8d0b3c635 | ||
|
|
38d2039e6e | ||
|
|
e0dfc88969 | ||
|
|
dc171b28fc | ||
|
|
754e8fa8c7 | ||
|
|
68a9675ee0 | ||
|
|
a789300f64 | ||
|
|
3bb35dabe3 | ||
|
|
457e62be57 | ||
|
|
f90de4f1bf | ||
|
|
6c23e4ebeb | ||
|
|
91ba6117f0 | ||
|
|
99cc1d17de | ||
|
|
215a10d9d6 | ||
|
|
6cdbb18751 | ||
|
|
da978a060b | ||
|
|
6a65e09c70 | ||
|
|
54b430a01b | ||
|
|
7f4ebd9d46 | ||
|
|
7c3fa93a8d | ||
|
|
569365591e | ||
|
|
33328d54a7 | ||
|
|
046872bb10 | ||
|
|
d71ba0ea1b | ||
|
|
c6f6d6f41e | ||
|
|
419ef7b9cb | ||
|
|
95fd519423 | ||
|
|
a05f03ba28 | ||
|
|
f96ea38d40 | ||
|
|
3d99081675 | ||
|
|
c636c337fb | ||
|
|
de389f100c | ||
|
|
451c50393d | ||
|
|
148076eb51 | ||
|
|
13b067e6a0 | ||
|
|
2c4ef1c800 | ||
|
|
688d3d768c | ||
|
|
18f88c482a | ||
|
|
537b047937 | ||
|
|
576a854a8f | ||
|
|
2b2358c98e | ||
|
|
0e69438291 | ||
|
|
57c3da3a59 | ||
|
|
81cd228d17 | ||
|
|
966e733ab2 | ||
|
|
64c27f2777 | ||
|
|
8bb8f5606d | ||
|
|
efd6e76a1c | ||
|
|
2a9fe8566f | ||
|
|
328188b454 | ||
|
|
9124040857 | ||
|
|
dff5928227 | ||
|
|
ccd302487c | ||
|
|
9f6f697ad1 | ||
|
|
133938030c | ||
|
|
bb764080fb | ||
|
|
36aedcc773 | ||
|
|
34ee1bfdee | ||
|
|
8b9a5a3ece | ||
|
|
8ac47fd80b | ||
|
|
95bfae88ec | ||
|
|
5108b17c87 | ||
|
|
feb31b571b | ||
|
|
3c72bedfe8 | ||
|
|
4233ccb15e | ||
|
|
d48d1efe4a | ||
|
|
4238ec41b1 | ||
|
|
48dd963343 | ||
|
|
7b8d9c440d | ||
|
|
e50b4db005 | ||
|
|
73ad26955b | ||
|
|
941f71345a | ||
|
|
60ecda7d88 | ||
|
|
7c57bbf5fd | ||
|
|
e16e85a7b1 | ||
|
|
c112438e5f | ||
|
|
a8d5e43b82 | ||
|
|
b19930be20 | ||
|
|
26a6717f56 | ||
|
|
6f0e61ad6a | ||
|
|
5f2fa90c88 | ||
|
|
7b0707561d | ||
|
|
58441f4d9e | ||
|
|
7f9a9c33ae | ||
|
|
9d1609823b | ||
|
|
484aabbf74 | ||
|
|
b4f263207a | ||
|
|
a1db8b2069 | ||
|
|
bd3897824f | ||
|
|
b41881863e | ||
|
|
f990022740 | ||
|
|
7196dd1e54 | ||
|
|
27759c4bee | ||
|
|
8a3acaf465 | ||
|
|
d5ca7a810a | ||
|
|
7f043e0a95 | ||
|
|
95ee94924e | ||
|
|
a2f331362e | ||
|
|
4924a8d953 | ||
|
|
75d239879d | ||
|
|
7b22ca3a65 | ||
|
|
5b0eb0277f | ||
|
|
2d37d16779 | ||
|
|
ffd1008775 | ||
|
|
5571f271ab | ||
|
|
4b13db0591 | ||
|
|
365a9ca1db | ||
|
|
5e2b6c1dcf | ||
|
|
1e07339c83 | ||
|
|
4471e772d4 | ||
|
|
0d49c0b7bf | ||
|
|
8146a3c015 | ||
|
|
a37b47fb7b | ||
|
|
2add033040 | ||
|
|
875dd48d07 | ||
|
|
230aff99e0 | ||
|
|
6aa06843fe | ||
|
|
44880fbdd9 | ||
|
|
69115ab01d | ||
|
|
fbf6b0a33d | ||
|
|
512aac82a9 | ||
|
|
241ea0c353 | ||
|
|
7a78a72f27 | ||
|
|
f82a64769a | ||
|
|
99ffa2a6bc | ||
|
|
f552e66c43 | ||
|
|
a537711ac8 | ||
|
|
68146bfff0 | ||
|
|
d7df295582 | ||
|
|
8e81f0878a | ||
|
|
9ba3be1db7 | ||
|
|
017b337990 | ||
|
|
61b23f2dda | ||
|
|
5fb936ef50 | ||
|
|
366621842f | ||
|
|
507b9018ef | ||
|
|
b6c38d836e | ||
|
|
67dfb6e5db | ||
|
|
a22611b750 | ||
|
|
917a6c53b0 | ||
|
|
72ab896781 | ||
|
|
a0ed9e7f25 | ||
|
|
092d7e9bd7 | ||
|
|
3c756a467e | ||
|
|
82e047fbd5 | ||
|
|
fe2ee67751 | ||
|
|
b31e39fce7 | ||
|
|
99a7215b14 | ||
|
|
6759b4a75f | ||
|
|
2a1dd35187 | ||
|
|
3d8226055c | ||
|
|
564b58f15b | ||
|
|
c8e827a920 | ||
|
|
493e10ce9b | ||
|
|
b73d07a788 | ||
|
|
33a6b48d22 | ||
|
|
d3c19ad905 | ||
|
|
420aca385f | ||
|
|
e2a5a6c4f0 | ||
|
|
30daf51088 | ||
|
|
dd5b6c0cde | ||
|
|
912ab3982f | ||
|
|
a1336cb23f | ||
|
|
0aaaeb0c2d | ||
|
|
008d86d6c5 | ||
|
|
16cc3b1b89 | ||
|
|
09e9c7ade9 | ||
|
|
13461ae3b8 | ||
|
|
babf944680 | ||
|
|
a38db16c9d | ||
|
|
44013f7a30 | ||
|
|
49fb5004b6 | ||
|
|
56b04b5e26 | ||
|
|
6a6e00bf55 | ||
|
|
05e98fb7f2 | ||
|
|
06092b6302 | ||
|
|
964c128330 | ||
|
|
2c71bf4863 | ||
|
|
39f3c61540 | ||
|
|
27fe8b41ba | ||
|
|
e9a6d2bc87 | ||
|
|
95da33d54b | ||
|
|
a32fea0b81 | ||
|
|
1575660e2b | ||
|
|
16a31bf646 | ||
|
|
57fc87c4f9 | ||
|
|
f090dff049 | ||
|
|
0bd7df3760 | ||
|
|
4ea697adfc | ||
|
|
1492465b8d | ||
|
|
509c97f27a | ||
|
|
50d0ce71f6 | ||
|
|
f7bb7c9d47 | ||
|
|
80a6fc448d | ||
|
|
01e8abcd07 | ||
|
|
296292a091 | ||
|
|
aebb459083 | ||
|
|
ee721736ba | ||
|
|
fb6b1aa509 | ||
|
|
3d0edda80a | ||
|
|
5225de81d0 | ||
|
|
986dd35687 | ||
|
|
24d2a90e7a | ||
|
|
cf6ddf1e7e | ||
|
|
396d18e76d | ||
|
|
f201901350 | ||
|
|
9cbdd241a4 | ||
|
|
e47bc01fef | ||
|
|
fe0b8b41c0 | ||
|
|
0ab40a01cd | ||
|
|
0a46bff7d6 | ||
|
|
ebb985bb54 | ||
|
|
b40eb241b2 | ||
|
|
80da7fe278 | ||
|
|
3e4073b161 | ||
|
|
68c1fdc214 | ||
|
|
83c65fdc28 | ||
|
|
6e9fb0e2f4 | ||
|
|
3c7f5e02d5 | ||
|
|
adbc36add4 | ||
|
|
640c42c12e | ||
|
|
0ce7391039 | ||
|
|
7ccf571866 | ||
|
|
9dc04638c0 | ||
|
|
67d8716ea9 | ||
|
|
e2920a18f0 | ||
|
|
1db35d4d0a | ||
|
|
7369f4932f | ||
|
|
c5aa51f1b6 | ||
|
|
2c2f0bc099 | ||
|
|
696f6605a5 | ||
|
|
dc8c34c9b9 | ||
|
|
0d143a1f19 | ||
|
|
f5afa9fc86 | ||
|
|
ed9fe6d1d0 | ||
|
|
315f762dd6 | ||
|
|
ef91ca7ca1 | ||
|
|
8e0483399a | ||
|
|
3b0fec7d01 | ||
|
|
01ba35ee2c | ||
|
|
f98c16e766 | ||
|
|
f42a51c910 | ||
|
|
07ef220605 | ||
|
|
37ca370a2e | ||
|
|
9bc636d767 | ||
|
|
fc6831f532 | ||
|
|
812a264c45 | ||
|
|
b45d546bd0 | ||
|
|
25e5dc6b2b | ||
|
|
c8f84d7c53 | ||
|
|
203985dbed | ||
|
|
f7609162ba | ||
|
|
a5b9c007e9 | ||
|
|
65a6536b71 | ||
|
|
92e9fd4e52 | ||
|
|
d527b74952 | ||
|
|
e609b2ddf0 | ||
|
|
72ee30195f | ||
|
|
f95af30ca8 | ||
|
|
abd8871d42 | ||
|
|
63812a3193 | ||
|
|
7ff2340870 | ||
|
|
fae9f96bc2 | ||
|
|
8559511aa5 | ||
|
|
47c6ac56b5 | ||
|
|
6be96fb6be | ||
|
|
9dc9a78d98 | ||
|
|
9f75920404 | ||
|
|
c494718ca1 | ||
|
|
90e25633d3 | ||
|
|
e7203c28f5 | ||
|
|
e09ef1c244 | ||
|
|
7793616d77 | ||
|
|
24cc5139bc | ||
|
|
1ec9290775 | ||
|
|
bda5459147 | ||
|
|
20c0ac3820 | ||
|
|
902014834a | ||
|
|
4cb233d44c | ||
|
|
c2aa987393 | ||
|
|
164c9ea108 | ||
|
|
060efbf077 | ||
|
|
669947cb3d | ||
|
|
bb8c9c0733 | ||
|
|
04313e522c | ||
|
|
120c252078 | ||
|
|
fb093c286a | ||
|
|
d2cce041e3 | ||
|
|
0f22a5becd | ||
|
|
f74f7f1436 | ||
|
|
5d24b77951 | ||
|
|
318b6556bf | ||
|
|
ef43be9ffc | ||
|
|
9e55e434a4 | ||
|
|
57f8e00858 | ||
|
|
969837aa79 | ||
|
|
f6f29f7d5a | ||
|
|
7118b311b9 | ||
|
|
090f102c17 | ||
|
|
7708e85456 | ||
|
|
32d4924427 | ||
|
|
edca878c85 | ||
|
|
2932e2d45e | ||
|
|
c604224452 | ||
|
|
0243f3b0d6 | ||
|
|
a8e24bae62 | ||
|
|
a9b54a92b0 | ||
|
|
fdef9fe9e3 | ||
|
|
41ab817213 | ||
|
|
4763c797bc | ||
|
|
199467d160 | ||
|
|
e53b2870a8 | ||
|
|
ff571cf779 | ||
|
|
0273280d34 | ||
|
|
68e753dccd | ||
|
|
5d9dacea7f | ||
|
|
aa5e748ae4 | ||
|
|
b69188f755 | ||
|
|
1c8ceb32a5 | ||
|
|
ccc73856aa | ||
|
|
3753097216 | ||
|
|
41399fe197 | ||
|
|
2abee8a4da | ||
|
|
f9a4667137 | ||
|
|
123cfcf754 | ||
|
|
ed0a3df696 | ||
|
|
79ec373a49 | ||
|
|
81c631a077 | ||
|
|
07cda5e072 | ||
|
|
e8a8cd1284 | ||
|
|
0b85fc90aa | ||
|
|
601c4c0c67 | ||
|
|
dd72de5322 | ||
|
|
10d5080d4f | ||
|
|
7cc6a55b9f | ||
|
|
9add23946c | ||
|
|
7a59cb55fb | ||
|
|
e2179b4de6 | ||
|
|
58563fb488 | ||
|
|
d985c6c143 | ||
|
|
bab17cdb3b | ||
|
|
aa95a56ad1 | ||
|
|
d0728e9731 | ||
|
|
cb637546f2 | ||
|
|
2e1b83d209 | ||
|
|
1f0e7d3a4b | ||
|
|
a94640f229 | ||
|
|
42f7c6a22a | ||
|
|
2e1ed4903c | ||
|
|
3b4d6d24a2 | ||
|
|
ce93862e7a | ||
|
|
30682a7b03 | ||
|
|
fd31b952ca | ||
|
|
5187744647 | ||
|
|
add5afa9c4 | ||
|
|
12c789d31e | ||
|
|
3df86c29fd | ||
|
|
05573b8730 | ||
|
|
acb524e5e7 | ||
|
|
09feb8b32d | ||
|
|
a91fde9cf2 | ||
|
|
215190e701 | ||
|
|
0f4e6db3f9 | ||
|
|
31038e2c6d | ||
|
|
5e151d2e35 | ||
|
|
69e53f3655 | ||
|
|
61e1a4812a | ||
|
|
be875b7f3a | ||
|
|
733c2958e3 | ||
|
|
0e2f8154ff | ||
|
|
b18256a4b7 | ||
|
|
424b990382 | ||
|
|
7515b2dd5c | ||
|
|
5113864267 | ||
|
|
5f8cfd118c | ||
|
|
33aaa7fedf | ||
|
|
2ef2910b5e | ||
|
|
b0a9597fb6 | ||
|
|
a995aa77fa | ||
|
|
d9eb084d69 | ||
|
|
9c6ccb52ef | ||
|
|
efb56553fe | ||
|
|
f6e9509935 | ||
|
|
10432d8abf | ||
|
|
bdf094a262 | ||
|
|
c3d7f62341 | ||
|
|
492813cffc | ||
|
|
8cb7f9d7a1 | ||
|
|
c5a4f287b1 | ||
|
|
25f053daa5 | ||
|
|
5c06ac8896 | ||
|
|
0fc4668dea | ||
|
|
e71e6ceccf | ||
|
|
99454afd66 | ||
|
|
9e50d78a25 | ||
|
|
9ede286cbe | ||
|
|
ee951916f4 | ||
|
|
e5b541446e | ||
|
|
37a8997355 | ||
|
|
033e0a01a4 |
@@ -2,12 +2,14 @@
|
||||
path = third_party/op-plugin
|
||||
url = https://gitee.com/ascend/op-plugin.git
|
||||
ignore = dirty
|
||||
branch = 6.0.rc1
|
||||
[submodule "third_party/googletest"]
|
||||
path = third_party/googletest
|
||||
url = https://gitee.com/mirrors/googletest.git
|
||||
[submodule "third_party/torchair/torchair"]
|
||||
path = third_party/torchair/torchair
|
||||
url = https://gitee.com/ascend/torchair.git
|
||||
branch = 6.0.rc1
|
||||
[submodule "third_party/Tensorpipe"]
|
||||
path = third_party/Tensorpipe
|
||||
url = https://gitee.com/ascend/Tensorpipe.git
|
||||
|
||||
+8
-4
@@ -133,9 +133,9 @@ if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set(CMAKE_CXX_FLAGS "-fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -fPIE -pie ${CMAKE_CXX_FLAGS}")
|
||||
set(CXXFLAGS "-fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -fPIE -pie ${CXXFLAGS}")
|
||||
else()
|
||||
set(CMAKE_C_FLAGS "-fstack-protector-all -Wl,-z,relro,-z,now,-s,-z,noexecstack -fPIE -pie ${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "-fstack-protector-all -Wl,-z,relro,-z,now,-s,-z,noexecstack -fPIE -pie ${CMAKE_CXX_FLAGS}")
|
||||
set(CXXFLAGS "-fstack-protector-all -Wl,-z,relro,-z,now,-s,-z,noexecstack -fPIE -pie ${CXXFLAGS}")
|
||||
set(CMAKE_C_FLAGS "-fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -fPIE -pie ${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "-fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -fPIE -pie ${CMAKE_CXX_FLAGS}")
|
||||
set(CXXFLAGS "-fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -fPIE -pie ${CXXFLAGS}")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED BUILD_LIBTORCH)
|
||||
@@ -162,6 +162,7 @@ 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)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/third_party/Tensorpipe)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/third_party/profiler)
|
||||
|
||||
# Set installed PyTorch dir
|
||||
if(DEFINED PYTORCH_INSTALL_DIR)
|
||||
@@ -189,6 +190,7 @@ if (NOT DEFINED BUILD_LIBTORCH)
|
||||
set(NPU_SRCS)
|
||||
set(PROF_SRCS)
|
||||
set(UTILS_SRCS)
|
||||
set(SAN_SRCS)
|
||||
endif()
|
||||
|
||||
if (DEFINED BUILD_LIBTORCH)
|
||||
@@ -204,6 +206,7 @@ if (NOT DEFINED BUILD_LIBTORCH)
|
||||
add_subdirectory(${TORCHNPU_ROOT}/npu)
|
||||
add_subdirectory(${TORCHNPU_ROOT}/profiler)
|
||||
add_subdirectory(${TORCHNPU_ROOT}/utils)
|
||||
add_subdirectory(${TORCHNPU_ROOT}/sanitizer)
|
||||
endif()
|
||||
|
||||
if (DEFINED BUILD_LIBTORCH)
|
||||
@@ -211,6 +214,7 @@ if (DEFINED BUILD_LIBTORCH)
|
||||
endif()
|
||||
|
||||
set(OPS_PLUGIN_SRCS)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/profiler)
|
||||
# Add subdirectory of op-plugin
|
||||
include_directories(${PROJECT_SOURCE_DIR}/third_party/op-plugin)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/op-plugin/op_plugin)
|
||||
@@ -226,7 +230,7 @@ if (DEFINED BUILD_LIBTORCH)
|
||||
set(CPP_SRCS ${ATEN_SRCS} ${CORE_SRCS} ${OPS_PLUGIN_SRCS} ${FRAMEWORK_SRCS} ${NPU_CPP_LIBS_SRCS})
|
||||
else()
|
||||
# Compile code with pybind11
|
||||
set(CPP_SRCS ${ATEN_SRCS} ${CORE_SRCS} ${OPS_PLUGIN_SRCS} ${DIST_SRCS} ${FRAMEWORK_SRCS} ${NPU_SRCS} ${PROF_SRCS} ${UTILS_SRCS})
|
||||
set(CPP_SRCS ${ATEN_SRCS} ${CORE_SRCS} ${OPS_PLUGIN_SRCS} ${DIST_SRCS} ${FRAMEWORK_SRCS} ${NPU_SRCS} ${PROF_SRCS} ${UTILS_SRCS} ${SAN_SRCS})
|
||||
endif()
|
||||
|
||||
add_library(${PLUGIN_NAME} SHARED ${CPP_SRCS})
|
||||
|
||||
@@ -1,30 +1,78 @@
|
||||
BSD 3-Clause License
|
||||
From PyTorch:
|
||||
|
||||
Copyright (c) 2020, Huawei Technologies Co., Ltd
|
||||
Copyright (c) 2019, Facebook CORPORATION.
|
||||
Copyright (c) 2016- Facebook, Inc (Adam Paszke)
|
||||
Copyright (c) 2014- Facebook, Inc (Soumith Chintala)
|
||||
Copyright (c) 2011-2014 Idiap Research Institute (Ronan Collobert)
|
||||
Copyright (c) 2012-2014 Deepmind Technologies (Koray Kavukcuoglu)
|
||||
Copyright (c) 2011-2012 NEC Laboratories America (Koray Kavukcuoglu)
|
||||
Copyright (c) 2011-2013 NYU (Clement Farabet)
|
||||
Copyright (c) 2006-2010 NEC Laboratories America (Ronan Collobert, Leon Bottou, Iain Melvin, Jason Weston)
|
||||
Copyright (c) 2006 Idiap Research Institute (Samy Bengio)
|
||||
Copyright (c) 2001-2004 Idiap Research Institute (Ronan Collobert, Samy Bengio, Johnny Mariethoz)
|
||||
|
||||
From Caffe2:
|
||||
|
||||
Copyright (c) 2016-present, Facebook Inc. All rights reserved.
|
||||
|
||||
All contributions by Facebook:
|
||||
Copyright (c) 2016 Facebook Inc.
|
||||
|
||||
All contributions by Google:
|
||||
Copyright (c) 2015 Google Inc.
|
||||
All rights reserved.
|
||||
|
||||
All contributions by Yangqing Jia:
|
||||
Copyright (c) 2015 Yangqing Jia
|
||||
All rights reserved.
|
||||
|
||||
All contributions by Kakao Brain:
|
||||
Copyright 2019-2020 Kakao Brain
|
||||
|
||||
All contributions by Cruise LLC:
|
||||
Copyright (c) 2022 Cruise LLC.
|
||||
All rights reserved.
|
||||
|
||||
All contributions from Caffe:
|
||||
Copyright(c) 2013, 2014, 2015, the respective contributors
|
||||
All rights reserved.
|
||||
|
||||
All other contributions:
|
||||
Copyright(c) 2015, 2016 the respective contributors
|
||||
All rights reserved.
|
||||
|
||||
Caffe2 uses a copyright model similar to Caffe: each contributor holds
|
||||
copyright over their contributions to Caffe2. The project versioning records
|
||||
all such contribution and copyright details. If a contributor wants to further
|
||||
mark their specific copyright on a particular contribution, they should
|
||||
indicate their copyright solely in the commit message of the change when it is
|
||||
committed.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
3. Neither the names of Facebook, Deepmind Technologies, NYU, NEC Laboratories America
|
||||
and IDIAP Research Institute nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -2,14 +2,13 @@ approvers:
|
||||
- weili10
|
||||
- li_jing_hw
|
||||
- clinglai
|
||||
- guang-jun-zhang2
|
||||
- xuepenginnanjing
|
||||
- yskhhh
|
||||
- brightlyking
|
||||
- wangjiangben_hw
|
||||
- zhangzhongzt
|
||||
- wangchao285
|
||||
- atlasaccount
|
||||
- chenhao_1209
|
||||
- dilililiwhy
|
||||
reviewers:
|
||||
- xiaxia3
|
||||
- ascendzyj
|
||||
@@ -58,3 +57,4 @@ reviewers:
|
||||
- li-xulong
|
||||
- wang-guangbin
|
||||
- chuboning
|
||||
- chen-vvjob
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# PyTorch Ascend Adapter
|
||||
# Ascend Extension for PyTorch
|
||||
|
||||
## Overview
|
||||
|
||||
This repository develops the **PyTorch Ascend Adapter** named **torch_npu** to adapt **Ascend NPU** to **PyTorch** so that developers who use the **PyTorch** can obtain powerful compute capabilities of **Ascend AI Processors**.
|
||||
This repository develops the **PyTorch Extension** named **torch_npu** to adapt **Ascend NPU** to **PyTorch** so that developers who use the **PyTorch** can obtain powerful compute capabilities of **Ascend AI Processors**.
|
||||
|
||||
Ascend is a full-stack AI computing infrastructure for industry applications and services based on Huawei Ascend processors and software. For more information about Ascend, see [Ascend Community](https://www.hiascend.com/en/).
|
||||
|
||||
@@ -51,17 +51,17 @@ If the installation fails, use the download link or visit the [PyTorch official
|
||||
3. **Install torch-npu**
|
||||
|
||||
```
|
||||
pip3 install torch-npu==2.1.0rc1
|
||||
pip3 install torch-npu==2.1.0.post3
|
||||
```
|
||||
|
||||
### From Source
|
||||
|
||||
In some special scenarios, users may need to compile **torch-npu** by themselves.Select a branch in table [Ascend Auxiliary Software](#ascend-auxiliary-software) and a Python version in table [PyTorch and Python Version Matching Table](#pytorch-and-python-version-matching-table) first. The docker image is recommended for compiling torch-npu through the following steps:
|
||||
In some special scenarios, users may need to compile **torch-npu** by themselves.Select a branch in table [Ascend Auxiliary Software](#ascend-auxiliary-software) and a Python version in table [PyTorch and Python Version Matching Table](#pytorch-and-python-version-matching-table) first. The docker image is recommended for compiling torch-npu through the following steps(It is recommended to mount the working path only and avoid the system path to reduce security risks), the generated .whl file path is ./dist/:
|
||||
|
||||
1. **Clone torch-npu**
|
||||
|
||||
```
|
||||
git clone https://github.com/ascend/pytorch.git -b v2.1.0-5.0.rc3 --depth 1
|
||||
git clone https://github.com/ascend/pytorch.git -b v2.1.0-6.0.rc1 --depth 1
|
||||
```
|
||||
|
||||
2. **Build Docker Image**
|
||||
@@ -115,264 +115,51 @@ print(z)
|
||||
|
||||
## User Manual
|
||||
|
||||
Refer to [API of PyTorch Ascend Adapter](docs/api/torch_npu_apis.md) for more detailed informations.
|
||||
Refer to [API of Ascend Extension for Pytorch](docs/api/torch_npu_apis.md) for more detailed informations.
|
||||
|
||||
## PyTorch and Python Version Matching Table
|
||||
|
||||
| PyTorch Version | Python Version |
|
||||
| ------------- | :----------------------------------------------------------- |
|
||||
| PyTorch1.11.0 | Python3.7.x(>=3.7.5),Python3.8.x,Python3.9.x,Python3.10.x |
|
||||
| PyTorch2.0.1 | Python3.8.x,Python3.9.x,Python3.10.x |
|
||||
| PyTorch2.1.0 | Python3.8.x,Python3.9.x,Python3.10.x |
|
||||
| PyTorch2.2.0 | Python3.8.x,Python3.9.x,Python3.10.x |
|
||||
|
||||
## Ascend Auxiliary Software
|
||||
|
||||
<table><thead align="left"><tr id="row721911327225"><th class="cellrowborder" valign="top" id="mcps1.2.6.1.1"><p id="p0878358152310"><a name="p0878358152310"></a><a name="p0878358152310"></a>CANN Version</p>
|
||||
</th>
|
||||
<th class="cellrowborder" valign="top" id="mcps1.2.6.1.2"><p id="p1833820270243"><a name="p1833820270243"></a><a name="p1833820270243"></a>Supported PyTorch Version</p>
|
||||
</th>
|
||||
<th class="cellrowborder" valign="top" id="mcps1.2.6.1.3"><p id="p7878175817236"><a name="p7878175817236"></a><a name="p7878175817236"></a>Supported Adapter Version</p>
|
||||
</th>
|
||||
<th class="cellrowborder" valign="top" id="mcps1.2.6.1.4"><p id="p58781058202311"><a name="p58781058202311"></a><a name="p58781058202311"></a>Github Branch</p>
|
||||
</th>
|
||||
<th class="cellrowborder" valign="top" id="mcps1.2.6.1.5"><p id="p1887865812234"><a name="p1887865812234"></a><a name="p1887865812234"></a>AscendHub Image Version/Name(<a href="https://ascendhub.huawei.com/#/detail/pytorch-modelzoo" target="_blank" rel="noopener noreferrer">Link</a>)</p>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr id="row1121913217224"><td class="cellrowborder" rowspan="3" valign="top" headers="mcps1.2.6.1.1 "><p id="p387812581238"><a name="p387812581238"></a><a name="p387812581238"></a>7.0.RC1.alpha003</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p633892712241"><a name="p633892712241"></a><a name="p633892712241"></a>2.1.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p13878165862310"><a name="p13878165862310"></a><a name="p13878165862310"></a>2.1.0.rc1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p5878658162312"><a name="p5878658162312"></a><a name="p5878658162312"></a>v2.1.0-5.0.rc3</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p1887895818234"><a name="p1887895818234"></a><a name="p1887895818234"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row122191232122216"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p1333872762420"><a name="p1333872762420"></a><a name="p1333872762420"></a>2.0.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p08788581239"><a name="p08788581239"></a><a name="p08788581239"></a>2.0.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p88793589233"><a name="p88793589233"></a><a name="p88793589233"></a>v2.0.1-5.0.rc3</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p18791958192318"><a name="p18791958192318"></a><a name="p18791958192318"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row1220113211225"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p16339162718249"><a name="p16339162718249"></a><a name="p16339162718249"></a>1.11.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p587919583231"><a name="p587919583231"></a><a name="p587919583231"></a>1.11.0.post4</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p1879185852316"><a name="p1879185852316"></a><a name="p1879185852316"></a>v1.11.0-5.0.rc3</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p987915814231"><a name="p987915814231"></a><a name="p987915814231"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row92207321228"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p5879195862316"><a name="p5879195862316"></a><a name="p5879195862316"></a>CANN 6.3.RC3.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p13391127102419"><a name="p13391127102419"></a><a name="p13391127102419"></a>1.11.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p987935812311"><a name="p987935812311"></a><a name="p987935812311"></a>1.11.0.post3</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p178797587233"><a name="p178797587233"></a><a name="p178797587233"></a>v1.11.0-5.0.rc2.2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p16879458102316"><a name="p16879458102316"></a><a name="p16879458102316"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row17220143220221"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p287917582235"><a name="p287917582235"></a><a name="p287917582235"></a>CANN 6.3.RC3</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p933902762410"><a name="p933902762410"></a><a name="p933902762410"></a>1.11.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p10879135819230"><a name="p10879135819230"></a><a name="p10879135819230"></a>1.11.0.post2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p17879125816231"><a name="p17879125816231"></a><a name="p17879125816231"></a>v1.11.0-5.0.rc2.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p10879155882310"><a name="p10879155882310"></a><a name="p10879155882310"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row422116324224"><td class="cellrowborder" rowspan="3" valign="top" headers="mcps1.2.6.1.1 "><p id="p13879165832316"><a name="p13879165832316"></a><a name="p13879165832316"></a>CANN 6.3.RC2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p1191901662516"><a name="p1191901662516"></a><a name="p1191901662516"></a>2.0.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p198791258142317"><a name="p198791258142317"></a><a name="p198791258142317"></a>2.0.1.rc1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p1587955816237"><a name="p1587955816237"></a><a name="p1587955816237"></a>v2.0.1-5.0.rc2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p0879558192313"><a name="p0879558192313"></a><a name="p0879558192313"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row1522123282216"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p19191169254"><a name="p19191169254"></a><a name="p19191169254"></a>1.11.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p4879185815238"><a name="p4879185815238"></a><a name="p4879185815238"></a>1.8.1.post2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p887935810232"><a name="p887935810232"></a><a name="p887935810232"></a>v1.8.1-5.0.rc2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p14879358172313"><a name="p14879358172313"></a><a name="p14879358172313"></a>23.0.RC1-1.8.1</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row19716641182317"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p691981615257"><a name="p691981615257"></a><a name="p691981615257"></a>1.8.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p208791758142314"><a name="p208791758142314"></a><a name="p208791758142314"></a>1.11.0.post1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p1987935852319"><a name="p1987935852319"></a><a name="p1987935852319"></a>v1.11.0-5.0.rc2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p1087918585237"><a name="p1087918585237"></a><a name="p1087918585237"></a>23.0.RC1-1.11.0</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row822143252217"><td class="cellrowborder" rowspan="2" valign="top" headers="mcps1.2.6.1.1 "><p id="p108803589235"><a name="p108803589235"></a><a name="p108803589235"></a>CANN 6.3.RC1</p>
|
||||
<p id="p129081558152312"><a name="p129081558152312"></a><a name="p129081558152312"></a></p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p12346162018257"><a name="p12346162018257"></a><a name="p12346162018257"></a>1.11.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p6880205814236"><a name="p6880205814236"></a><a name="p6880205814236"></a>1.8.1.post1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p6880258162313"><a name="p6880258162313"></a><a name="p6880258162313"></a>v1.8.1-5.0.rc1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p08807589236"><a name="p08807589236"></a><a name="p08807589236"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row13745135213239"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p183463202251"><a name="p183463202251"></a><a name="p183463202251"></a>1.8.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p1888019580230"><a name="p1888019580230"></a><a name="p1888019580230"></a>1.11.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p15880105813236"><a name="p15880105813236"></a><a name="p15880105813236"></a>v1.11.0-5.0.rc1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p1588012586230"><a name="p1588012586230"></a><a name="p1588012586230"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row1667135119236"><td class="cellrowborder" rowspan="3" valign="top" headers="mcps1.2.6.1.1 "><p id="p188801958102315"><a name="p188801958102315"></a><a name="p188801958102315"></a>CANN 6.0.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p43395279244"><a name="p43395279244"></a><a name="p43395279244"></a>1.5.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p118801658182310"><a name="p118801658182310"></a><a name="p118801658182310"></a>1.5.0.post8</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p4880125819233"><a name="p4880125819233"></a><a name="p4880125819233"></a>v1.5.0-3.0.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p8880858122319"><a name="p8880858122319"></a><a name="p8880858122319"></a>22.0.0</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row123884481236"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p0339162717244"><a name="p0339162717244"></a><a name="p0339162717244"></a>1.8.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p15880115811236"><a name="p15880115811236"></a><a name="p15880115811236"></a>1.8.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p68808584233"><a name="p68808584233"></a><a name="p68808584233"></a>v1.8.1-3.0.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p1688035812238"><a name="p1688035812238"></a><a name="p1688035812238"></a>22.0.0-1.8.1</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row133914572237"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p10339102719241"><a name="p10339102719241"></a><a name="p10339102719241"></a>1.11.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p9880205892318"><a name="p9880205892318"></a><a name="p9880205892318"></a>1.11.0.rc2(beta)</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p888005822314"><a name="p888005822314"></a><a name="p888005822314"></a>v1.11.0-3.0.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p6880145812238"><a name="p6880145812238"></a><a name="p6880145812238"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row127654514238"><td class="cellrowborder" rowspan="3" valign="top" headers="mcps1.2.6.1.1 "><p id="p1288085862314"><a name="p1288085862314"></a><a name="p1288085862314"></a>CANN 6.0.RC1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p20327103216255"><a name="p20327103216255"></a><a name="p20327103216255"></a>1.5.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p7880145811235"><a name="p7880145811235"></a><a name="p7880145811235"></a>1.5.0.post7</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p1788095815239"><a name="p1788095815239"></a><a name="p1788095815239"></a>v1.5.0-3.0.rc3</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p6880115810237"><a name="p6880115810237"></a><a name="p6880115810237"></a>22.0.RC3</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row129461142152313"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p14327173292510"><a name="p14327173292510"></a><a name="p14327173292510"></a>1.8.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p1588035812311"><a name="p1588035812311"></a><a name="p1588035812311"></a>1.8.1.rc3</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p13880165816233"><a name="p13880165816233"></a><a name="p13880165816233"></a>v1.8.1-3.0.rc3</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p108806581238"><a name="p108806581238"></a><a name="p108806581238"></a>22.0.RC3-1.8.1</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row36411150122319"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p1132743211257"><a name="p1132743211257"></a><a name="p1132743211257"></a>1.11.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p168800589238"><a name="p168800589238"></a><a name="p168800589238"></a>1.11.0.rc1(beta)</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p28816580233"><a name="p28816580233"></a><a name="p28816580233"></a>v1.11.0-3.0.rc3</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p198811588236"><a name="p198811588236"></a><a name="p198811588236"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row12371144713235"><td class="cellrowborder" rowspan="2" valign="top" headers="mcps1.2.6.1.1 "><p id="p11881558122317"><a name="p11881558122317"></a><a name="p11881558122317"></a>CANN 5.1.RC2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p629873412510"><a name="p629873412510"></a><a name="p629873412510"></a>1.5.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p3881105818236"><a name="p3881105818236"></a><a name="p3881105818236"></a>1.5.0.post6</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p1088125852319"><a name="p1088125852319"></a><a name="p1088125852319"></a>v1.5.0-3.0.rc2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p20881258112316"><a name="p20881258112316"></a><a name="p20881258112316"></a>22.0.RC2</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row14956184342315"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p929893462515"><a name="p929893462515"></a><a name="p929893462515"></a>1.8.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p688120581238"><a name="p688120581238"></a><a name="p688120581238"></a>1.8.1.rc2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p198819587236"><a name="p198819587236"></a><a name="p198819587236"></a>v1.8.1-3.0.rc2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p1388175832319"><a name="p1388175832319"></a><a name="p1388175832319"></a>22.0.RC2-1.8.1</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row1522133210223"><td class="cellrowborder" rowspan="2" valign="top" headers="mcps1.2.6.1.1 "><p id="p7881205813233"><a name="p7881205813233"></a><a name="p7881205813233"></a>CANN 5.1.RC1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p1610094112517"><a name="p1610094112517"></a><a name="p1610094112517"></a>1.5.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p12881165818235"><a name="p12881165818235"></a><a name="p12881165818235"></a>1.5.0.post5</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p14881105892315"><a name="p14881105892315"></a><a name="p14881105892315"></a>v1.5.0-3.0.rc1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p5881115812234"><a name="p5881115812234"></a><a name="p5881115812234"></a>22.0.RC1</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row182218327224"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p19100441202520"><a name="p19100441202520"></a><a name="p19100441202520"></a>1.8.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p688165810235"><a name="p688165810235"></a><a name="p688165810235"></a>1.8.1.rc1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p6881195818236"><a name="p6881195818236"></a><a name="p6881195818236"></a>v1.8.1-3.0.rc1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p58817582239"><a name="p58817582239"></a><a name="p58817582239"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row137028392234"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p208815585236"><a name="p208815585236"></a><a name="p208815585236"></a>CANN 5.0.4</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p1289474162511"><a name="p1289474162511"></a><a name="p1289474162511"></a>1.5.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p68812058102318"><a name="p68812058102318"></a><a name="p68812058102318"></a>1.5.0.post4</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p17881658122311"><a name="p17881658122311"></a><a name="p17881658122311"></a>2.0.4.tr5</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p1588119588233"><a name="p1588119588233"></a><a name="p1588119588233"></a>21.0.4</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row182227322224"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p1188113584232"><a name="p1188113584232"></a><a name="p1188113584232"></a>CANN 5.0.3</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p1389417414253"><a name="p1389417414253"></a><a name="p1389417414253"></a>1.8.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p14881358112314"><a name="p14881358112314"></a><a name="p14881358112314"></a>1.5.0.post3</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p9881205862316"><a name="p9881205862316"></a><a name="p9881205862316"></a>2.0.3.tr5</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p68811858122317"><a name="p68811858122317"></a><a name="p68811858122317"></a>21.0.3</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row17222203202219"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p68814580234"><a name="p68814580234"></a><a name="p68814580234"></a>CANN 5.0.2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p610954522514"><a name="p610954522514"></a><a name="p610954522514"></a>1.5.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p1882758112318"><a name="p1882758112318"></a><a name="p1882758112318"></a>1.5.0.post2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p988215589234"><a name="p988215589234"></a><a name="p988215589234"></a>2.0.2.tr5</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p6882115811231"><a name="p6882115811231"></a><a name="p6882115811231"></a>21.0.2</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
**PyTorch Extension** versions follow the naming convention `{PyTorch version}-{Ascend version}`, where the former represents the PyTorch version compatible with the **PyTorch Extension**, and the latter is used to match the CANN version. The detailed matching is as follows:
|
||||
|
||||
| CANN Version | Supported PyTorch Version | Supported Extension Version | Github Branch | AscendHub Image Version/Name([Link](https://ascendhub.huawei.com/#/detail/pytorch-modelzoo)) |
|
||||
|----------------|--------------|-------------------|-------------------|----------------------|
|
||||
| CANN 8.0.RC1 | 2.2.0 | 2.2.0 | v2.2.0-6.0.rc1 | - |
|
||||
| | 2.1.0 | 2.1.0.post3 | v2.1.0-6.0.rc1 | - |
|
||||
| | 1.11.0 | 1.11.0.post11 | v1.11.0-6.0.rc1 | - |
|
||||
| CANN 7.0.0 | 2.1.0 | 2.1.0 | v2.1.0-5.0.0 | - |
|
||||
| | 2.0.1 | 2.0.1.post1 | v2.0.1-5.0.0 | - |
|
||||
| | 1.11.0 | 1.11.0.post8 | v1.11.0-5.0.0 | - |
|
||||
| CANN 7.0.RC1 | 2.1.0 | 2.1.0.rc1 | v2.1.0-5.0.rc3 | - |
|
||||
| | 2.0.1 | 2.0.1 | v2.0.1-5.0.rc3 | - |
|
||||
| | 1.11.0 | 1.11.0.post4 | v1.11.0-5.0.rc3 | - |
|
||||
| CANN 6.3.RC3.1 | 1.11.0 | 1.11.0.post3 | v1.11.0-5.0.rc2.2 | - |
|
||||
| CANN 6.3.RC3 | 1.11.0 | 1.11.0.post2 | v1.11.0-5.0.rc2.1 | - |
|
||||
| CANN 6.3.RC2 | 2.0.1 | 2.0.1.rc1 | v2.0.1-5.0.rc2 | - |
|
||||
| | 1.11.0 | 1.11.0.post1 | v1.11.0-5.0.rc2 | 23.0.RC1-1.11.0 |
|
||||
| | 1.8.1 | 1.8.1.post2 | v1.8.1-5.0.rc2 | 23.0.RC1-1.8.1 |
|
||||
| CANN 6.3.RC1 | 1.11.0 | 1.11.0 | v1.11.0-5.0.rc1 | - |
|
||||
| | 1.8.1 | 1.8.1.post1 | v1.8.1-5.0.rc1 | - |
|
||||
| CANN 6.0.1 | 1.5.0 | 1.5.0.post8 | v1.5.0-3.0.0 | 22.0.0 |
|
||||
| | 1.8.1 | 1.8.1 | v1.8.1-3.0.0 | 22.0.0-1.8.1 |
|
||||
| | 1.11.0 | 1.11.0.rc2(beta) | v1.11.0-3.0.0 | - |
|
||||
| CANN 6.0.RC1 | 1.5.0 | 1.5.0.post7 | v1.5.0-3.0.rc3 | 22.0.RC3 |
|
||||
| | 1.8.1 | 1.8.1.rc3 | v1.8.1-3.0.rc3 | 22.0.RC3-1.8.1 |
|
||||
| | 1.11.0 | 1.11.0.rc1(beta) | v1.11.0-3.0.rc3 | - |
|
||||
| CANN 5.1.RC2 | 1.5.0 | 1.5.0.post6 | v1.5.0-3.0.rc2 | 22.0.RC2 |
|
||||
| | 1.8.1 | 1.8.1.rc2 | v1.8.1-3.0.rc2 | 22.0.RC2-1.8.1 |
|
||||
| CANN 5.1.RC1 | 1.5.0 | 1.5.0.post5 | v1.5.0-3.0.rc1 | 22.0.RC1 |
|
||||
| | 1.8.1 | 1.8.1.rc1 | v1.8.1-3.0.rc1 | - |
|
||||
| CANN 5.0.4 | 1.5.0 | 1.5.0.post4 | 2.0.4.tr5 | 21.0.4 |
|
||||
| CANN 5.0.3 | 1.8.1 | 1.5.0.post3 | 2.0.3.tr5 | 21.0.3 |
|
||||
| CANN 5.0.2 | 1.5.0 | 1.5.0.post2 | 2.0.2.tr5 | 21.0.2 |
|
||||
|
||||
## Suggestions and Communication
|
||||
|
||||
@@ -386,25 +173,32 @@ The version branches of AscendPyTorch have the following maintenance phases:
|
||||
|-------------------|--------------|--------------------------------------------------------------------------------------------------------------------------------|
|
||||
| Planning | 1-3 months | Plan features. |
|
||||
| Development | 3 months | Develop features. |
|
||||
| Maintained | 6-12 months | Allow the incorporation of all resolved issues and release the version. |
|
||||
| Maintained | 6-12 months | Allow the incorporation of all resolved issues and release the version, Different versions of PyTorch adopt varying support policies. The maintenance periods for Regular Releases and Long-Term Support versions are 6 months and 12 months, respectively. |
|
||||
| Unmaintained | 0-3 months | Allow the incorporation of all resolved issues. No dedicated maintenance personnel are available. No version will be released. |
|
||||
| End Of Life (EOL) | N/A | Do not accept any modification to a branch. |
|
||||
|
||||
## Maintenance Status of Existing Branches
|
||||
## PyTorch Maintenance Policies
|
||||
|
||||
| **Branch Name** | **Status** | **Launch Date** | **Subsequent Status** | **EOL Date** |
|
||||
| --------------- | ---------- | --------------- | --------------------------------------- | ------------ |
|
||||
| **v2.0.2** | EOL | 2021/7/29 | N/A | |
|
||||
| **v2.0.3** | EOL | 2021/10/15 | N/A | |
|
||||
| **v2.0.4** | EOL | 2022/1/15 | N/A | |
|
||||
| **v3.0.rc1** | EOL | 2022/4/10 | N/A | |
|
||||
| **v3.0.rc2** | EOL | 2022/7/15 | N/A | |
|
||||
| **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 | |
|
||||
| **v5.0.rc1** | Maintained | 2023/4/19 | Unmaintained <br> 2024-4-19 estimated | |
|
||||
| **v5.0.rc2** | Maintained | 2023/7/19 | Unmaintained <br> 2024-7-19 estimated | |
|
||||
| **v5.0.rc3** | Maintained | 2023/10/15 | Unmaintained <br> 2024-10-15 estimated | |
|
||||
| **PyTorch** | **Maintenance Policies** | **Status** | **Launch Date** | **Subsequent Status** | **EOL Date** |
|
||||
|-----------|--------------------|--------------|------------|-----------------|-----------|
|
||||
| 2.2.0 | Regular Release | Maintained | 2024/04/01 | Unmaintained 2024-10-15 estimated | |
|
||||
| 2.1.0 | Long Term Support | Maintained | 2023/10/15 | Unmaintained 2024-10-15 estimated | |
|
||||
| 2.0.1 | Regular Release | EOL | 2023/7/19 | | 2024/3/14 |
|
||||
| 1.11.0 | Long Term Support | Maintained | 2023/4/19 | Unmaintained 2024-4-19 estimated | |
|
||||
| 1.8.1 | Long Term Support | EOL | 2022/4/10 | | 2023/4/10 |
|
||||
| 1.5.0 | Long Term Support | EOL | 2021/7/29 | | 2022/7/29 |
|
||||
|
||||
## Reference Documents
|
||||
|
||||
For more detailed information on installation guides, model migration, training/inference tutorials, and API lists, please refer to the [Ascend Extension for Pytorch on the HiAI Community](https://www.hiascend.com/software/ai-frameworks/commercial).
|
||||
|
||||
| Document Name | Document Link |
|
||||
| -------------------------------- | ------------------------------------------------------------ |
|
||||
| AscendPyTorch Installation Guide | [link](https://www.hiascend.com/document/detail/zh/Pytorch/60RC1/quickstart/instg) |
|
||||
| AscendPyTorch Network Model Migration and Training | [link](https://www.hiascend.com/document/detail/zh/Pytorch/60RC1/ptmoddevg/trainingmigrguide/PT_LMTMOG_0003.html) |
|
||||
| AscendPyTorch Operator Adaptation | [link](https://www.hiascend.com/document/detail/zh/canncommercial/700/operatordev/tbeaicpudevg/atlasopdev_10_0086.html) |
|
||||
| AscendPyTorch API List (PyTorch and Custom Interfaces) | [link](https://www.hiascend.com/document/detail/zh/Pytorch/60RC1/apiref/apilist/ptaoplist_000002.html) |
|
||||
|
||||
## License
|
||||
|
||||
PyTorch Ascend Adapter has a BSD-style license, as found in the [LICENSE](LICENSE) file.
|
||||
Ascend Extension for Pytorch has a BSD-style license, as found in the [LICENSE](LICENSE) file.
|
||||
|
||||
+78
-269
@@ -1,8 +1,8 @@
|
||||
# PyTorch Ascend Adapter插件
|
||||
# Ascend Extension for Pytorch
|
||||
|
||||
## 简介
|
||||
|
||||
本项目开发了名为**torch_npu**的**PyTorch Ascend Adapter**插件,使昇腾NPU可以适配PyTorch框架,为使用PyTorch框架的开发者提供昇腾AI处理器的超强算力。
|
||||
本项目开发了名为**torch_npu**的**PyTorch Extension**插件,使昇腾NPU可以适配PyTorch框架,为使用PyTorch框架的开发者提供昇腾AI处理器的超强算力。
|
||||
|
||||
昇腾为基于华为昇腾处理器和软件的行业应用及服务提供全栈AI计算基础设施。您可以通过访问[昇腾社区](https://www.hiascend.com/zh/),了解关于昇腾的更多信息。
|
||||
|
||||
@@ -41,7 +41,7 @@ pip3 install torch==2.1.0+cpu --index-url https://download.pytorch.org/whl/cpu
|
||||
|
||||
2. **安装torch_npu依赖**
|
||||
|
||||
运行一下命令安装依赖。
|
||||
运行以下命令安装依赖。
|
||||
|
||||
```Python
|
||||
pip3 install pyyaml
|
||||
@@ -51,17 +51,18 @@ pip3 install setuptools
|
||||
3. **安装torch_npu**
|
||||
|
||||
```
|
||||
pip3 install torch-npu==2.1.0rc1
|
||||
pip3 install torch-npu==2.1.0.post3
|
||||
```
|
||||
如需要保存安装日志,可在pip3 install命令后面加上参数 `--log <PATH>`,并对您指定的目录`<PATH>`做好权限管控。
|
||||
|
||||
### 使用源代码进行安装
|
||||
|
||||
某些特殊场景下,用户可能需要自行编译**torch_npu**。可以根据[昇腾辅助软件表](#昇腾辅助软件)和[PyTorch与Python版本配套表](#PyTorch与Python版本配套表)选择合适的分支。推荐使用Docker镜像编译**torch_npu**,可以通过以下步骤获取:
|
||||
某些特殊场景下,用户可能需要自行编译**torch_npu**。可以根据[昇腾辅助软件表](#昇腾辅助软件)和[PyTorch与Python版本配套表](#PyTorch与Python版本配套表)选择合适的分支。推荐使用Docker镜像编译**torch_npu**,可以通过以下步骤获取(建议只挂载工作路径,并避开系统路径,以降低安全风险), 生成的.whl文件路径为./dist/:
|
||||
|
||||
1. **克隆torch_npu代码仓**
|
||||
|
||||
```
|
||||
git clone https://gitee.com/ascend/pytorch.git -b v2.1.0-5.0.rc3 --depth 1
|
||||
git clone https://gitee.com/ascend/pytorch.git -b v2.1.0-6.0.rc1 --depth 1
|
||||
```
|
||||
|
||||
2. **构建镜像**
|
||||
@@ -88,6 +89,16 @@ pip3 install torch-npu==2.1.0rc1
|
||||
```
|
||||
|
||||
|
||||
## 卸载
|
||||
Pytorch框架训练环境的卸载可以参考[昇腾官方文档](https://www.hiascend.com/document/detail/zh/ModelZoo/pytorchframework/ptes/ptes_00032.html)。
|
||||
|
||||
torch_npu的卸载只需执行命令:
|
||||
|
||||
```
|
||||
pip3 uninstall torch_npu
|
||||
```
|
||||
|
||||
如需要保存卸载日志,可在pip3 uninstall命令后面加上参数 `--log <PATH>`,并对您指定的目录`<PATH>`做好权限管控。
|
||||
|
||||
## 入门
|
||||
|
||||
@@ -120,258 +131,44 @@ print(z)
|
||||
| PyTorch版本 | Python版本 |
|
||||
| ------------- | :----------------------------------------------------------- |
|
||||
| PyTorch1.11.0 | Python3.7.x(>=3.7.5), Python3.8.x, Python3.9.x, Python3.10.x |
|
||||
| PyTorch2.0.1 | Python3.8.x, Python3.9.x, Python3.10.x |
|
||||
| PyTorch2.1.0 | Python3.8.x, Python3.9.x, Python3.10.x |
|
||||
| PyTorch2.2.0 | Python3.8.x, Python3.9.x, Python3.10.x |
|
||||
|
||||
## 昇腾辅助软件
|
||||
|
||||
<table><thead align="left"><tr id="row721911327225"><th class="cellrowborder" valign="top" id="mcps1.2.6.1.1"><p id="p0878358152310"><a name="p0878358152310"></a><a name="p0878358152310"></a>CANN版本</p>
|
||||
</th>
|
||||
<th class="cellrowborder" valign="top" id="mcps1.2.6.1.2"><p id="p1833820270243"><a name="p1833820270243"></a><a name="p1833820270243"></a>支持的PyTorch版本</p>
|
||||
</th>
|
||||
<th class="cellrowborder" valign="top" id="mcps1.2.6.1.3"><p id="p7878175817236"><a name="p7878175817236"></a><a name="p7878175817236"></a>支持的Adapter版本</p>
|
||||
</th>
|
||||
<th class="cellrowborder" valign="top" id="mcps1.2.6.1.4"><p id="p58781058202311"><a name="p58781058202311"></a><a name="p58781058202311"></a>Github分支</p>
|
||||
</th>
|
||||
<th class="cellrowborder" valign="top" id="mcps1.2.6.1.5"><p id="p1887865812234"><a name="p1887865812234"></a><a name="p1887865812234"></a>AscendHub镜像版本/名称(<a href="https://ascendhub.huawei.com/#/detail/pytorch-modelzoo" target="_blank" rel="noopener noreferrer">链接</a>)</p>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr id="row1121913217224"><td class="cellrowborder" rowspan="3" valign="top" headers="mcps1.2.6.1.1 "><p id="p387812581238"><a name="p387812581238"></a><a name="p387812581238"></a>CANN 7.0.RC1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p633892712241"><a name="p633892712241"></a><a name="p633892712241"></a>2.1.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p13878165862310"><a name="p13878165862310"></a><a name="p13878165862310"></a>2.1.0.rc1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p5878658162312"><a name="p5878658162312"></a><a name="p5878658162312"></a>v2.1.0-5.0.rc3</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p1887895818234"><a name="p1887895818234"></a><a name="p1887895818234"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row122191232122216"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p1333872762420"><a name="p1333872762420"></a><a name="p1333872762420"></a>2.0.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p08788581239"><a name="p08788581239"></a><a name="p08788581239"></a>2.0.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p88793589233"><a name="p88793589233"></a><a name="p88793589233"></a>v2.0.1-5.0.rc3</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p18791958192318"><a name="p18791958192318"></a><a name="p18791958192318"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row1220113211225"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p16339162718249"><a name="p16339162718249"></a><a name="p16339162718249"></a>1.11.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p587919583231"><a name="p587919583231"></a><a name="p587919583231"></a>1.11.0.post4</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p1879185852316"><a name="p1879185852316"></a><a name="p1879185852316"></a>v1.11.0-5.0.rc3</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p987915814231"><a name="p987915814231"></a><a name="p987915814231"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row92207321228"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p5879195862316"><a name="p5879195862316"></a><a name="p5879195862316"></a>CANN 6.3.RC3.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p13391127102419"><a name="p13391127102419"></a><a name="p13391127102419"></a>1.11.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p987935812311"><a name="p987935812311"></a><a name="p987935812311"></a>1.11.0.post3</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p178797587233"><a name="p178797587233"></a><a name="p178797587233"></a>v1.11.0-5.0.rc2.2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p16879458102316"><a name="p16879458102316"></a><a name="p16879458102316"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row17220143220221"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p287917582235"><a name="p287917582235"></a><a name="p287917582235"></a>CANN 6.3.RC3</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p933902762410"><a name="p933902762410"></a><a name="p933902762410"></a>1.11.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p10879135819230"><a name="p10879135819230"></a><a name="p10879135819230"></a>1.11.0.post2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p17879125816231"><a name="p17879125816231"></a><a name="p17879125816231"></a>v1.11.0-5.0.rc2.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p10879155882310"><a name="p10879155882310"></a><a name="p10879155882310"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row422116324224"><td class="cellrowborder" rowspan="3" valign="top" headers="mcps1.2.6.1.1 "><p id="p13879165832316"><a name="p13879165832316"></a><a name="p13879165832316"></a>CANN 6.3.RC2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p1191901662516"><a name="p1191901662516"></a><a name="p1191901662516"></a>2.0.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p198791258142317"><a name="p198791258142317"></a><a name="p198791258142317"></a>2.0.1.rc1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p1587955816237"><a name="p1587955816237"></a><a name="p1587955816237"></a>v2.0.1-5.0.rc2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p0879558192313"><a name="p0879558192313"></a><a name="p0879558192313"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row1522123282216"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p19191169254"><a name="p19191169254"></a><a name="p19191169254"></a>1.11.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p4879185815238"><a name="p4879185815238"></a><a name="p4879185815238"></a>1.8.1.post2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p887935810232"><a name="p887935810232"></a><a name="p887935810232"></a>v1.8.1-5.0.rc2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p14879358172313"><a name="p14879358172313"></a><a name="p14879358172313"></a>23.0.RC1-1.8.1</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row19716641182317"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p691981615257"><a name="p691981615257"></a><a name="p691981615257"></a>1.8.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p208791758142314"><a name="p208791758142314"></a><a name="p208791758142314"></a>1.11.0.post1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p1987935852319"><a name="p1987935852319"></a><a name="p1987935852319"></a>v1.11.0-5.0.rc2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p1087918585237"><a name="p1087918585237"></a><a name="p1087918585237"></a>23.0.RC1-1.11.0</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row822143252217"><td class="cellrowborder" rowspan="2" valign="top" headers="mcps1.2.6.1.1 "><p id="p108803589235"><a name="p108803589235"></a><a name="p108803589235"></a>CANN 6.3.RC1</p>
|
||||
<p id="p129081558152312"><a name="p129081558152312"></a><a name="p129081558152312"></a></p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p12346162018257"><a name="p12346162018257"></a><a name="p12346162018257"></a>1.11.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p6880205814236"><a name="p6880205814236"></a><a name="p6880205814236"></a>1.8.1.post1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p6880258162313"><a name="p6880258162313"></a><a name="p6880258162313"></a>v1.8.1-5.0.rc1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p08807589236"><a name="p08807589236"></a><a name="p08807589236"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row13745135213239"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p183463202251"><a name="p183463202251"></a><a name="p183463202251"></a>1.8.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p1888019580230"><a name="p1888019580230"></a><a name="p1888019580230"></a>1.11.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p15880105813236"><a name="p15880105813236"></a><a name="p15880105813236"></a>v1.11.0-5.0.rc1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p1588012586230"><a name="p1588012586230"></a><a name="p1588012586230"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row1667135119236"><td class="cellrowborder" rowspan="3" valign="top" headers="mcps1.2.6.1.1 "><p id="p188801958102315"><a name="p188801958102315"></a><a name="p188801958102315"></a>CANN 6.0.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p43395279244"><a name="p43395279244"></a><a name="p43395279244"></a>1.5.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p118801658182310"><a name="p118801658182310"></a><a name="p118801658182310"></a>1.5.0.post8</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p4880125819233"><a name="p4880125819233"></a><a name="p4880125819233"></a>v1.5.0-3.0.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p8880858122319"><a name="p8880858122319"></a><a name="p8880858122319"></a>22.0.0</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row123884481236"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p0339162717244"><a name="p0339162717244"></a><a name="p0339162717244"></a>1.8.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p15880115811236"><a name="p15880115811236"></a><a name="p15880115811236"></a>1.8.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p68808584233"><a name="p68808584233"></a><a name="p68808584233"></a>v1.8.1-3.0.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p1688035812238"><a name="p1688035812238"></a><a name="p1688035812238"></a>22.0.0-1.8.1</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row133914572237"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p10339102719241"><a name="p10339102719241"></a><a name="p10339102719241"></a>1.11.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p9880205892318"><a name="p9880205892318"></a><a name="p9880205892318"></a>1.11.0.rc2(beta)</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p888005822314"><a name="p888005822314"></a><a name="p888005822314"></a>v1.11.0-3.0.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p6880145812238"><a name="p6880145812238"></a><a name="p6880145812238"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row127654514238"><td class="cellrowborder" rowspan="3" valign="top" headers="mcps1.2.6.1.1 "><p id="p1288085862314"><a name="p1288085862314"></a><a name="p1288085862314"></a>CANN 6.0.RC1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p20327103216255"><a name="p20327103216255"></a><a name="p20327103216255"></a>1.5.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p7880145811235"><a name="p7880145811235"></a><a name="p7880145811235"></a>1.5.0.post7</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p1788095815239"><a name="p1788095815239"></a><a name="p1788095815239"></a>v1.5.0-3.0.rc3</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p6880115810237"><a name="p6880115810237"></a><a name="p6880115810237"></a>22.0.RC3</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row129461142152313"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p14327173292510"><a name="p14327173292510"></a><a name="p14327173292510"></a>1.8.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p1588035812311"><a name="p1588035812311"></a><a name="p1588035812311"></a>1.8.1.rc3</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p13880165816233"><a name="p13880165816233"></a><a name="p13880165816233"></a>v1.8.1-3.0.rc3</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p108806581238"><a name="p108806581238"></a><a name="p108806581238"></a>22.0.RC3-1.8.1</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row36411150122319"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p1132743211257"><a name="p1132743211257"></a><a name="p1132743211257"></a>1.11.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p168800589238"><a name="p168800589238"></a><a name="p168800589238"></a>1.11.0.rc1(beta)</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p28816580233"><a name="p28816580233"></a><a name="p28816580233"></a>v1.11.0-3.0.rc3</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p198811588236"><a name="p198811588236"></a><a name="p198811588236"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row12371144713235"><td class="cellrowborder" rowspan="2" valign="top" headers="mcps1.2.6.1.1 "><p id="p11881558122317"><a name="p11881558122317"></a><a name="p11881558122317"></a>CANN 5.1.RC2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p629873412510"><a name="p629873412510"></a><a name="p629873412510"></a>1.5.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p3881105818236"><a name="p3881105818236"></a><a name="p3881105818236"></a>1.5.0.post6</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p1088125852319"><a name="p1088125852319"></a><a name="p1088125852319"></a>v1.5.0-3.0.rc2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p20881258112316"><a name="p20881258112316"></a><a name="p20881258112316"></a>22.0.RC2</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row14956184342315"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p929893462515"><a name="p929893462515"></a><a name="p929893462515"></a>1.8.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p688120581238"><a name="p688120581238"></a><a name="p688120581238"></a>1.8.1.rc2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p198819587236"><a name="p198819587236"></a><a name="p198819587236"></a>v1.8.1-3.0.rc2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p1388175832319"><a name="p1388175832319"></a><a name="p1388175832319"></a>22.0.RC2-1.8.1</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row1522133210223"><td class="cellrowborder" rowspan="2" valign="top" headers="mcps1.2.6.1.1 "><p id="p7881205813233"><a name="p7881205813233"></a><a name="p7881205813233"></a>CANN 5.1.RC1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p1610094112517"><a name="p1610094112517"></a><a name="p1610094112517"></a>1.5.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p12881165818235"><a name="p12881165818235"></a><a name="p12881165818235"></a>1.5.0.post5</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p14881105892315"><a name="p14881105892315"></a><a name="p14881105892315"></a>v1.5.0-3.0.rc1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p5881115812234"><a name="p5881115812234"></a><a name="p5881115812234"></a>22.0.RC1</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row182218327224"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p19100441202520"><a name="p19100441202520"></a><a name="p19100441202520"></a>1.8.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p688165810235"><a name="p688165810235"></a><a name="p688165810235"></a>1.8.1.rc1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p6881195818236"><a name="p6881195818236"></a><a name="p6881195818236"></a>v1.8.1-3.0.rc1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p58817582239"><a name="p58817582239"></a><a name="p58817582239"></a>-</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row137028392234"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p208815585236"><a name="p208815585236"></a><a name="p208815585236"></a>CANN 5.0.4</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p1289474162511"><a name="p1289474162511"></a><a name="p1289474162511"></a>1.5.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p68812058102318"><a name="p68812058102318"></a><a name="p68812058102318"></a>1.5.0.post4</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p17881658122311"><a name="p17881658122311"></a><a name="p17881658122311"></a>2.0.4.tr5</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p1588119588233"><a name="p1588119588233"></a><a name="p1588119588233"></a>21.0.4</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row182227322224"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p1188113584232"><a name="p1188113584232"></a><a name="p1188113584232"></a>CANN 5.0.3</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p1389417414253"><a name="p1389417414253"></a><a name="p1389417414253"></a>1.8.1</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p14881358112314"><a name="p14881358112314"></a><a name="p14881358112314"></a>1.5.0.post3</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p9881205862316"><a name="p9881205862316"></a><a name="p9881205862316"></a>2.0.3.tr5</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p68811858122317"><a name="p68811858122317"></a><a name="p68811858122317"></a>21.0.3</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row17222203202219"><td class="cellrowborder" valign="top" headers="mcps1.2.6.1.1 "><p id="p68814580234"><a name="p68814580234"></a><a name="p68814580234"></a>CANN 5.0.2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.2 "><p id="p610954522514"><a name="p610954522514"></a><a name="p610954522514"></a>1.5.0</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.3 "><p id="p1882758112318"><a name="p1882758112318"></a><a name="p1882758112318"></a>1.5.0.post2</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.4 "><p id="p988215589234"><a name="p988215589234"></a><a name="p988215589234"></a>2.0.2.tr5</p>
|
||||
</td>
|
||||
<td class="cellrowborder" valign="top" headers="mcps1.2.6.1.5 "><p id="p6882115811231"><a name="p6882115811231"></a><a name="p6882115811231"></a>21.0.2</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
**PyTorch Extension**版本号采用`{PyTorch版本}-{昇腾版本}`命名规则,前者为**PyTorch Extension**匹配的PyTorch版本,后者用于匹配CANN版本,详细匹配如下:
|
||||
|
||||
| CANN版本 | 支持的PyTorch版本 | 支持的Extension版本 | Gitee分支 | AscendHub镜像版本/名称([链接](https://ascendhub.huawei.com/#/detail/pytorch-modelzoo)) |
|
||||
|----------------|--------------|-------------------|-------------------|----------------------|
|
||||
| CANN 8.0.RC1 | 2.2.0 | 2.2.0 | v2.2.0-6.0.rc1 | - |
|
||||
| | 2.1.0 | 2.1.0.post3 | v2.1.0-6.0.rc1 | - |
|
||||
| | 1.11.0 | 1.11.0.post11 | v1.11.0-6.0.rc1 | - |
|
||||
| CANN 7.0.0 | 2.1.0 | 2.1.0 | v2.1.0-5.0.0 | - |
|
||||
| | 2.0.1 | 2.0.1.post1 | v2.0.1-5.0.0 | - |
|
||||
| | 1.11.0 | 1.11.0.post8 | v1.11.0-5.0.0 | - |
|
||||
| CANN 7.0.RC1 | 2.1.0 | 2.1.0.rc1 | v2.1.0-5.0.rc3 | - |
|
||||
| | 2.0.1 | 2.0.1 | v2.0.1-5.0.rc3 | - |
|
||||
| | 1.11.0 | 1.11.0.post4 | v1.11.0-5.0.rc3 | - |
|
||||
| CANN 6.3.RC3.1 | 1.11.0 | 1.11.0.post3 | v1.11.0-5.0.rc2.2 | - |
|
||||
| CANN 6.3.RC3 | 1.11.0 | 1.11.0.post2 | v1.11.0-5.0.rc2.1 | - |
|
||||
| CANN 6.3.RC2 | 2.0.1 | 2.0.1.rc1 | v2.0.1-5.0.rc2 | - |
|
||||
| | 1.11.0 | 1.11.0.post1 | v1.11.0-5.0.rc2 | 23.0.RC1-1.11.0 |
|
||||
| | 1.8.1 | 1.8.1.post2 | v1.8.1-5.0.rc2 | 23.0.RC1-1.8.1 |
|
||||
| CANN 6.3.RC1 | 1.11.0 | 1.11.0 | v1.11.0-5.0.rc1 | - |
|
||||
| | 1.8.1 | 1.8.1.post1 | v1.8.1-5.0.rc1 | - |
|
||||
| CANN 6.0.1 | 1.5.0 | 1.5.0.post8 | v1.5.0-3.0.0 | 22.0.0 |
|
||||
| | 1.8.1 | 1.8.1 | v1.8.1-3.0.0 | 22.0.0-1.8.1 |
|
||||
| | 1.11.0 | 1.11.0.rc2(beta) | v1.11.0-3.0.0 | - |
|
||||
| CANN 6.0.RC1 | 1.5.0 | 1.5.0.post7 | v1.5.0-3.0.rc3 | 22.0.RC3 |
|
||||
| | 1.8.1 | 1.8.1.rc3 | v1.8.1-3.0.rc3 | 22.0.RC3-1.8.1 |
|
||||
| | 1.11.0 | 1.11.0.rc1(beta) | v1.11.0-3.0.rc3 | - |
|
||||
| CANN 5.1.RC2 | 1.5.0 | 1.5.0.post6 | v1.5.0-3.0.rc2 | 22.0.RC2 |
|
||||
| | 1.8.1 | 1.8.1.rc2 | v1.8.1-3.0.rc2 | 22.0.RC2-1.8.1 |
|
||||
| CANN 5.1.RC1 | 1.5.0 | 1.5.0.post5 | v1.5.0-3.0.rc1 | 22.0.RC1 |
|
||||
| | 1.8.1 | 1.8.1.rc1 | v1.8.1-3.0.rc1 | - |
|
||||
| CANN 5.0.4 | 1.5.0 | 1.5.0.post4 | 2.0.4.tr5 | 21.0.4 |
|
||||
| CANN 5.0.3 | 1.8.1 | 1.5.0.post3 | 2.0.3.tr5 | 21.0.3 |
|
||||
| CANN 5.0.2 | 1.5.0 | 1.5.0.post2 | 2.0.2.tr5 | 21.0.2 |
|
||||
|
||||
## 建议与交流
|
||||
|
||||
@@ -384,26 +181,38 @@ AscendPyTorch版本分支的维护阶段如下:
|
||||
| **状态** | **时间** | **说明** |
|
||||
| ------------------- | -------- | ------------------------------------------------ |
|
||||
| 计划 | 1—3 个月 | 计划特性 |
|
||||
| 开发 | 3个月 | 开发特性 |
|
||||
| 维护 | 6—12个月 | 合入所有已解决的问题并发布版本 |
|
||||
| 开发 | 3 个月 | 开发特性 |
|
||||
| 维护 | 6-12 个月| 合入所有已解决的问题并发布版本,针对不同的PyTorch版本采取不同的维护策略,常规版本和长期支持版本维护周期分别为6个月和12个月 |
|
||||
| 无维护 | 0—3 个月 | 合入所有已解决的问题,无专职维护人员,无版本发布 |
|
||||
| 生命周期终止(EOL) | N/A | 分支不再接受任何修改 |
|
||||
|
||||
## 现有分支的维护状态
|
||||
## PyTorch版本维护策略
|
||||
|
||||
| **分支** | **状态** | **发布日期** | **后续状态** | **EOL日期** |
|
||||
| ------------ | -------- | ------------ | -------------------------- | ----------- |
|
||||
| **v2.0.2** | EOL | 2021/7/29 | N/A | |
|
||||
| **v2.0.3** | EOL | 2021/10/15 | N/A | |
|
||||
| **v2.0.4** | EOL | 2022/1/15 | N/A | |
|
||||
| **v3.0.rc1** | EOL | 2022/4/10 | N/A | |
|
||||
| **v3.0.rc2** | EOL | 2022/7/15 | N/A | |
|
||||
| **v3.0.rc3** | 维护 | 2022/10/20 | 预计2023/10/20起无维护 | |
|
||||
| **v3.0.0** | 维护 | 2023/1/18 | 预计2024/1/18起无维护 | |
|
||||
| **v5.0.rc1** | 维护 | 2023/4/19 | 预计2024/4/19起无维护 | |
|
||||
| **v5.0.rc2** | 维护 | 2023/7/19 | 预计2024/7/19起无维护 | |
|
||||
| **v5.0.rc3** | 维护 | 2023/10/15 | 预计2024/10/15起无维护 | |
|
||||
| **PyTorch版本** | **维护策略** | **当前状态** | **发布时间** | **后续状态** | **EOL日期** |
|
||||
|-----------|-----------|--------|------------|-----------------------|-----------|
|
||||
| 2.2.0 | 常规版本 | 维护 | 2024/04/01 | 预计2024/10/15起无维护 | |
|
||||
| 2.1.0 | 长期支持 | 维护 | 2023/10/15 | 预计2024/10/15起无维护 | |
|
||||
| 2.0.1 | 常规版本 | EOL | 2023/7/19 | | 2024/3/14 |
|
||||
| 1.11.0 | 长期支持 | 维护 | 2023/4/19 | 预计2024/4/19起无维护 | |
|
||||
| 1.8.1 | 长期支持 | EOL | 2022/4/10 | | 2023/4/10 |
|
||||
| 1.5.0 | 长期支持 | EOL | 2021/7/29 | | 2022/7/29 |
|
||||
|
||||
## 安全声明
|
||||
|
||||
[Ascend Extension for PyTorch插件 安全声明](https://gitee.com/ascend/pytorch/blob/v2.1.0-6.0.rc1/SECURITYNOTE.md)
|
||||
|
||||
## 参考文档
|
||||
|
||||
有关安装指南、模型迁移和训练/推理教程和API列表等更多详细信息,请参考[昇腾社区Ascend Extension for PyTorch](https://www.hiascend.com/software/ai-frameworks/commercial)。
|
||||
|
||||
| 文档名称 | 文档链接 |
|
||||
| -------------------------- | ------------------------------------------------------------ |
|
||||
| AscendPyTorch 安装指南 | [参考链接](https://www.hiascend.com/document/detail/zh/canncommercial/700/envdeployment/instg/instg_0163.html) |
|
||||
| AscendPyTorch 网络模型迁移和训练 | [参考链接](https://www.hiascend.com/document/detail/zh/canncommercial/700/modeldevpt/ptmigr/AImpug_000002.html) |
|
||||
| AscendPyTorch 在线推理 | [参考链接](https://www.hiascend.com/document/detail/zh/canncommercial/700/modeldevpt/ptonlineinfer/PyTorch_Infer_000001.html) |
|
||||
| AscendPyTorch 算子适配 | [参考链接](https://www.hiascend.com/document/detail/zh/canncommercial/700/operatordev/tbeaicpudevg/atlasopdev_10_0086.html) |
|
||||
| AscendPyTorch API清单(PyTorch原生接口与自定义接口) | [参考链接](https://www.hiascend.com/document/detail/zh/canncommercial/700/modeldevpt/ptmigr/ptaoplist_000002.html) |
|
||||
|
||||
## 许可证
|
||||
|
||||
PyTorch Ascend Adapter插件使用BSD许可证。详见[LICENSE](LICENSE)文件。
|
||||
Ascend Extension for PyTorch插件使用BSD许可证。详见[LICENSE](LICENSE)文件。
|
||||
|
||||
+216
@@ -0,0 +1,216 @@
|
||||
# Ascend Extension for PyTorch插件 安全声明
|
||||
|
||||
## 系统安全加固
|
||||
|
||||
建议用户在系统中配置开启ASLR(级别2 ),又称**全随机地址空间布局随机化**,可参考以下方式进行配置:
|
||||
|
||||
echo 2 > /proc/sys/kernel/randomize_va_space
|
||||
|
||||
## 运行用户建议
|
||||
|
||||
出于安全性及权限最小化角度考虑,不建议使用root等管理员类型账户使用torch_npu。
|
||||
|
||||
## 文件权限控制
|
||||
|
||||
1. 建议用户对训练所需文件、训练过程中保存的文件、用户个人的隐私数据、商业资产等敏感文件做好权限控制等安全措施,例如多用户共享数据集场景下的数据集文件写权限控制、profiler等场景产生数据文件权限控制等,设定的权限建议参考[文件权限参考](#文件权限参考)进行设置。
|
||||
|
||||
2. torch_npu中profiler工具会生成性能记录文件,生成的文件权限为640,文件夹权限为750,用户可根据需要自行对生成后的相关文件进行权限控制。
|
||||
|
||||
3. 用户安装和使用过程需要做好权限控制,建议参考[文件权限参考](#文件权限参考)进行设置。如需要保存安装/卸载日志,可在安装/卸载命令后面加上参数--log <FILE>, 注意对<FILE>文件及目录做好权限管控。
|
||||
|
||||
4. PyTorch框架运行中所生成的文件权限依赖系统设定,如torch.save接口保存的文件。建议当前执行脚本的用户根据自身需要,对生成文件做好权限控制,设定的权限可参考[文件权限参考](#文件权限参考) 。可使用umask控制默认权限,降低提权等安全风险,建议用户将主机(包括宿主机)和容器中的umask设置为0027及其以上,提高安全性。
|
||||
|
||||
##### 文件权限参考
|
||||
|
||||
| 类型 | Linux权限参考最大值 |
|
||||
|----------------------------------- |-----------------------|
|
||||
| 用户主目录 | 750(rwxr-x---) |
|
||||
| 程序文件(含脚本文件、库文件等) | 550(r-xr-x---) |
|
||||
| 程序文件目录 | 550(r-xr-x---) |
|
||||
| 配置文件 | 640(rw-r-----) |
|
||||
| 配置文件目录 | 750(rwxr-x---) |
|
||||
| 日志文件(记录完毕或者已经归档) | 440(r--r-----) |
|
||||
| 日志文件(正在记录) | 640(rw-r-----) |
|
||||
| 日志文件目录 | 750(rwxr-x---) |
|
||||
| Debug文件 | 640(rw-r-----) |
|
||||
| Debug文件目录 | 750(rwxr-x---) |
|
||||
| 临时文件目录 | 750(rwxr-x---) |
|
||||
| 维护升级文件目录 | 770(rwxrwx---) |
|
||||
| 业务数据文件 | 640(rw-r-----) |
|
||||
| 业务数据文件目录 | 750(rwxr-x---) |
|
||||
| 密钥组件、私钥、证书、密文文件目录 | 700(rwx------) |
|
||||
| 密钥组件、私钥、证书、加密密文 | 600(rw-------) |
|
||||
| 加解密接口、加解密脚本 | 500(r-x------) |
|
||||
|
||||
## 调试工具声明
|
||||
|
||||
torch_npu内集成性能分析工具profiler:
|
||||
- 集成原因:对标pytorch原生支持能力,提供NPU PyTorch框架开发性能分析能力,加速性能分析调试过程。
|
||||
- 使用场景:默认不采集,如用户需要进行性能分析时,可在模型训练脚本中添加Ascend Extension for PyTorch Profiler接口,执行训练的同时采集性能数据,完成训练后直接输出可视化的性能数据文件。
|
||||
- 风险提示:使用该功能会在本地生成性能数据,用户需加强对相关性能数据的保护,请在需要模型性能分析时使用,分析完成后及时关闭。Profiler工具具体细节请参考[《PyTorch 性能分析工具介绍》](https://www.hiascend.com/document/detail/zh/Pytorch/60RC1/ptmoddevg/trainingmigrguide/performance_tuning_0013.html)。
|
||||
|
||||
## 数据安全声明
|
||||
|
||||
1. PyTorch使用过程中需要加载和保存数据,部分接口使用风险模块pickle,可能存在数据风险,如torch.load、torch.distributed.scatter_object_list等接口,可参考[torch.load](https://pytorch.org/docs/2.1/generated/torch.load.html#torch.load)、[collective-functions](https://pytorch.org/docs/2.1/distributed.html#collective-functions)了解具体风险。
|
||||
2. Ascend Extension for PyTorch依赖CANN的基础能力实现AOE性能调优、算子dump、日志记录等功能,用户需要关注上述功能生成文件的权限控制,加强对相关数据的保护。
|
||||
|
||||
## 构建安全声明
|
||||
|
||||
torch_npu支持源码编译安装,在编译时会下载依赖第三方库并执行构建shell脚本,在编译过程中会产生临时程序文件和编译目录。用户可根据需要自行对源代码目录内的文件进行权限管控降低安全风险。
|
||||
|
||||
## 运行安全声明
|
||||
|
||||
1. 建议用户结合运行环境资源状况编写对应训练脚本。若训练脚本与资源状况不匹配,如数据集加载内存大小超出内存容量限制、训练脚本在本地生成数据超过磁盘空间大小等情况,可能引发错误并导致进程意外退出。
|
||||
2. PyTorch和torch_npu在运行异常时会退出进程并打印报错信息,属于正常现象。建议用户根据报错提示定位具体错误原因,包括设定算子同步执行、查看CANN日志、解析生成的Core Dump文件等方式。
|
||||
|
||||
## 公网地址声明
|
||||
|
||||
在torch_npu的配置文件和脚本中存在[公网地址](#公网地址)
|
||||
|
||||
##### 公网地址
|
||||
|
||||
| 类型 | 开源代码地址 | 文件名 | 公网IP地址/公网URL地址/域名/邮箱地址 | 用途说明 |
|
||||
|-------------------------|-------------------------|-------------------------|-------------------------|-------------------------|
|
||||
| 自研 | 不涉及 | ci\docker\X86\Dockerfile | https://mirrors.huaweicloud.com/repository/pypi/simple | docker配置文件,用于配置pip源 |
|
||||
| 自研 | 不涉及 | ci\docker\X86\Dockerfile | https://download.pytorch.org/whl/cpu | docker配置源,用于配置torch下载连接 |
|
||||
| 自研 | 不涉及 | ci\docker\X86\Dockerfile | https://mirrors.aliyun.com/pypi/simple/ | docker配置文件,用于配置pip源 |
|
||||
| 自研 | 不涉及 | setup.cfg | https://gitee.com/ascend/pytorch | 用于打包whl的url入参 |
|
||||
| 自研 | 不涉及 | setup.cfg | https://gitee.com/ascend/pytorch/tags | 用于打包whl的download_url入参 |
|
||||
| 自研 | 不涉及 | third_party\op-plugin\ci\build.sh | https://gitee.com/ascend/pytorch.git | 编译脚本根据torch_npu仓库地址拉取代码进行编译 |
|
||||
| 自研 | 不涉及 | third_party\op-plugin\ci\exec_ut.sh | https://gitee.com/ascend/pytorch.git | UT脚本根据torch_npu仓库地址下拉取代码进行UT测试 |
|
||||
| 开源引入 | https://github.com/pytorch/pytorch/blob/main/test/nn/test_convolution.py <br> https://github.com/pytorch/pytorch/blob/v2.1.0/test/test_mps.py <br> https://github.com/pytorch/pytorch/blob/v2.1.0/test/test_serialization.py | test\url.ini | https://download.pytorch.org/test_data/legacy_conv2d.pt | 用于test脚本下载相关pt文件 |
|
||||
| 开源引入 | https://github.com/pytorch/pytorch/blob/v2.1.0/test/test_serialization.py | test\url.ini | https://download.pytorch.org/test_data/legacy_serialized.pt | 用于test脚本下载相关pt文件 |
|
||||
| 开源引入 | https://github.com/pytorch/pytorch/blob/v2.1.0/test/test_serialization.py | test\url.ini | https://download.pytorch.org/test_data/gpu_tensors.pt | 用于test脚本下载相关pt文件 |
|
||||
| 开源引入 | https://github.com/pytorch/pytorch/blob/v2.1.0/test/test_nn.py <br> https://github.com/pytorch/pytorch/blob/v2.1.0/test/test_serialization.py | test\url.ini | https://download.pytorch.org/test_data/linear.pt | 用于test脚本下载相关pt文件 |
|
||||
| 开源引入 | https://github.com/pytorch/pytorch/blob/v2.1.0/torch/csrc/profiler/unwind/eh_frame_hdr.h | third_party\profiler\unwind\eh_frame_hdr.h | https://refspecs.linuxfoundation.org/LSB_1.3.0/gLSB/gLSB/ehframehdr.html | c++调用栈实现相关注解网址 |
|
||||
| 开源引入 | https://github.com/pytorch/pytorch/blob/v2.1.0/torch/csrc/profiler/unwind/fde.h | third_party\profiler\unwind\fde.h | https://www.airs.com/blog/archives/460 | c++调用栈实现相关注解网址 |
|
||||
| 开源引入 | https://github.com/pytorch/pytorch/blob/v2.1.0/torch/csrc/profiler/unwind/fde.h | third_party\profiler\unwind\fde.h | https://web.archive.org/web/20221129184704/https://dwarfstd.org/doc/DWARF4.doc | c++调用栈实现相关注解网址 |
|
||||
| 开源引入 | https://github.com/pytorch/pytorch/blob/v2.1.0/torch/csrc/profiler/unwind/fde.h | third_party\profiler\unwind\fde.h | https://dl.acm.org/doi/pdf/10.1145/3360572 | c++调用栈实现相关注解网址 |
|
||||
| 开源引入 | https://github.com/pytorch/pytorch/blob/v2.1.0/torch/csrc/profiler/unwind/fde.h | third_party\profiler\unwind\fde.h | https://github.com/mstange/framehop/ | c++调用栈实现相关注解网址 |
|
||||
|
||||
## 公开接口声明
|
||||
|
||||
Ascend Extension for PyTorch是PyTorch适配插件,支持用户使用PyTorch在昇腾设备上进行训练和推理。Ascend Extension for PyTorch适配后支持用户使用PyTorch原生接口。除了原生PyTorch接口外,Ascend Extension for PyTorch提供了部分自定义接口,包括自定义算子、亲和库和其他接口,支持PyTorch接口和自定义接口连接,具体可参考[《PyTorch API参考》](https://www.hiascend.com/document/detail/zh/Pytorch/60RC1/apiref/apilist/ptaoplist_000002.html)。
|
||||
|
||||
参考[PyTorch社区公开接口规范](https://github.com/pytorch/pytorch/wiki/Public-API-definition-and-documentation),Ascend Extension for PyTorch提供了对外的自定义接口。如果一个函数看起来符合公开接口的标准且在文档中有展示,则该接口是公开接口。否则,使用该功能前可以在社区询问该功能是否确实是公开的或意外暴露的接口,因为这些未暴露接口将来可能会被修改或者删除。
|
||||
|
||||
Ascend Extension for PyTorch项目采用C++和Python联合开发,当前除Libtorch场景外正式接口只提供Python接口,在torch_npu的二进制包中动态库不直接提供服务,暴露的接口为内部使用,不建议用户使用。
|
||||
|
||||
## 通信安全加固
|
||||
|
||||
PyTorch分布式训练服务需要在设备间进行通信,通信开启的端口默认为全0侦听,为了降低安全风险,建议用户针对此场景进行安全加固,如使用iptables配置防火墙,在运行分布式训练开始前限制外部对分布式训练使用端口的访问,在运行分布式训练结束后清理防火墙规则。
|
||||
|
||||
1. 防火墙规则设定和移除参考脚本模板
|
||||
- 防火墙规则设定,可参考如下脚本:
|
||||
|
||||
```
|
||||
#!/bin/bash
|
||||
set -x
|
||||
|
||||
# 要限制的端口号
|
||||
port={端口号}
|
||||
|
||||
# 清除旧规则
|
||||
iptables -D INPUT -p tcp -j {规则名}
|
||||
iptables -F {规则名}
|
||||
iptables -X {规则名}
|
||||
|
||||
# 创建新的规则链
|
||||
iptables -t filter -N {规则名}
|
||||
|
||||
# 在多机场景下设定白名单,允许其他节点访问主节点的侦听端口
|
||||
# 在规则链中添加允许特定IP地址范围的规则
|
||||
iptables -t filter -A {规则名} -i eno1 -p tcp --dport $port -s {允许外部访问的IP} -j ACCEPT
|
||||
|
||||
# 屏蔽外部地址访问分布式训练端口
|
||||
# 在PORT-LIMIT-RULE规则链中添加拒绝其他IP地址的规则
|
||||
iptables -t filter -A {规则名} -i {要限制的网卡名} -p tcp --dport $port -j DROP
|
||||
|
||||
# 将流量传递给规则链
|
||||
iptables -I INPUT -p tcp -j {规则名}
|
||||
```
|
||||
|
||||
- 防火墙规则移除,可参考如下脚本:
|
||||
|
||||
```
|
||||
#!/bin/bash
|
||||
set -x
|
||||
# 清除规则
|
||||
iptables -D INPUT -p tcp -j {规则名}
|
||||
iptables -F {规则名}
|
||||
iptables -X {规则名}
|
||||
```
|
||||
|
||||
2. 防火墙规则设定和移除参考脚本示例
|
||||
1. 针对特定端口设定防火墙,脚本中端口号为要限制的端口,在PyTorch分布式训练中端口号请参考[通信矩阵信息](#通信矩阵信息);要限制的网卡名为服务器用于分布式通信使用的网卡,允许的外部访问的IP为分布式训练服务器的IP地址。网卡和服务器IP可以通过ifconfig查看,如下文回显的eth0为网卡名,192.168.1.1为服务器IP地址:
|
||||
|
||||
```
|
||||
# ifconfig
|
||||
eth0
|
||||
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
|
||||
inet6 addr: fe80::230:64ee:ef1a:c1a/64 Scope:Link
|
||||
```
|
||||
2. 假定服务器主节点地址192.168.1.1,另一台需要进行分布式训练的服务器为192.168.1.2,训练端口为29510。
|
||||
- 防火墙规则设定,可参考如下脚本:
|
||||
|
||||
```
|
||||
#!/bin/bash
|
||||
set -x
|
||||
|
||||
# 设定侦听的端口
|
||||
port=29510
|
||||
|
||||
# 清除旧规则
|
||||
iptables -D INPUT -p tcp -j PORT-LIMIT-RULE
|
||||
iptables -F PORT-LIMIT-RULE
|
||||
iptables -X PORT-LIMIT-RULE
|
||||
|
||||
# 创建新的PORT-LIMIT-RULE规则链
|
||||
iptables -t filter -N PORT-LIMIT-RULE
|
||||
|
||||
# 在多机场景下设定白名单,允许192.168.1.2访问主节点
|
||||
# 在PORT-LIMIT-RULE规则链中添加允许特定IP地址范围的规则
|
||||
iptables -t filter -A PORT-LIMIT-RULE -i eno1 -p tcp --dport $port -s 192.168.1.2 -j ACCEPT
|
||||
|
||||
# 屏蔽外部地址访问分布式训练端口
|
||||
# 在PORT-LIMIT-RULE规则链中添加拒绝其他IP地址的规则
|
||||
iptables -t filter -A PORT-LIMIT-RULE -i eth0 -p tcp --dport $port -j DROP
|
||||
|
||||
# 将流量传递给PORT-LIMIT-RULE规则链
|
||||
iptables -I INPUT -p tcp -j PORT-LIMIT-RULE
|
||||
```
|
||||
|
||||
- 防火墙规则移除,可参考如下脚本:
|
||||
|
||||
```
|
||||
#!/bin/bash
|
||||
set -x
|
||||
# 清除规则
|
||||
iptables -D INPUT -p tcp -j PORT-LIMIT-RULE
|
||||
iptables -F PORT-LIMIT-RULE
|
||||
iptables -X PORT-LIMIT-RULE
|
||||
```
|
||||
|
||||
## 通信矩阵
|
||||
|
||||
PyTorch提供分布式训练能力,支持在单机和多机场景下进行训练,需要进行网络通信。其中PyTorch需要使用TCP进行通信,torch_npu使用CANN中HCCL在NPU设备间通信,通信端口见[通信矩阵信息](#通信矩阵信息)。用户需要注意并保障节点间通信网络安全,可以使用iptables等方式消减安全风险,可参考[通信安全加固](#通信安全加固)进行网络安全加固。
|
||||
|
||||
##### 通信矩阵信息
|
||||
|
||||
| 组件 | PyTorch | HCCL |
|
||||
| --------------------- | ------------------------------------ | ------------------------------------ |
|
||||
| 源设备 | 运行torch_npu进程的服务器 | 运行torch_npu进程的服务器 |
|
||||
| 源IP | 设备地址IP | 设备地址IP |
|
||||
| 源端口 | 操作系统自动分配,分配范围由操作系统的自身配置决定 | 默认值为60000,取值范围[1024,65520]。用户可以通过HCCL_IF_BASE_PORT环境变量指定Host网卡起始端口号,配置后系统默认占用以该端口起始的16个端口 |
|
||||
| 目的设备 | 运行torch_npu进程的服务器 | 运行torch_npu进程的服务器 |
|
||||
| 目的IP | 设备地址IP | 设备地址IP |
|
||||
| 目的端口 (侦听) | 默认29500/29400,用户可以设定端口号 | 默认值为60000,取值范围[1024,65520]。用户可以通过HCCL_IF_BASE_PORT环境变量指定Host网卡起始端口号,配置后系统默认占用以该端口起始的16个端口 |
|
||||
| 协议 | TCP | TCP |
|
||||
| 端口说明 | 1. 在静态分布式场景中(用torchrun/torch.distributed.launch使用的backend为static), 目的端口(默认29500)用于接收和发送数据,源端口用于接收和发送数据 <br> 2. 在动态分布式场景中(用torchrun或者torch.distributed.launch使用的backend为c10d), 目的端口(默认29400)用于接收和发送数据,源端口用于接收和发送数据。可以使用rdzv_endpoint和master_port指定端口号 <br> 3. 在分布式场景中,用torchrun或者torch.distributed.launch不指定任何参数时使用的端口号为29500 | 默认值为60000,取值范围[1024,65520]。用户可以通过HCCL_IF_BASE_PORT环境变量指定Host网卡起始端口号,配置后系统默认占用以该端口起始的16个端口 |
|
||||
| 侦听端口是否可更改 | 是 | 是 |
|
||||
| 认证方式 | 无认证方式 | 无认证方式 |
|
||||
| 加密方式 | 无 | 无 |
|
||||
| 所属平面 | 不涉及 | 不涉及 |
|
||||
| 版本 | 所有版本 | 所有版本 |
|
||||
| 特殊场景 | 无 | 无 |
|
||||
| 备注 | 该通信过程由开源软件PyTorch控制,配置为PyTorch原生设置,可参考[PyTorch文档](https://pytorch.org/docs/stable/distributed.html#launch-utility)。源端口由操作系统自动分配,分配范围由操作系统的配置决定,例如ubuntu:采用/proc/sys/net/ipv4/ipv4_local_port_range文件指定,可通过cat /proc/sys/net/ipv4/ipv4_local_port_range或sysctl net.ipv4.ip_local_port_range查看 | 该通信过程由CANN中HCCL组件控制,torch_npu不进行控制,端口范围可参考[《环境变量参考》](https://www.hiascend.com/document/detail/zh/canncommercial/80RC1/apiref/envvar/envref_07_0001.html)的“执行相关 > 集合通信与分布式训练 > 集合通信相关配置>HCCL_IF_BASE_PORT” |
|
||||
@@ -5,589 +5,133 @@ Please note we provide an open source software notice along with this product an
|
||||
Warranty Disclaimer
|
||||
THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
|
||||
|
||||
Copyright Notice and License Texts
|
||||
Software: pytorch v2.0.0
|
||||
Copyright Notice and License Texts
|
||||
Software: pytorch v2.1.0
|
||||
Copyright notice:
|
||||
(C) Copyright John Maddock 2006.
|
||||
Copyright (c) 2017-2018 Advanced Micro Devices, Inc.
|
||||
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
|
||||
Copyright (C) 2000-2017 Julian Seward.
|
||||
Copyright (C) 2001-2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003-2017 Josef Weidendorfer.
|
||||
Copyright (C) 2006 The Android Open Source Project
|
||||
Copyright (C) 2007-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2011 - 2012 Andrzej Krzemienski.
|
||||
Copyright (C) 2012 Giovanni Garberoglio Interdisciplinary Laboratory for Computational Science (LISC)
|
||||
Copyright (C) 2017 The Android Open Source Project
|
||||
Copyright (C) 2018 Marat Dukhan
|
||||
Copyright (C) Björn Fahller
|
||||
Copyright (c) 1994 Hewlett-Packard Company
|
||||
Copyright (c) 1996-1998 Silicon Graphics Computer Systems, Inc.
|
||||
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Python Software Foundation; All Rights Reserved
|
||||
Copyright (c) 2001-2002 Enthought, Inc. 2003-2019, SciPy Developers.
|
||||
Copyright (c) 2001-2004 Idiap Research Institute (Ronan Collobert, Samy Bengio, Johnny Mariethoz)
|
||||
Copyright (c) 2005-2010 ActiveState Software Inc.
|
||||
Copyright (c) 2005-2017, NumPy Developers.
|
||||
Copyright (c) 2005-2022 NVIDIA Corporation Built on ThuFeb1018:23:41PST2022 Cuda compilation tools, release 11.6, V11.6.112
|
||||
Copyright (c) 2006 Idiap Research Institute (Samy Bengio)
|
||||
Copyright (c) 2006, Laurent Montel, <montel@kde.org>
|
||||
Copyright (c) 2006-2010 NEC Laboratories America (Ronan Collobert, Leon Bottou, Iain Melvin, Jason Weston)
|
||||
Copyright (c) 2007-2009 Scientific Computing and Imaging Institute, University of Utah
|
||||
Copyright (c) 2008 - 2009 NVIDIA Corporation.
|
||||
Copyright (c) 2008 - 2012 The Khronos Group Inc.
|
||||
Copyright (c) 2008-2012 The Khronos Group Inc.
|
||||
Copyright (c) 2008-2013 The Khronos Group Inc.
|
||||
Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
Copyright (c) 2010 ActiveState Software Inc.
|
||||
Copyright (c) 2011-2012 NEC Laboratories America (Koray Kavukcuoglu)
|
||||
Copyright (c) 2011-2013 NYU (Clement Farabet)
|
||||
Copyright (c) 2011-2013 NYU (Clement Farabet)
|
||||
Copyright (c) 2011-2014 Idiap Research Institute (Ronan Collobert)
|
||||
Copyright (c) 2011-2019 Stephan Brumme.
|
||||
Copyright (c) 2011-2021, NVIDIA CORPORATION.
|
||||
Copyright (c) 2012 Massachusetts Institute of Technology
|
||||
Copyright (c) 2012-2014 Deepmind Technologies (Koray Kavukcuoglu)
|
||||
Copyright (c) 2013 Eddy Petrișor
|
||||
Copyright (c) 2014 Indiana University
|
||||
Copyright (c) 2014 Matthew Rocklin
|
||||
Copyright (c) 2014, 2015, The Regents of the University of California (Regents)
|
||||
Copyright (c) 2014, 2015, the respective contributors
|
||||
Copyright (c) 2014, The Regents of the University of California (Regents)
|
||||
Copyright (c) 2014, the respective contributors
|
||||
Copyright (c) 2014- Facebook, Inc (Soumith Chintala)
|
||||
Copyright (c) 2014-2015 The Khronos Group Inc.
|
||||
Copyright (c) 2014-2017 The Regents of the University of California (Regents)
|
||||
Copyright (c) 2014-2017, the respective contributors
|
||||
Copyright (c) 2015 Google Inc.
|
||||
Copyright (c) 2015 Melissa E. O'Neill
|
||||
Copyright (c) 2015 Yangqing Jia
|
||||
Copyright (c) 2015-2016 Advanced Micro Devices, Inc.
|
||||
Copyright (c) 2015-2017 The Khronos Group Inc.
|
||||
Copyright (c) 2016 Facebook Inc.
|
||||
Copyright (c) 2016 Microsoft Licensed under The MIT License [see r-fcnLICENSE for details]
|
||||
Copyright (c) 2016, NVIDIA CORPORATION, All rights reserved
|
||||
Copyright (c) 2016, NVIDIA CORPORATION, All rights reserved Distributed under 2-clause BSD license; see accompanying LICENSE file
|
||||
Copyright (c) 2016- Facebook, Inc (Adam Paszke)
|
||||
Copyright (c) 2016-2017, ARM Limited and Contributors
|
||||
Copyright (c) 2016-present, Facebook Inc.
|
||||
Copyright (c) 2016-present, Facebook, Inc.
|
||||
Copyright (c) 2017 - 2022 NVIDIA CORPORATION & AFFILIATES. SPDX-License-Identifier: BSD-3-Clause
|
||||
Copyright (c) 2017 Georgia Institute of Technology
|
||||
Copyright (c) 2017 Microsoft Licensed under The Apache-2.0 License [see LICENSE for details]
|
||||
Copyright (c) 2017 by Contributors \file dlpack.h \brief The common header of DLPack.
|
||||
Copyright (c) 2017-2018 Facebook Inc.
|
||||
Copyright (c) 2017-present, Facebook, Inc.
|
||||
Copyright (c) 2018 MathInf GmbH, Thomas Viehmann Licensed under the BSD-3-Clause license This is the CPU implementation of the Connectionist Temporal Loss.
|
||||
Copyright (c) 2018 MathInf GmbH, Thomas Viehmann Licensed under the BSD-3-Clause license This is the GPU implementation of the Connectionist Temporal Loss.
|
||||
Copyright (c) 2018, Steven Moshier
|
||||
Copyright (c) 2018-present, Facebook, Inc.
|
||||
Copyright (c) 2019 NumPy Developers
|
||||
Copyright (c) 2022 Cruise LLC.
|
||||
Copyright (c) 2022, Tri Dao.
|
||||
Copyright (c) Edward Z. Yang <ezyang@mit.edu>
|
||||
Copyright (c) Facebook Inc. and Microsoft Corporation.
|
||||
Copyright (c) Facebook, Inc. and its affiliates.
|
||||
Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates Owner(s): ["oncall: distributed"]
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates flake8: noqa
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates from .matrixops import noqa: F403
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates from abc import ABC, abstractmethod from typing import Optional, Union
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates from dataclasses import dataclass from typing import Callable, cast, Dict, Iterable, Optional, Sequence, Set, Tuple, Union
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates from torch.distributed.tensor.parallel.api import parallelizemodule from torch.distributed.tensor.parallel.multiheadattentiontp import (
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates from typing import Callable, cast, Dict, Tuple, Union, Optional
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates from typing import Callable, cast, Optional, Sequence
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates from typing import Dict, Tuple
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates from typing import Dict, Union
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates from typing import Tuple, Union
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates from typing import cast
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates from typing import cast, Dict, List, Optional, Sequence, Tuple
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates from typing import cast, Dict, List, Sequence, Tuple
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates from typing import cast, List, Optional, Sequence, Tuple
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates from typing import cast, Optional, Sequence
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates implement matrix related ops for distributed tensor
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates import copy import warnings from typing import Callable, cast, Dict, Optional, Sequence
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates import dataclasses import logging from typing import Dict, List
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates import functools import operator from typing import Iterable, List, Sequence, Union
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates import os import warnings from typing import List, Optional, Sequence, TypeVar, Union
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates import torch
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates pyre-ignore-all-errors[6]
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
Copyright (c) Meta Platforms, Inc. and its affiliates.
|
||||
Copyright 2004-present Facebook. All Rights Reserved.
|
||||
Copyright 2005 Robert Kern (robert.kern@gmail.com)
|
||||
Copyright 2005, Google Inc.
|
||||
Copyright 2006, Google Inc.
|
||||
Copyright 2008 Google Inc.
|
||||
Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC
|
||||
Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC All Rights Reserved.
|
||||
Copyright 2013 Conrad Steenberg <conrad.steenberg@gmail.com>
|
||||
Copyright 2013-2014 RAD Game Tools and Valve Software
|
||||
Copyright 2015 Google Inc. All Rights Reserved.
|
||||
Copyright 2015 The Gemmlowp Authors. All Rights Reserved.
|
||||
Copyright 2016 Facebook @author Tudor Bosman (tudorb@fb.com)
|
||||
Copyright 2016 Martin Raiber All Rights Reserved.
|
||||
Copyright 2019 Kakao Brain
|
||||
Copyright 2019-2020 Kakao Brain
|
||||
Copyright 2022 Cruise LLC import logging import warnings from collections import OrderedDict from typing import Union, Iterable, Dict
|
||||
Copyright Malte Skarupke 2017.
|
||||
Copyright Michael Park, 2015-2017
|
||||
Copyright © 1995-2011 by Fredrik Lundh
|
||||
Copyright © 1997-2011 by Secret Labs AB
|
||||
Copyright © 2001-2014 Python Software Foundation; All Rights Reserved
|
||||
Copyright © 2005-2020 Rich Felker, et al.
|
||||
Copyright © 2010-2022 by Alex Clark and contributors
|
||||
Copyright © 2022 Apple Inc.
|
||||
Copyright © 2023 Apple Inc.
|
||||
Copyright(c) 2013, 2014, 2015, the respective contributors
|
||||
Copyright(c) 2015, 2016 the respective contributors
|
||||
Copyright (c) 2016- Facebook, Inc
|
||||
Copyright (c) 2014- Facebook, Inc
|
||||
Copyright (c) 2011-2014 Idiap Research Institute
|
||||
Copyright (c) 2012-2014 Deepmind Technologies
|
||||
Copyright (c) 2011-2012 NEC Laboratories America (Koray Kavukcuoglu)
|
||||
Copyright (c) 2011-2013 NYU
|
||||
Copyright (c) 2006-2010 NEC Laboratories America (Ronan Collobert, Leon Bottou, Iain Melvin, Jason Weston)
|
||||
Copyright (c) 2006 Idiap Research Institute
|
||||
Copyright (c) 2001-2004 Idiap Research Institute (Ronan Collobert, Samy Bengio, Johnny Mariethoz)
|
||||
Copyright (c) 2016-present, Facebook Inc.
|
||||
Copyright (c) 2016 Facebook Inc.
|
||||
Copyright (c) 2015 Google Inc.
|
||||
Copyright (c) 2015 Yangqing Jia
|
||||
Copyright 2019-2020 Kakao Brain
|
||||
Copyright (c) 2022 Cruise LLC.
|
||||
Copyright (c) 2013, 2014, 2015, the respective contributors
|
||||
Copyright (c) 2015, 2016 the respective contributors
|
||||
Copyright (c) 2014, The Regents of the University of California (Regents)
|
||||
Copyright (c) 2014, the respective contributors
|
||||
Copyright (c) 2018, Steven Moshier
|
||||
Copyright (c) 2001-2002 Enthought, Inc. 2003-2019, SciPy Developers
|
||||
Copyright (c) 1997-2011 by Secret Labs AB
|
||||
Copyright (c) 1995-2011 by Fredrik Lundh
|
||||
Copyright (c) 2010-2022 by Alex Clark and contributors
|
||||
Copyright (c) 2006 The Android Open Source Project
|
||||
Copyright (c) Facebook, Inc. and its affiliates
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates
|
||||
Copyright 2004-present Facebook
|
||||
Copyright (c) 2017 by Contributors
|
||||
Copyright (c) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura
|
||||
Copyright (c) 2022 Apple Inc.
|
||||
Copyright (c) 2023 Apple Inc.
|
||||
Copyright 2005 Robert Kern (robert.kern@gmail.com)
|
||||
copyright 2019 The TensorFlow Authors
|
||||
Copyright (c) 2018 MathInf GmbH, Thomas Viehmann
|
||||
Copyright (c) 2014 Indiana University (c)
|
||||
Copyright John Maddock 2006
|
||||
Copyright (c) 2012 Massachusetts Institute of Technology
|
||||
Copyright (c) 2012 Giovanni Garberoglio Interdisciplinary Laboratory for Computational Science (LISC) Fondazione Bruno Kessler and University of Trento
|
||||
Copyright (c) 2018 Marat Dukhan
|
||||
Copyright (c) 2017-2018 Facebook Inc.
|
||||
Copyright (c) 2017 Georgia Institute of Technology
|
||||
Copyright 2015 Google Inc.
|
||||
Copyright (c) 2011-2021, NVIDIA CORPORATION.
|
||||
Copyright (c) 2022, Tri Dao
|
||||
Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES.
|
||||
Copyright (c) 2017 - 2022 NVIDIA CORPORATION & AFFILIATES.
|
||||
Copyright (c) 2017 The Android Open Source Project
|
||||
Copyright (c) 2016-present, Facebook, Inc.
|
||||
Copyright (c) 2005-2020 Rich Felker
|
||||
Copyright Malte Skarupke 2017
|
||||
Copyright 2008 Google Inc.
|
||||
Copyright (c) 2011 - 2012 Andrzej Krzemienski
|
||||
Copyright (c) 2001-2019 Free Software Foundation, Inc.
|
||||
Copyright (c) 1994 Hewlett-Packard Company
|
||||
Copyright (c) 1996-1998 Silicon Graphics Computer Systems, Inc.
|
||||
Copyright (c) Bjorn Fahller
|
||||
Copyright Michael Park, 2015-2017
|
||||
Copyright (c) 2017-present, Facebook, Inc.
|
||||
Copyright (c) 2018-present, Facebook, Inc.
|
||||
Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
Copyright 2016 Facebook
|
||||
Copyright (c) 2016, NVIDIA CORPORATION
|
||||
Copyright (c) 2008 - 2012 The Khronos Group Inc.
|
||||
Copyright (c) 2008-2013 The Khronos Group Inc.
|
||||
Copyright (c) 2008-2012 The Khronos Group Inc.
|
||||
Copyright (c) 2016-2017, ARM Limited and Contributors
|
||||
Copyright (c) 2014-2015 The Khronos Group Inc.
|
||||
Copyright (c) 2015-2017 The Khronos Group Inc.
|
||||
Copyright (c) Facebook Inc. and Microsoft Corporation
|
||||
Copyright (c) 2014-2017 The Regents of the University of California (Regents)
|
||||
Copyright (c) 2014-2017, the respective contributors
|
||||
Copyright (c) 2017 Microsoft
|
||||
Copyright 2015 The Gemmlowp Authors
|
||||
Copyright (c) 2011-2019 Stephan Brumme
|
||||
Copyright 2006, Google Inc.
|
||||
Copyright (c) Meta Platforms, Inc. and its affiliates
|
||||
Copyright (c) 2008 - 2009 NVIDIA Corporation
|
||||
Copyright (c) 2007-2009 Scientific Computing and Imaging Institute, University of Utah
|
||||
Copyright (c) 2006, Laurent Montel, montel@kde.org
|
||||
Copyright 2013 Conrad Steenberg conrad.steenberg@gmail.com
|
||||
copyright 2022, PyTorch
|
||||
copyright 2023, PyTorch
|
||||
Copyright (c) 2005-2022 NVIDIA Corporation Built
|
||||
copyright PyTorch Contributors
|
||||
Copyright (c) 2018 Alex Rogozhnikov
|
||||
Copyright (c) 2016 Microsoft
|
||||
Copyright (c) 2014, 2015, The Regents of the University of California (Regents)
|
||||
Copyright (c) 2014, 2015, the respective contributors
|
||||
Copyright (c) 2005-2017, NumPy Developers (c) Parameter containing Float
|
||||
Copyright 2005, Google Inc.
|
||||
Copyright 2019 Kakao Brain
|
||||
Copyright 2013-2014 RAD Game
|
||||
Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC
|
||||
Copyright 2016 Martin Raiber
|
||||
Copyright (c) 2003-2017 Josef Weidendorfer
|
||||
Copyright (c) 2000-2017 Julian Seward
|
||||
Copyright (c) Edward Z. Yang ezyang@mit.edu
|
||||
Copyright (c) 2005-2010 ActiveState Software Inc.
|
||||
Copyright (c) 2013 Eddy Petrisor
|
||||
Copyright (c) 2010 ActiveState Software Inc.
|
||||
Copyright (c) 2001-2014 Python Software Foundation
|
||||
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Python Software Foundation
|
||||
Copyright Python Software Foundation
|
||||
Copyright 2022 Cruise LLC
|
||||
Copyright (c) 2014 Matthew Rocklin
|
||||
Copyright (c) 2015 Melissa E. O'Neill
|
||||
Copyright (c) 2019 NumPy Developers
|
||||
Copyright (c) 2015-2016 Advanced Micro Devices, Inc.
|
||||
Copyright 2013 Mark Dickinson
|
||||
|
||||
License: BSD 2-Clause License
|
||||
BSD Two Clause License
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
License: Apache License V2.0
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
1. Definitions.
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
END OF TERMS AND CONDITIONS
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
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.
|
||||
License: LGPL V2.1
|
||||
GNU Lesser General Public License
|
||||
Version 2.1, February 1999
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.
|
||||
This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.
|
||||
When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.
|
||||
To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.
|
||||
For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.
|
||||
We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library.
|
||||
To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.
|
||||
Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license.
|
||||
Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs.
|
||||
When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.
|
||||
We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances.
|
||||
For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.
|
||||
In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.
|
||||
Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.
|
||||
The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run.
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you".
|
||||
A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.
|
||||
The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".)
|
||||
"Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.
|
||||
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.
|
||||
1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.
|
||||
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
|
||||
2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
|
||||
a) The modified work must itself be a software library.
|
||||
b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.
|
||||
c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.
|
||||
d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.
|
||||
(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)
|
||||
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
|
||||
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.
|
||||
In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.
|
||||
Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.
|
||||
This option is useful when you wish to copy part of the code of the Library into a program that is not a library.
|
||||
4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.
|
||||
If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.
|
||||
5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.
|
||||
However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.
|
||||
When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.
|
||||
If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)
|
||||
Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.
|
||||
6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.
|
||||
You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:
|
||||
a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)
|
||||
b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.
|
||||
c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.
|
||||
d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.
|
||||
e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy.
|
||||
For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
|
||||
It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.
|
||||
7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:
|
||||
a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.
|
||||
b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
|
||||
8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
|
||||
9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.
|
||||
10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.
|
||||
11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.
|
||||
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.
|
||||
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
|
||||
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
|
||||
12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
|
||||
13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.
|
||||
14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
|
||||
NO WARRANTY
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License).
|
||||
To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
|
||||
one line to give the library's name and an idea of what it does.
|
||||
Copyright (C) year name of author
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names:
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in
|
||||
the library `Frob' (a library for tweaking knobs) written
|
||||
by James Random Hacker.
|
||||
signature of Ty Coon, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
That's all there is to it!
|
||||
License: GPL V3.0
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
Preamble
|
||||
The GNU General Public License is a free, copyleft license for software and other kinds of works.
|
||||
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
|
||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
|
||||
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
|
||||
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
|
||||
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
|
||||
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
|
||||
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
|
||||
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
TERMS AND CONDITIONS
|
||||
0. Definitions.
|
||||
“This License” refers to version 3 of the GNU General Public License.
|
||||
“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
|
||||
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
|
||||
A “covered work” means either the unmodified Program or a work based on the Program.
|
||||
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||
1. Source Code.
|
||||
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
|
||||
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
|
||||
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||
The Corresponding Source for a work in source code form is that same work.
|
||||
2. Basic Permissions.
|
||||
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
||||
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
||||
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
||||
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
||||
4. Conveying Verbatim Copies.
|
||||
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
||||
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
||||
5. Conveying Modified Source Versions.
|
||||
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
||||
•a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||
•b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
|
||||
•c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
||||
•d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
||||
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||
6. Conveying Non-Source Forms.
|
||||
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
||||
•a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
||||
•b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
||||
•c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
||||
•d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
||||
•e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
||||
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
||||
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
||||
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
||||
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
||||
7. Additional Terms.
|
||||
“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
||||
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
||||
•a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
||||
•b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
||||
•c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
||||
•d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
||||
•e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
||||
•f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
||||
All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
||||
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
||||
8. Termination.
|
||||
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
||||
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
||||
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
||||
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
||||
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
||||
11. Patents.
|
||||
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
|
||||
A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
||||
In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
||||
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
||||
12. No Surrender of Others' Freedom.
|
||||
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||
13. Use with the GNU Affero General Public License.
|
||||
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
|
||||
14. Revised Versions of this License.
|
||||
The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
||||
15. Disclaimer of Warranty.
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
16. Limitation of Liability.
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
||||
END OF TERMS AND CONDITIONS
|
||||
License: BSD 3-Clause License
|
||||
Copyright (c) <YEAR>, <OWNER>
|
||||
All rights reserved.
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
License: MIT License
|
||||
The MIT License
|
||||
Copyright (c) <year> <copyright holders>
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
License: Boost Software License V1.0
|
||||
1 Boost Software License - Version 1.0
|
||||
2 August 17th, 2003
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
Copyright (c) , <YEAR>,<OWNER>
|
||||
All rights reserved.
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Written Offer
|
||||
This product contains software whose rights holders license it on the terms of the GNU General Public License, version 2 (GPLv2) and/or other open source software licenses. We will provide you and any third party with the source code of the software licensed under an open source software license if you send us a written request by mail or email to the following addresses:
|
||||
This product contains software whose rights holders license it on the terms of the GNU General Public License, version 2 (GPLv2) and/or other open source software licenses. We will provide you and any third party with the source code of the software licensed under an open source software license if you send us a written request by mail or email to the following addresses:
|
||||
foss@huawei.com
|
||||
detailing the name of the product and the firmware version for which you need the source code and indicating how we can contact you.
|
||||
|
||||
|
||||
@@ -122,6 +122,16 @@ def check_gtest_valid(base_dir):
|
||||
return os.path.exists(gtest_path)
|
||||
|
||||
|
||||
def generate_dbg_files_and_strip():
|
||||
library_dir = Path(BASE_DIR).joinpath("build/packages/torch_npu")
|
||||
dbg_dir = Path(BASE_DIR).joinpath("build/dbg_libtorch")
|
||||
os.makedirs(dbg_dir, exist_ok=True)
|
||||
library_files = [Path(i) for i in library_dir.rglob('*.so')]
|
||||
for library_file in library_files:
|
||||
subprocess.check_call(["eu-strip", library_file, "-f",
|
||||
str(dbg_dir.joinpath(library_file.name)) + ".debug"], cwd=BASE_DIR) # Compliant
|
||||
|
||||
|
||||
def run_cmake():
|
||||
cmake = get_cmake_command()
|
||||
|
||||
@@ -159,6 +169,8 @@ def run_cmake():
|
||||
|
||||
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)
|
||||
if which('eu-strip') is not None:
|
||||
generate_dbg_files_and_strip()
|
||||
|
||||
|
||||
def check_opplugin_valid(base_dir):
|
||||
|
||||
+103
-23
@@ -6,14 +6,27 @@ import sys
|
||||
import subprocess
|
||||
import threading
|
||||
import queue
|
||||
import argparse
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from pathlib import Path
|
||||
import psutil
|
||||
from torch_npu.utils.path_manager import PathManager
|
||||
|
||||
|
||||
BASE_DIR = Path(__file__).absolute().parent.parent
|
||||
TEST_DIR = BASE_DIR / 'test'
|
||||
|
||||
# Add slow test cases here (first element must be test_ops)
|
||||
SLOW_TEST_BLOCKLIST = [
|
||||
'test_ops',
|
||||
'test_modules',
|
||||
'test_binary_ufuncs',
|
||||
'test_ops_fwd_gradients',
|
||||
'test_ops_gradients',
|
||||
'test_reductions',
|
||||
'test_unary_ufuncs'
|
||||
]
|
||||
|
||||
|
||||
class AccurateTest(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
@@ -76,7 +89,7 @@ class CoreTestStrategy(AccurateTest):
|
||||
Determine whether the core tests should be runned
|
||||
"""
|
||||
block_list = ['test', 'docs']
|
||||
core_test_cases = [str(i) for i in (BASE_DIR / 'test/test_npu').rglob('test_*.py')]
|
||||
core_test_cases = [str(i) for i in (BASE_DIR / 'test/npu').rglob('test_*.py')]
|
||||
|
||||
def identify(self, modify_file):
|
||||
modified_module = str(Path(modify_file).parts[0])
|
||||
@@ -102,25 +115,39 @@ class DirectoryMappingStrategy(AccurateTest):
|
||||
Map the modified files to the corresponding test cases
|
||||
"""
|
||||
mapping_list = {
|
||||
'contrib': 'test/test_contrib',
|
||||
'cpp_extension': 'test/test_cpp_extension',
|
||||
'distributed': 'test/test_distributed',
|
||||
'fx': 'test/test_fx',
|
||||
'hooks': 'test/test_hooks',
|
||||
'optim': 'test/test_optim',
|
||||
'profiler': 'test/test_profiler',
|
||||
'onnx': 'test/test_onnx',
|
||||
'utils': 'test/test_utils',
|
||||
'contrib': 'test/contrib',
|
||||
'cpp_extension': 'test/cpp_extensions',
|
||||
'distributed': 'test/distributed',
|
||||
'fx': 'test/test_fx.py',
|
||||
'optim': 'test/optim',
|
||||
'profiler': 'test/profiler',
|
||||
'onnx': 'test/onnx',
|
||||
'utils': 'test/test_utils.py',
|
||||
'testing': 'test/test_testing.py',
|
||||
'jit': 'test/jit',
|
||||
'rpc': 'test/distributed/rpc',
|
||||
'dynamo': 'test/dynamo',
|
||||
'checkpoint': 'test/distributed/checkpoint',
|
||||
}
|
||||
|
||||
def get_module_name(self, modify_file):
|
||||
module_name = str(Path(modify_file).parts[1])
|
||||
if module_name == 'csrc':
|
||||
module_name = str(Path(modify_file).parts[2])
|
||||
for part in Path(modify_file).parts:
|
||||
if part == 'rpc' or part == 'checkpoint':
|
||||
module_name = part
|
||||
if module_name == 'utils' and Path(modify_file).parts[2] == 'cpp_extension.py':
|
||||
module_name = 'cpp_extension'
|
||||
if module_name == 'utils' and 'dynamo' in Path(modify_file).parts[2]:
|
||||
module_name = 'dynamo'
|
||||
return module_name
|
||||
|
||||
def identify(self, modify_file):
|
||||
current_all_ut_path = []
|
||||
if str(Path(modify_file).parts[0]) == 'torch_npu':
|
||||
mapped_ut_path = []
|
||||
module_name = str(Path(modify_file).parts[1])
|
||||
if module_name == 'csrc':
|
||||
module_name = str(Path(modify_file).parts[2])
|
||||
module_name = self.get_module_name(modify_file)
|
||||
if module_name in self.mapping_list:
|
||||
mapped_ut_path.append(self.mapping_list[module_name])
|
||||
file_name = str(Path(modify_file).stem)
|
||||
@@ -131,11 +158,11 @@ class DirectoryMappingStrategy(AccurateTest):
|
||||
if Path.is_file(BASE_DIR / mapped_path):
|
||||
current_all_ut_path.append(str(BASE_DIR / mapped_path))
|
||||
else:
|
||||
current_all_ut_path += [str(i) for i in (BASE_DIR / mapped_path).rglob('test_*.py')]
|
||||
current_all_ut_path += [str(i) for i in (BASE_DIR / mapped_path).glob('test_*.py')]
|
||||
return current_all_ut_path
|
||||
|
||||
|
||||
class TestMgr():
|
||||
class TestMgr:
|
||||
def __init__(self):
|
||||
self.modify_files = []
|
||||
self.test_files = {
|
||||
@@ -166,6 +193,34 @@ class TestMgr():
|
||||
if Path(changed_file).exists()
|
||||
]
|
||||
self.test_files['ut_files'] = exist_ut_file
|
||||
self.exclude_test_files(SLOW_TEST_BLOCKLIST)
|
||||
|
||||
def load_core_ut(self):
|
||||
self.test_files['ut_files'] += [str(i) for i in (BASE_DIR / 'test/npu').rglob('test_*.py')]
|
||||
|
||||
def load_distributed_ut(self):
|
||||
self.test_files['ut_files'] += [str(i) for i in (BASE_DIR / 'test/distributed').rglob('test_*.py')]
|
||||
|
||||
def load_ut_in_parallel(self, rank, world_size):
|
||||
if rank > world_size:
|
||||
raise Exception(f'rank {rank} is greater than world_size {world_size}')
|
||||
all_files = [str(i) for i in (BASE_DIR / 'test').rglob('test_*.py')
|
||||
if 'distributed' not in str(i) and 'test_ops.py' not in str(i)]
|
||||
begin = (rank - 1) * len(all_files) // world_size
|
||||
end = rank * len(all_files) // world_size
|
||||
self.test_files['ut_files'] = all_files[begin:end]
|
||||
|
||||
def exclude_test_files(self, block_list):
|
||||
def remove_test_files(key):
|
||||
for test_name in block_list:
|
||||
test_files_copy = self.test_files[key][:]
|
||||
for test_file in test_files_copy:
|
||||
if test_name in test_file:
|
||||
print(f'Excluding slow test: {test_name}')
|
||||
self.test_files[key].remove(test_file)
|
||||
|
||||
for test_files_key in self.test_files.keys():
|
||||
remove_test_files(test_files_key)
|
||||
|
||||
def get_test_files(self):
|
||||
return self.test_files
|
||||
@@ -191,16 +246,18 @@ def exec_ut(files):
|
||||
执行单元测试文件,其中存在失败,则标识异常并打印相关信息
|
||||
"""
|
||||
def get_op_name(ut_file):
|
||||
return ut_file.split('/')[-1].split('.')[0].lstrip('test_')
|
||||
op_name = str(ut_file.split('/')[-1].split('.')[0])
|
||||
return op_name[5:] if op_name.startswith("test_") else op_name
|
||||
|
||||
def get_ut_name(ut_file):
|
||||
return str(Path(ut_file).relative_to(TEST_DIR))[:-3]
|
||||
|
||||
def get_ut_cmd(ut_type, ut_file):
|
||||
cmd = [sys.executable, "run_test.py", "-v", "-i"]
|
||||
cmd = [sys.executable, "run_test.py", "-v"]
|
||||
if ut_type == "op_ut_files":
|
||||
return cmd + ["test_ops", "--", "-k", get_op_name(ut_file)]
|
||||
return cmd + [get_ut_name(ut_file)]
|
||||
# do not skip ops related test entries
|
||||
return cmd + ["-e"] + SLOW_TEST_BLOCKLIST[1:] + ["-i", "test_ops", "--", "-k", "_" + get_op_name(ut_file)]
|
||||
return cmd + ["-i", get_ut_name(ut_file)]
|
||||
|
||||
def wait_thread(process, event_timer):
|
||||
process.wait()
|
||||
@@ -218,7 +275,7 @@ def exec_ut(files):
|
||||
stdout_t.start()
|
||||
|
||||
def print_subprocess_log(log_queue):
|
||||
while (not log_queue.empty()):
|
||||
while not log_queue.empty():
|
||||
print((log_queue.get()).strip())
|
||||
|
||||
def run_cmd_with_timeout(cmd):
|
||||
@@ -237,6 +294,9 @@ def exec_ut(files):
|
||||
print_subprocess_log(stdout_queue)
|
||||
if not event_timer.is_set():
|
||||
ret = 1
|
||||
parent_process = psutil.Process(p.pid)
|
||||
for children_process in parent_process.children(recursive=True):
|
||||
children_process.kill()
|
||||
p.kill()
|
||||
p.terminate()
|
||||
print("Timeout: Command '{}' timed out after 2000 seconds".format(" ".join(cmd)))
|
||||
@@ -252,7 +312,9 @@ def exec_ut(files):
|
||||
for ut_type, ut_files in files.items():
|
||||
for ut_file in ut_files:
|
||||
cmd = get_ut_cmd(ut_type, ut_file)
|
||||
ut_info = " ".join(cmd[4:]).replace(" -- -k", "")
|
||||
ut_info = str(cmd[-1])
|
||||
if ut_type == "op_ut_files":
|
||||
ut_info = "test_ops " + ut_info
|
||||
ret = run_cmd_with_timeout(cmd)
|
||||
if ret:
|
||||
has_failed = ret
|
||||
@@ -270,10 +332,28 @@ def exec_ut(files):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description='Control needed ut cases')
|
||||
parser.add_argument(
|
||||
'--only_distributed', action="store_true", help='Only run distributed cases')
|
||||
parser.add_argument(
|
||||
'--rank', default=0, type=int, help='Index of current ut nodes')
|
||||
parser.add_argument(
|
||||
'--world_size', default=0, type=int, help='Number of ut nodes')
|
||||
options = parser.parse_args()
|
||||
cur_modify_files = str(BASE_DIR / 'modify_files.txt')
|
||||
test_mgr = TestMgr()
|
||||
test_mgr.load(cur_modify_files)
|
||||
test_mgr.analyze()
|
||||
if options.only_distributed:
|
||||
test_mgr.load_distributed_ut()
|
||||
else:
|
||||
if options.rank > 0 and options.world_size > 0:
|
||||
test_mgr.load_ut_in_parallel(options.rank, options.world_size)
|
||||
else:
|
||||
if os.path.exists(cur_modify_files):
|
||||
test_mgr.load(cur_modify_files)
|
||||
test_mgr.analyze()
|
||||
else:
|
||||
test_mgr.load_core_ut()
|
||||
|
||||
cur_test_files = test_mgr.get_test_files()
|
||||
|
||||
test_mgr.print_modify_files()
|
||||
|
||||
+1
-5
@@ -6,6 +6,7 @@ CUR_DIR=$(dirname $(readlink -f $0))
|
||||
SUPPORTED_PY_VERSION=(3.8 3.9 3.10)
|
||||
PY_VERSION='3.8' # Default supported python version is 3.8
|
||||
DEFAULT_SCRIPT_ARGS_NUM=1 # Default supported input parameters
|
||||
export DISABLE_RPC_FRAMEWORK=FALSE
|
||||
|
||||
# Parse arguments inside script
|
||||
function parse_script_args() {
|
||||
@@ -40,11 +41,6 @@ function parse_script_args() {
|
||||
args_num=$((args_num-1))
|
||||
shift
|
||||
;;
|
||||
--tocpu=*)
|
||||
export 'NPU_TOCPU'=${1:8}
|
||||
args_num=$((args_num-1))
|
||||
shift
|
||||
;;
|
||||
--disable_torchair)
|
||||
export DISABLE_INSTALL_TORCHAIR=TRUE
|
||||
shift
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
py_execute=${1-python3}
|
||||
CUR_DIR=$(dirname $(readlink -f $0))
|
||||
|
||||
cd ${CUR_DIR}/../examples/libtorch_resnet
|
||||
@@ -8,7 +9,7 @@ if [ -f ./resnet_model.pt ]; then
|
||||
rm ./resnet_model.pt
|
||||
fi
|
||||
|
||||
python3 resnet_trace.py
|
||||
$py_execute resnet_trace.py
|
||||
|
||||
if [ $? != 0 ]; then
|
||||
echo "Failed to trace resnet model."
|
||||
@@ -20,7 +21,7 @@ if [ -d "build" ]; then
|
||||
fi
|
||||
|
||||
mkdir build && cd build && \
|
||||
cmake -DCMAKE_PREFIX_PATH=`python3 -c 'import torch;print(torch.utils.cmake_prefix_path)'` .. && \
|
||||
cmake -DCMAKE_PREFIX_PATH=`$py_execute -c 'import torch;print(torch.utils.cmake_prefix_path)'` .. && \
|
||||
make && ./libtorch_resnet ../resnet_model.pt > out.log
|
||||
|
||||
if grep -q "resnet_model run success!" out.log; then
|
||||
|
||||
@@ -29,6 +29,7 @@ from .gen_variable_type import (
|
||||
gen_variable_type, gen_variable_type_head
|
||||
)
|
||||
from .gen_variable_factories import gen_variable_factories
|
||||
from .gen_autograd_functions import gen_autograd_functions_python
|
||||
from .utils import parse_derivatives, filt_npu_autograd_functions
|
||||
|
||||
|
||||
@@ -61,6 +62,9 @@ def gen_autograd(
|
||||
# Generate variable_factories.h
|
||||
gen_variable_factories(out, torch_template_path, native_funcs)
|
||||
|
||||
# Generate python_functions.h/cpp
|
||||
gen_autograd_functions_python(out, differentiability_infos, template_path)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
# Generates C++ autograd functions for the derivatives of ATen operations
|
||||
#
|
||||
# This writes two files:
|
||||
# python_functions.h/cpp: Python bindings for subclasses of autograd::Node
|
||||
|
||||
from typing import Dict
|
||||
from torchgen.api.autograd import DifferentiabilityInfo
|
||||
from torchgen.model import FunctionSchema
|
||||
from torchgen.utils import FileManager
|
||||
from torchgen.gen import FileManager
|
||||
from torchgen.packaged.autograd.gen_autograd_functions import (
|
||||
process_function,
|
||||
get_infos_with_derivatives_list,
|
||||
PY_FUNCTION_DEFINITION,
|
||||
PY_FUNCTION_PROPS_AND_GETTERS
|
||||
)
|
||||
|
||||
|
||||
def gen_autograd_functions_python(
|
||||
out: str,
|
||||
differentiability_infos: Dict[FunctionSchema, Dict[str, DifferentiabilityInfo]],
|
||||
template_path: str,
|
||||
) -> None:
|
||||
fm = FileManager(install_dir=out, template_dir=template_path, dry_run=False)
|
||||
num_shards = 2
|
||||
fm.write(
|
||||
"python_functions.h",
|
||||
lambda: {
|
||||
"generated_comment":
|
||||
f"@ generated from {fm.template_dir_for_comments()}/python_functions.h",
|
||||
"shard_forward_declare": [
|
||||
f"void initialize_autogenerated_functions_{i}(PyObject* module);"
|
||||
for i in range(num_shards)
|
||||
],
|
||||
"shard_call": [
|
||||
f"initialize_autogenerated_functions_{i}(module);"
|
||||
for i in range(num_shards)
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
# get a 1D list of diffinfos, we do not need them to be per FunctionSchema/DispatchKey here
|
||||
# infos with the diff dispatchkeys but the same name will still be in the same shard.
|
||||
infos = get_infos_with_derivatives_list(differentiability_infos)
|
||||
fm.write_sharded(
|
||||
"python_functions.cpp",
|
||||
infos,
|
||||
key_fn=lambda info: info.name,
|
||||
base_env={
|
||||
"generated_comment":
|
||||
f"@ generated from {fm.template_dir_for_comments()}/python_functions.cpp",
|
||||
},
|
||||
env_callable=lambda info: {
|
||||
"py_function_initializers": [
|
||||
process_function(info, PY_FUNCTION_DEFINITION)
|
||||
],
|
||||
"py_function_props_and_getters": [
|
||||
process_function(info, PY_FUNCTION_PROPS_AND_GETTERS)
|
||||
],
|
||||
},
|
||||
num_shards=num_shards,
|
||||
sharded_keys={"py_function_initializers", "py_function_props_and_getters"},
|
||||
)
|
||||
@@ -0,0 +1,46 @@
|
||||
#ifndef BUILD_LIBTORCH
|
||||
#include <torch/csrc/autograd/generated/python_functions.h>
|
||||
|
||||
// ${generated_comment}
|
||||
|
||||
#include <Python.h>
|
||||
#include <ATen/ATen.h>
|
||||
|
||||
#include <c10/core/SymNodeImpl.h>
|
||||
#include <torch/csrc/autograd/generated/Functions.h>
|
||||
#include <torch/csrc/autograd/python_cpp_function.h>
|
||||
#include <torch/csrc/autograd/python_variable.h>
|
||||
#include <torch/csrc/autograd/saved_variable.h>
|
||||
#include <torch/csrc/utils/pybind.h>
|
||||
#include <pybind11/pybind11.h>
|
||||
#include <torch/csrc/utils/pybind.h>
|
||||
#include "torch_npu/csrc/aten/Functions.h"
|
||||
|
||||
// NOTE: See [Sharded File] comment in VariableType
|
||||
|
||||
namespace at_npu {
|
||||
namespace autograd {
|
||||
namespace generated {
|
||||
|
||||
template <typename C>
|
||||
static void addClass(PyObject *module, PyTypeObject &type, const char *name,
|
||||
PyGetSetDef *function_properties = NULL,
|
||||
PyMethodDef *function_methods = NULL)
|
||||
{
|
||||
_initFunctionPyTypeObject(type, name, function_properties, function_methods);
|
||||
Py_INCREF(&type);
|
||||
PyModule_AddObject(module, name, (PyObject *)&type);
|
||||
registerCppFunction(typeid(C), &type);
|
||||
}
|
||||
|
||||
${py_function_props_and_getters}
|
||||
|
||||
void initialize_autogenerated_functions${shard_id}(PyObject *module)
|
||||
{
|
||||
${py_function_initializers}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace at_npu::autograd::generated
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef BUILD_LIBTORCH
|
||||
#pragma once
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
// ${generated_comment}
|
||||
|
||||
// Python bindings for automatically generated autograd functions
|
||||
|
||||
namespace at_npu {
|
||||
namespace autograd {
|
||||
namespace generated {
|
||||
|
||||
${shard_forward_declare}
|
||||
|
||||
inline void initialize_autogenerated_functions(PyObject *module)
|
||||
{
|
||||
${shard_call}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace at_npu::autograd::generated
|
||||
|
||||
#endif
|
||||
@@ -1,13 +1,26 @@
|
||||
"""
|
||||
This file is mainly used to transform failed test names into DecorateInfo Object.
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
import os
|
||||
import yaml
|
||||
|
||||
from torchgen.code_template import CodeTemplate
|
||||
from torchgen.gen import FileManager
|
||||
|
||||
unsupported_dict_path = os.path.realpath(os.path.join("test", "unsupported_ops_info.yaml"))
|
||||
from codegen.autograd.utils import VERSION_PART
|
||||
from codegen.utils import PathManager
|
||||
|
||||
project_path = Path(os.path.dirname(__file__)).parent
|
||||
op_plugin_info_path = os.path.realpath(os.path.join(
|
||||
project_path,
|
||||
f'third_party/op-plugin/test/test_v{VERSION_PART[0]}r{VERSION_PART[1]}_ops',
|
||||
"unsupported_ops_info.yaml"))
|
||||
torch_npu_info_path = os.path.realpath(os.path.join(project_path, "test", "unsupported_ops_info.yaml"))
|
||||
|
||||
unsupported_dict_path = op_plugin_info_path if os.path.exists(op_plugin_info_path) else torch_npu_info_path
|
||||
PathManager.check_directory_path_readable(unsupported_dict_path)
|
||||
with open(unsupported_dict_path, "r") as f:
|
||||
unsupported_summary_dict = yaml.safe_load(f)
|
||||
skip_list = dict()
|
||||
@@ -85,7 +98,7 @@ def gen_ops_info(summary_dict):
|
||||
)
|
||||
fm = FileManager(os.path.join("torch_npu", "testing"), os.path.join("codegen", "templates"), False)
|
||||
|
||||
fm.write_with_template(f"npu_testing_utils.py", "npu_testing_utils.py", lambda:{
|
||||
fm.write_with_template(f"_npu_testing_utils.py", "npu_testing_utils.py", lambda:{
|
||||
"skip_detail": [skip_template.substitute(op_name=op, decorators=doc) for op, doc in skip_list.items()]
|
||||
})
|
||||
|
||||
|
||||
+27
-38
@@ -4,14 +4,14 @@ from typing import List, Dict, Sequence
|
||||
import yaml
|
||||
|
||||
from torchgen.code_template import CodeTemplate
|
||||
from torchgen.gen import (parse_tags_yaml, LineLoader, FileManager, cpp_string, error_check_native_functions)
|
||||
from torchgen.model import (BackendIndex, DispatchKey, Location, Variant,
|
||||
from torchgen.gen import (parse_tags_yaml, FileManager, cpp_string, error_check_native_functions)
|
||||
from torchgen.model import (BackendIndex, DispatchKey, Variant,
|
||||
NativeFunction, OperatorName, BackendMetadata)
|
||||
from torchgen.utils import concatMap, context
|
||||
from torchgen.utils import concatMap
|
||||
from torchgen.context import with_native_function, native_function_manager
|
||||
from torchgen.api.types import DispatcherSignature
|
||||
from torchgen.api import cpp
|
||||
from codegen.utils import (enable_opplugin, is_op_valid, filed_tag, get_opplugin_wrap_name, PathManager)
|
||||
from codegen.utils import (enable_opplugin, is_op_valid, field_tag, get_opplugin_wrap_name, parse_npu_yaml)
|
||||
|
||||
|
||||
# Parse native_functions.yaml into a sequence of NativeFunctions and Backend Indices.
|
||||
@@ -22,11 +22,6 @@ CUSTOM_FUNCTIONS_DECLARATION = CodeTemplate("""\
|
||||
${return_type} ${func_name}(${args_str});
|
||||
""")
|
||||
|
||||
EXPORT_CUSTOM_FUNCTIONS_DECLARATION = CodeTemplate("""\
|
||||
__attribute__((__visibility__("default"))) \
|
||||
${return_type} ${func_name}(${args_str});
|
||||
""")
|
||||
|
||||
CUSTOM_FUNCTIONS_DEFINITION = CodeTemplate("""\
|
||||
${return_type} ${func_name}(${args_str}) {
|
||||
static auto op = c10::Dispatcher::singleton().findSchemaOrThrow("npu::${base_name}", "${overload}").typed<${schema}>();
|
||||
@@ -34,31 +29,28 @@ ${return_type} ${func_name}(${args_str}) {
|
||||
}
|
||||
""")
|
||||
|
||||
SKIP_PYTHON_BINDINGS_SIGNATURES = []
|
||||
|
||||
|
||||
@with_native_function
|
||||
def should_generate_ops_patch(f: NativeFunction) -> bool:
|
||||
func_signature = str(f.func)
|
||||
|
||||
for pattern in SKIP_PYTHON_BINDINGS_SIGNATURES:
|
||||
if pattern == func_signature:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def parse_custom_yaml(custom_path: str, tag_path: str) -> ParsedYaml:
|
||||
valid_tags = parse_tags_yaml(tag_path)
|
||||
rs: List[NativeFunction] = []
|
||||
bs: Dict[DispatchKey, Dict[OperatorName, BackendMetadata]] = defaultdict(dict)
|
||||
# Filter the custom native yaml file, and extract the functions we defined.
|
||||
from io import StringIO
|
||||
f_str = StringIO()
|
||||
PathManager.check_directory_path_readable(custom_path)
|
||||
with open(custom_path, 'r') as f:
|
||||
for line in f:
|
||||
if line.split(':')[0] in ['backend', 'cpp_namespace', 'extra_headers',
|
||||
'supported', 'autograd']:
|
||||
flag = False
|
||||
continue
|
||||
if line.split(':')[0] in ['custom', 'custom_autograd']:
|
||||
flag = True
|
||||
continue
|
||||
if ':' not in line or not flag:
|
||||
continue
|
||||
f_str.write(line)
|
||||
|
||||
f_str.seek(0)
|
||||
custom_es = yaml.safe_load(f_str)
|
||||
custom_es = filed_tag(custom_es)
|
||||
source_es = parse_npu_yaml(custom_path)
|
||||
custom_es = source_es.get('custom', []) + source_es.get('custom_autograd', [])
|
||||
custom_es = field_tag(custom_es)
|
||||
for e_with_vars in custom_es:
|
||||
func, m = NativeFunction.from_yaml(e_with_vars, "Location", valid_tags)
|
||||
func.variants.discard(Variant.method)
|
||||
@@ -106,7 +98,8 @@ def compute_op_definition(f: NativeFunction):
|
||||
if enable_opplugin() and is_op_valid(str(f.func.name)):
|
||||
impl_name = f"op_plugin::{get_opplugin_wrap_name(f)}"
|
||||
|
||||
check_out = [f'TORCH_CHECK(out.size() == {out_num}, "expected tuple of {out_num} elements but got ", out.size());']
|
||||
check_out = [f'TORCH_CHECK(out.size() == {out_num}, "expected tuple of {out_num} elements but got ", out.size(), '
|
||||
f'OPS_ERROR(ErrCode::PARAM));']
|
||||
unpack_out = check_out + [f'at::Tensor {args[-out_num + i].name} = out[{i}];' for i in range(out_num)] \
|
||||
if out_num > 1 else ''
|
||||
out_return_type = '::std::tuple<{}>'.format(', '.join(['at::Tensor'] * out_num))
|
||||
@@ -164,9 +157,11 @@ def gen_custom_trace(fm: FileManager, custom_trace_functions: Sequence[NativeFun
|
||||
|
||||
|
||||
def gen_custom_ops_patch(fm: FileManager, custom_trace_functions: Sequence[NativeFunction]):
|
||||
|
||||
valid_native_functions = list(filter(should_generate_ops_patch, custom_trace_functions))
|
||||
fm.write_with_template(f'custom_ops.py', 'custom_ops.py', lambda: {
|
||||
'custom_ops': [f'torch_npu.{ops} = torch.ops.npu.{ops}'
|
||||
for ops in set([f.func.name.name for f in custom_trace_functions])],
|
||||
for ops in set([f.func.name.name for f in valid_native_functions])],
|
||||
})
|
||||
|
||||
|
||||
@@ -176,15 +171,9 @@ def compute_custom_functions_declaration(f: NativeFunction, func_type: str):
|
||||
name = sig.name()
|
||||
args = sig.arguments()
|
||||
if func_type == 'call':
|
||||
args_str = ', '.join(a.defn() for a in args)
|
||||
args_str = ', '.join(a.decl() for a in args)
|
||||
if func_type == 'redispatch':
|
||||
args_str = 'c10::DispatchKeySet dispatchKeySet, ' + ', '.join(a.defn() for a in args)
|
||||
|
||||
if (func_type == 'call') and (name == 'npu_slice_out'):
|
||||
return [EXPORT_CUSTOM_FUNCTIONS_DECLARATION.substitute(
|
||||
return_type=cpp.returns_type(f.func.returns).cpp_type(),
|
||||
func_name=name,
|
||||
args_str=args_str,)]
|
||||
args_str = 'c10::DispatchKeySet dispatchKeySet, ' + ', '.join(a.decl() for a in args)
|
||||
|
||||
return [CUSTOM_FUNCTIONS_DECLARATION.substitute(
|
||||
return_type=cpp.returns_type(f.func.returns).cpp_type(),
|
||||
|
||||
@@ -17,32 +17,31 @@
|
||||
import pathlib
|
||||
import argparse
|
||||
import os
|
||||
import stat
|
||||
import re
|
||||
from collections import namedtuple, Counter, defaultdict
|
||||
from typing import List, Dict, Union, Sequence, Optional, Set, Callable
|
||||
import yaml
|
||||
|
||||
from torchgen.code_template import CodeTemplate
|
||||
from torchgen.gen import (parse_tags_yaml, LineLoader, FileManager, parse_native_yaml,
|
||||
from torchgen.gen import (parse_tags_yaml, FileManager, parse_native_yaml,
|
||||
get_grouped_native_functions, error_check_native_functions)
|
||||
from torchgen.model import (BackendIndex, DispatchKey, Location,
|
||||
from torchgen.model import (BackendIndex, DispatchKey,
|
||||
NativeFunction, NativeFunctionsGroup, OperatorName,
|
||||
BackendMetadata, is_cuda_dispatch_key)
|
||||
from torchgen.native_function_generation import add_generated_native_functions
|
||||
from torchgen.selective_build.selector import SelectiveBuilder
|
||||
from torchgen.utils import Target, concatMap, context, NamespaceHelper
|
||||
from torchgen.context import native_function_manager
|
||||
import torchgen.dest as dest
|
||||
import torchgen.api.dispatcher as dispatcher
|
||||
from torchgen.api.types import DispatcherSignature
|
||||
import torchgen.api.native as native
|
||||
from torchgen.api.cpp import JIT_TO_CPP_DEFAULT
|
||||
from torchgen.gen_backend_stubs import gen_dispatchkey_nativefunc_headers
|
||||
|
||||
from codegen.utils import (get_torchgen_dir, rename_privateuse1_dispatch_key, gen_unstructured,
|
||||
add_header_to_template_file, parse_npu_yaml, get_opplugin_wrap_name,
|
||||
parse_opplugin_yaml, merge_custom_yaml, filed_tag, gen_custom_yaml_path,
|
||||
update_opapi_info, is_opapi, PathManager)
|
||||
get_target_functions, merge_custom_yaml, field_tag, gen_custom_yaml_path,
|
||||
update_opapi_info, is_opapi, PathManager, filt_exposed_api, get_target_native_registration)
|
||||
from codegen.custom_functions import (parse_custom_yaml, gen_custom_trace, gen_custom_ops_patch,
|
||||
gen_custom_functions_dispatch)
|
||||
|
||||
@@ -139,7 +138,7 @@ def parse_native_and_custom_yaml(path: str, tag_path: str, custom_path: str) ->
|
||||
supported_es = source_es.get('supported', []) + source_es.get('autograd', []) + custom_es
|
||||
for es in supported_es:
|
||||
update_opapi_info(es)
|
||||
custom_es = filed_tag(custom_es)
|
||||
custom_es = field_tag(custom_es)
|
||||
for e in custom_es:
|
||||
func, m = NativeFunction.from_yaml(e, "Location", valid_tags)
|
||||
rs.append(func)
|
||||
@@ -192,7 +191,7 @@ def parse_backend_yaml(
|
||||
if not isinstance(yaml_values, dict):
|
||||
raise TypeError("yaml_values is not dict")
|
||||
|
||||
valid_keys = ['backend', 'cpp_namespace', 'tocpu', 'supported', 'autograd', 'custom', 'custom_autograd', 'symint']
|
||||
valid_keys = ['backend', 'cpp_namespace', 'supported', 'autograd', 'custom', 'custom_autograd', 'symint']
|
||||
|
||||
yaml_backend = yaml_values.pop('backend', None)
|
||||
true_backend = 'PrivateUse1' if yaml_backend == 'NPU' else yaml_backend
|
||||
@@ -221,13 +220,11 @@ def parse_backend_yaml(
|
||||
supported_autograd = yaml_values.pop('autograd', [])
|
||||
if not isinstance(supported_autograd, list):
|
||||
raise TypeError(f'expected "autograd" to be a list, but got: {supported_autograd}')
|
||||
supported = [op['func'].split("(")[0] if isinstance(op, Dict) else op for op in supported]
|
||||
supported = [op['func'].split("(")[0] for op in supported
|
||||
if isinstance(op, Dict) and ("impl_ns" in op.keys() or "op_api" in op.keys())] + \
|
||||
[op for op in supported if not isinstance(op, Dict)]
|
||||
supported_autograd = [op['func'].split("(")[0] if isinstance(op, Dict) else op for op in supported_autograd]
|
||||
|
||||
supported_tocpu = yaml_values.pop('tocpu', [])
|
||||
if not isinstance(supported_tocpu, list):
|
||||
raise TypeError(f'expected "tocpu" to be a list, but got: {supported_tocpu}')
|
||||
|
||||
custom = yaml_values.pop('custom', [])
|
||||
if not isinstance(custom, list):
|
||||
raise TypeError(f'expected "autograd" to be a list, but got: {custom}')
|
||||
@@ -244,6 +241,8 @@ def parse_backend_yaml(
|
||||
for item in custom_autograd:
|
||||
supported_autograd.append(item['func'][:item['func'].index('(')])
|
||||
|
||||
# custom_supported is only supported for filt expose api, and is not useful here.
|
||||
yaml_values.pop('custom_supported', [])
|
||||
if (len(yaml_values.keys()) > 0):
|
||||
raise KeyError(f'{backend_yaml_path} contains unexpected keys: {", ".join(yaml_values.keys())}. \
|
||||
Only the following keys are supported: {", ".join(valid_keys)}')
|
||||
@@ -277,21 +276,10 @@ the behavior of autograd for some operators on your backend. However "Autograd{b
|
||||
backend_indices[autograd_key] = autograd_idx
|
||||
backend_indices[str(autograd_key) + opapi_key] = opapi_autograd_idx
|
||||
|
||||
check_op_on_cpu_kernels(supported_tocpu, backend_indices)
|
||||
check_grouped_native_functions(backend_key, autograd_key, backend_indices, grouped_native_functions)
|
||||
return ParsedExternalYaml(true_backend, backend_key, autograd_key, cpp_namespace, backend_indices)
|
||||
|
||||
|
||||
def check_op_on_cpu_kernels(
|
||||
expected_to_cpu: List,
|
||||
backend_indices: Dict[DispatchKey, BackendIndex]):
|
||||
op_names: List[OperatorName] = list(backend_indices[DispatchKey.CPU].index.keys())
|
||||
|
||||
for op_name in op_names:
|
||||
if op_name.name.base not in expected_to_cpu:
|
||||
backend_indices[DispatchKey.CPU].index.pop(op_name, None)
|
||||
|
||||
|
||||
def op_plugin_kernel_conut(op_plugin_ops_dir: str):
|
||||
actual_backend_kernel_name_counts = Counter()
|
||||
file_path = os.path.join(op_plugin_ops_dir, "OpInterface.h")
|
||||
@@ -340,8 +328,6 @@ def check_op_plugin_kernels(
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(description='Generate backend stub files')
|
||||
parser.add_argument(
|
||||
'--to_cpu', type=str, default="TRUE", help='move op which npu does not support to cpu')
|
||||
parser.add_argument(
|
||||
'-s',
|
||||
'--source_yaml',
|
||||
@@ -360,7 +346,7 @@ def main() -> None:
|
||||
help='path to the source yaml file containing kernel definitions in op_plugin')
|
||||
options = parser.parse_args()
|
||||
|
||||
run(options.to_cpu, options.source_yaml, options.output_dir, options.dry_run,
|
||||
run(options.source_yaml, options.output_dir, options.dry_run,
|
||||
options.impl_path, options.op_plugin_impl_path, options.op_plugin_yaml_path)
|
||||
|
||||
|
||||
@@ -374,6 +360,7 @@ def gen_dispatcher_registrations(
|
||||
selector: "SelectiveBuilder",
|
||||
dispatch_key_name: str,
|
||||
register_dispatch_key_func: Callable,
|
||||
native_function_registrations: str = '',
|
||||
):
|
||||
backend_index = backend_indices[backend_dispatch_key]
|
||||
ns_helper = NamespaceHelper(namespace_str="at")
|
||||
@@ -430,7 +417,7 @@ $dispatch_registrations_body
|
||||
'deferred_dispatch_registrations': '',
|
||||
'dispatch_helpers': dest.gen_registration_helpers(backend_index),
|
||||
'dispatch_namespace': dispatch_key.lower(),
|
||||
'dispatch_namespaced_definitions': '',
|
||||
'dispatch_namespaced_definitions': native_function_registrations,
|
||||
'dispatch_anonymous_definitions': list(
|
||||
concatMap(
|
||||
register_dispatch_key_func(
|
||||
@@ -506,7 +493,53 @@ m.impl("${schema}", TORCH_FN(at::native::${kernel}));"""
|
||||
})
|
||||
|
||||
|
||||
def run(to_cpu: str, source_yaml: str, output_dir: str, dry_run: bool,
|
||||
def gen_target_registration(
|
||||
target_op_type: str,
|
||||
dispatch_key: DispatchKey,
|
||||
backend_indices: Dict[DispatchKey, BackendIndex],
|
||||
grouped_native_functions: Sequence[Union[NativeFunction, NativeFunctionsGroup]],
|
||||
op_plugin_yaml_path: str,
|
||||
fm: FileManager,
|
||||
selector: "SelectiveBuilder",
|
||||
native_functions: List[NativeFunction] = None,
|
||||
):
|
||||
target_ops = get_target_functions(op_plugin_yaml_path, target_op_type=target_op_type)
|
||||
target_native_functions = []
|
||||
for f in grouped_native_functions:
|
||||
if isinstance(f, NativeFunctionsGroup):
|
||||
for func in f.functions():
|
||||
if func.func in target_ops:
|
||||
target_native_functions.append(f)
|
||||
elif f.func in target_ops:
|
||||
target_native_functions.append(f)
|
||||
|
||||
metadata: Dict[OperatorName, BackendMetadata] = {}
|
||||
for op in target_ops:
|
||||
kernel_name = dispatcher.name(op)
|
||||
metadata[op.name] = BackendMetadata(kernel=kernel_name, structured=False, cpp_namespace=target_op_type)
|
||||
backend_indices[dispatch_key] = BackendIndex(
|
||||
dispatch_key=dispatch_key,
|
||||
use_out_as_primary=False,
|
||||
external=True,
|
||||
device_guard=False,
|
||||
index=metadata)
|
||||
|
||||
native_registration = get_target_native_registration(dispatch_key, backend_indices, metadata, native_functions)
|
||||
gen_dispatcher_registrations(
|
||||
fm,
|
||||
backend_indices[dispatch_key].native_function_class_name(),
|
||||
backend_indices,
|
||||
target_native_functions,
|
||||
dispatch_key,
|
||||
dispatch_key,
|
||||
selector,
|
||||
dispatch_key_name=dispatch_key.name,
|
||||
register_dispatch_key_func=dest.RegisterDispatchKey,
|
||||
native_function_registrations=native_registration,
|
||||
)
|
||||
|
||||
|
||||
def run(source_yaml: str, output_dir: str, dry_run: bool,
|
||||
impl_path: Optional[str], op_plugin_impl_path: Optional[str], op_plugin_yaml_path: Optional[str]) -> None:
|
||||
rename_privateuse1_dispatch_key()
|
||||
torchgen_path = get_torchgen_dir()
|
||||
@@ -522,7 +555,7 @@ def run(to_cpu: str, source_yaml: str, output_dir: str, dry_run: bool,
|
||||
tags_yaml_path = os.path.join(torchgen_path, 'packaged/ATen/native/tags.yaml')
|
||||
native_yaml_path = os.path.join(torchgen_path, 'packaged/ATen/native/native_functions.yaml')
|
||||
parsed_yaml = parse_native_and_custom_yaml(native_yaml_path, tags_yaml_path, source_yaml)
|
||||
parse_opplugin_yaml(op_plugin_yaml_path)
|
||||
get_target_functions(op_plugin_yaml_path)
|
||||
native_functions, backend_indices = parsed_yaml.native_functions, parsed_yaml.backend_indices
|
||||
grouped_native_functions = get_grouped_native_functions(native_functions)
|
||||
parsed_backend_yaml = parse_backend_yaml(source_yaml, grouped_native_functions, backend_indices)
|
||||
@@ -573,8 +606,8 @@ def run(to_cpu: str, source_yaml: str, output_dir: str, dry_run: bool,
|
||||
register_dispatch_key_func=dest.RegisterDispatchKey,
|
||||
)
|
||||
|
||||
template_dir = os.path.join(pathlib.Path(__file__).parent.absolute(), "templates")
|
||||
fm = FileManager(install_dir=output_dir, template_dir=template_dir, dry_run=dry_run)
|
||||
pta_template_dir = os.path.join(pathlib.Path(__file__).parent.absolute(), "templates")
|
||||
fm = FileManager(install_dir=output_dir, template_dir=pta_template_dir, dry_run=dry_run)
|
||||
custom_functions = parse_custom_yaml(source_yaml, tags_yaml_path).native_functions
|
||||
|
||||
gen_custom_trace(fm, custom_functions)
|
||||
@@ -587,9 +620,27 @@ def run(to_cpu: str, source_yaml: str, output_dir: str, dry_run: bool,
|
||||
backend_indices[backend_dispatch_key])
|
||||
|
||||
custom_ops_patch_dir = os.path.join(output_dir, "../../utils/")
|
||||
fm = FileManager(install_dir=custom_ops_patch_dir, template_dir=template_dir, dry_run=dry_run)
|
||||
fm = FileManager(install_dir=custom_ops_patch_dir, template_dir=pta_template_dir, dry_run=dry_run)
|
||||
gen_custom_ops_patch(fm, custom_functions)
|
||||
|
||||
filt_exposed_list = filt_exposed_api(source_yaml)
|
||||
exposed_path = pathlib.Path(__file__).parents[1].joinpath('torch_npu/utils/exposed_api.py')
|
||||
PathManager.remove_path_safety(exposed_path)
|
||||
with os.fdopen(os.open(exposed_path, os.O_RDWR | os.O_CREAT, stat.S_IWUSR | stat.S_IRUSR), 'w') as f:
|
||||
f.write(f'public_npu_functions = {filt_exposed_list}')
|
||||
os.chmod(exposed_path, stat.S_IRUSR | stat.S_IEXEC | stat.S_IRGRP | stat.S_IXGRP)
|
||||
fm = make_file_manager(output_dir)
|
||||
gen_target_registration(
|
||||
"sparse",
|
||||
DispatchKey.SparsePrivateUse1,
|
||||
backend_indices,
|
||||
grouped_native_functions,
|
||||
op_plugin_yaml_path,
|
||||
fm,
|
||||
selector,
|
||||
native_functions
|
||||
)
|
||||
|
||||
|
||||
def apply_torchgen_patch():
|
||||
dest.RegisterDispatchKey.gen_unstructured = gen_unstructured
|
||||
@@ -601,4 +652,4 @@ def apply_torchgen_patch():
|
||||
|
||||
if __name__ == '__main__':
|
||||
apply_torchgen_patch()
|
||||
main()
|
||||
main()
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include "torch_npu/csrc/aten/NPUNativeFunctions.h"
|
||||
#include "torch_npu/csrc/aten/VariableType.h"
|
||||
#include "torch_npu/csrc/core/npu/NPUException.h"
|
||||
#include "op_plugin/OpInterface.h"
|
||||
|
||||
namespace at_npu {
|
||||
|
||||
+120
-44
@@ -18,18 +18,23 @@ import sys
|
||||
import stat
|
||||
import traceback
|
||||
import warnings
|
||||
from typing import List, Optional, Set, Dict
|
||||
from typing import List, Optional, Set, Dict, Union, Sequence
|
||||
from collections import defaultdict
|
||||
import yaml
|
||||
|
||||
from torchgen.api.types.signatures import NativeSignature
|
||||
from torchgen.context import native_function_manager
|
||||
from torchgen.code_template import CodeTemplate
|
||||
from torchgen.model import (
|
||||
Arguments,
|
||||
BackendIndex,
|
||||
BackendMetadata,
|
||||
DispatchKey,
|
||||
is_cuda_dispatch_key,
|
||||
NativeFunction,
|
||||
NativeFunctionsGroup,
|
||||
FunctionSchema,
|
||||
OperatorName,
|
||||
)
|
||||
from torchgen.api import cpp
|
||||
from torchgen.api.translate import translate
|
||||
@@ -40,7 +45,7 @@ GLOBAL_STRUCTURED_OP_INFO_CACHE = defaultdict(str)
|
||||
GLOBAL_OPAPI_INFO_CACHE = set()
|
||||
|
||||
CUSTOM_YAML_NAME = "npu_native_functions_by_codegen.yaml"
|
||||
FIELDS_TO_REMOVE = ["wrap_impl", "impl_name", "impl_ns", "op_api"]
|
||||
FIELDS_TO_USE = ["func", "tags", "dispatch"]
|
||||
|
||||
|
||||
class PathManager:
|
||||
@@ -144,52 +149,22 @@ def merge_custom_yaml(pta_path, op_plugin_path):
|
||||
return merged_yaml
|
||||
|
||||
|
||||
def filed_tag(custom_es):
|
||||
for e in custom_es:
|
||||
if not isinstance(e, Dict):
|
||||
print(e)
|
||||
def field_tag(custom_es):
|
||||
for i, es in enumerate(custom_es):
|
||||
if not isinstance(es, dict):
|
||||
continue
|
||||
for field in FIELDS_TO_REMOVE:
|
||||
e.pop(field, None)
|
||||
custom_es[i] = {key: custom_es[i][key] for key in FIELDS_TO_USE if key in custom_es[i]}
|
||||
return custom_es
|
||||
|
||||
|
||||
def parse_opplugin_yaml(custom_path: str) -> Dict:
|
||||
|
||||
def filt_exposed_api(custom_path: str):
|
||||
source_es = parse_npu_yaml(custom_path)
|
||||
|
||||
custom = source_es.pop('custom', [])
|
||||
if custom is None:
|
||||
custom = [] # Allow an empty list of supported ops
|
||||
official = source_es.pop('official', [])
|
||||
if official is None:
|
||||
official = [] # Allow an empty list of supported ops
|
||||
|
||||
support_ops = custom + official
|
||||
|
||||
symint = source_es.pop("symint", [])
|
||||
if symint is None:
|
||||
symint = []
|
||||
symint = [op['func'] if isinstance(op, Dict) else op for op in symint]
|
||||
symint_set = set([str(FunctionSchema.parse(op).name) for op in symint])
|
||||
|
||||
global GLOBAL_STRUCTURED_OP_INFO_CACHE
|
||||
for x in support_ops:
|
||||
funcs = x.get("func", None)
|
||||
if not isinstance(funcs, str):
|
||||
raise TypeError(f'not a str : {funcs}')
|
||||
func = FunctionSchema.parse(funcs)
|
||||
wrap_name = cpp.name(func)
|
||||
op_key = str(func.name)
|
||||
if op_key in symint_set:
|
||||
wrap_name += "_symint"
|
||||
cur_wrap_name = GLOBAL_STRUCTURED_OP_INFO_CACHE.get(op_key, "")
|
||||
if cur_wrap_name and cur_wrap_name != wrap_name:
|
||||
print(f"Find different wrap_name for {cur_wrap_name} and {wrap_name} between pta and opplugin, ",
|
||||
f"with {wrap_name} being used as the actual wrap_name")
|
||||
GLOBAL_STRUCTURED_OP_INFO_CACHE[op_key] = wrap_name
|
||||
|
||||
return source_es
|
||||
custom_es = source_es.get('custom', []) + source_es.get('custom_autograd', [])
|
||||
exposed_set = set()
|
||||
for es in custom_es:
|
||||
if es.get('exposed', False):
|
||||
exposed_set.add(es.get('func').split('(')[0].split('.')[0])
|
||||
return list(exposed_set)
|
||||
|
||||
|
||||
def rename_privateuse1_dispatch_key():
|
||||
@@ -281,7 +256,7 @@ return {sig.name()}({', '.join(e.expr for e in translate(cpp_sig.arguments(), si
|
||||
return f"""
|
||||
{returns_type} {name}({args_str}) {{
|
||||
TORCH_CHECK_NOT_IMPLEMENTED({self_arg_name}.is_meta(),
|
||||
"Cannot inplace into non-meta tensor with meta tensor argument");
|
||||
"Cannot inplace into non-meta tensor with meta tensor argument", OPS_ERROR(ErrCode::NOT_SUPPORT));
|
||||
return {self_arg_name};
|
||||
}}
|
||||
"""
|
||||
@@ -490,3 +465,104 @@ def update_opapi_info(op_info):
|
||||
def is_opapi(op_key):
|
||||
global GLOBAL_OPAPI_INFO_CACHE
|
||||
return op_key in GLOBAL_OPAPI_INFO_CACHE
|
||||
|
||||
|
||||
def get_target_functions(yaml_path: str, target_op_type: str = None) -> List:
|
||||
source_es = parse_npu_yaml(yaml_path)
|
||||
|
||||
custom = source_es.pop('custom', [])
|
||||
if custom is None:
|
||||
custom = [] # Allow an empty list of supported ops
|
||||
official = source_es.pop('official', [])
|
||||
if official is None:
|
||||
official = [] # Allow an empty list of supported ops
|
||||
|
||||
support_ops = custom + official
|
||||
|
||||
symint = source_es.pop("symint", [])
|
||||
if symint is None:
|
||||
symint = []
|
||||
symint = [op['func'] if isinstance(op, Dict) else op for op in symint]
|
||||
symint_set = set([str(FunctionSchema.parse(op).name) for op in symint])
|
||||
|
||||
global GLOBAL_STRUCTURED_OP_INFO_CACHE
|
||||
GLOBAL_STRUCTURED_OP_INFO_CACHE.clear()
|
||||
target_funcs = []
|
||||
for op in support_ops:
|
||||
funcs = op.get("func", None)
|
||||
if not isinstance(funcs, str):
|
||||
raise TypeError(f'not a str : {funcs}')
|
||||
func = FunctionSchema.parse(funcs)
|
||||
wrap_name = cpp.name(func)
|
||||
op_key = str(func.name)
|
||||
if op_key in symint_set:
|
||||
wrap_name += "_symint"
|
||||
if target_op_type is not None:
|
||||
if target_op_type not in op.keys():
|
||||
continue
|
||||
wrap_name += "_" + target_op_type
|
||||
cur_wrap_name = GLOBAL_STRUCTURED_OP_INFO_CACHE.get(op_key, "")
|
||||
if cur_wrap_name and cur_wrap_name != wrap_name:
|
||||
print(f"Find different wrap_name for {cur_wrap_name} and {wrap_name} between pta and opplugin, ",
|
||||
f"with {wrap_name} being used as the actual wrap_name")
|
||||
GLOBAL_STRUCTURED_OP_INFO_CACHE[op_key] = wrap_name
|
||||
target_funcs.append(func)
|
||||
|
||||
return target_funcs
|
||||
|
||||
|
||||
def get_target_native_registration(
|
||||
dispatch_key: DispatchKey,
|
||||
backend_indices: Dict[DispatchKey, BackendIndex],
|
||||
metadata: Dict[OperatorName, BackendMetadata],
|
||||
native_functions: List[NativeFunction],
|
||||
):
|
||||
if native_functions is None:
|
||||
return ""
|
||||
cpu_dispatch_key = DispatchKey.parse(dispatch_key.name.replace("PrivateUse1", "CPU"))
|
||||
cpu_backend_indices = backend_indices[cpu_dispatch_key]
|
||||
cuda_dispatch_key = DispatchKey.parse(dispatch_key.name.replace("PrivateUse1", "CUDA"))
|
||||
cuda_backend_indices = backend_indices[cuda_dispatch_key]
|
||||
|
||||
target_native_functions_kernels = {}
|
||||
for op_name in cpu_backend_indices.index.keys():
|
||||
if cpu_backend_indices.index[op_name].kernel == cuda_backend_indices.index[op_name].kernel \
|
||||
and op_name not in metadata.keys():
|
||||
target_native_functions_kernels[op_name] = cpu_backend_indices.index[op_name].kernel
|
||||
target_native_functions = []
|
||||
for f in native_functions:
|
||||
if f.func.name in target_native_functions_kernels.keys():
|
||||
target_native_functions.append(f)
|
||||
|
||||
native_functions_registration_template = CodeTemplate(
|
||||
"""\
|
||||
namespace {
|
||||
|
||||
${dispatch_helpers}
|
||||
|
||||
TORCH_LIBRARY_IMPL(aten, ${dispatch_key}, m) {
|
||||
${native_kernels}
|
||||
}
|
||||
}
|
||||
""")
|
||||
|
||||
def wrap_native_function(f):
|
||||
kernel_name = target_native_functions_kernels[f.func.name]
|
||||
wrap_func_name = f"wrap_{dispatch_key}_{str(f.func.name.name)}_{f.func.name.overload_name}"
|
||||
with native_function_manager(f):
|
||||
sig = NativeSignature(f.func, prefix='', symint=kernel_name.endswith('symint'))
|
||||
args_exprs_str = ', '.join(a.name for a in sig.arguments())
|
||||
return f"""{sig.decl(name=wrap_func_name)} {{
|
||||
return at::native::{kernel_name}({args_exprs_str});
|
||||
}}
|
||||
"""
|
||||
|
||||
def register_wrap_native_function(f):
|
||||
wrap_func_name = f"wrap_{dispatch_key}_{str(f.func.name.name)}_{f.func.name.overload_name}"
|
||||
return f"m.impl(\"{f.func.name}\", TORCH_FN({wrap_func_name}));"
|
||||
|
||||
return native_functions_registration_template.substitute(
|
||||
dispatch_helpers=[wrap_native_function(f) for f in target_native_functions],
|
||||
dispatch_key=dispatch_key.name,
|
||||
native_kernels=[register_wrap_native_function(f) for f in target_native_functions]
|
||||
)
|
||||
|
||||
@@ -36,5 +36,6 @@ int main(int argc, const char* argv[]) {
|
||||
std::cout << output.slice(1, 0, 5) << std::endl;
|
||||
std::cout << "resnet_model run success!" << std::endl;
|
||||
|
||||
torch_npu::finalize_npu();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -36,3 +36,12 @@ ${python_execute} -m codegen.autograd.gen_autograd \
|
||||
--npu_native_function_dir="$source_yaml"
|
||||
|
||||
${python_execute} -m codegen.codegen_ops_info
|
||||
|
||||
if [ -f $CDIR/third_party/op-plugin/codegen/templates/_op_plugin_docs.py ]; then
|
||||
if [ -f $CDIR/torch_npu/_op_plugin_docs.py ]; then
|
||||
# remove _op_plugin_docs.py
|
||||
rm $CDIR/torch_npu/_op_plugin_docs.py
|
||||
echo "Existing _op_plugin_docs.py in torch_npu deleted."
|
||||
fi
|
||||
cp -f $CDIR/third_party/op-plugin/codegen/templates/_op_plugin_docs.py $CDIR/torch_npu/_op_plugin_docs.py
|
||||
fi
|
||||
|
||||
@@ -27,12 +27,14 @@ from wheel.bdist_wheel import bdist_wheel
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
THIRD_PARTY_PATH = os.path.join(BASE_DIR, "third_party")
|
||||
VERSION = '2.1.0'
|
||||
VERSION = '2.1.0.post5'
|
||||
UNKNOWN = "Unknown"
|
||||
DISABLE_TORCHAIR = "TRUE"
|
||||
BUILD_PERMISSION = stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_IRGRP | stat.S_IXGRP
|
||||
|
||||
DISABLE_TORCHAIR = "FALSE"
|
||||
if os.environ.get("DISABLE_INSTALL_TORCHAIR") is not None:
|
||||
DISABLE_TORCHAIR = os.environ.get("DISABLE_INSTALL_TORCHAIR")
|
||||
DISABLE_RPC = "TRUE"
|
||||
DISABLE_RPC = "FALSE"
|
||||
if os.environ.get("DISABLE_RPC_FRAMEWORK") is not None:
|
||||
DISABLE_RPC = os.environ.get("DISABLE_RPC_FRAMEWORK")
|
||||
|
||||
@@ -104,7 +106,7 @@ def generate_torch_npu_version():
|
||||
with os.fdopen(os.open(version_path, flags, modes), 'w') as f:
|
||||
f.write("__version__ = '{version}'\n".format(version=VERSION))
|
||||
f.write("git_version = {}\n".format(repr(sha)))
|
||||
os.chmod(version_path, stat.S_IRUSR | stat.S_IEXEC | stat.S_IRGRP | stat.S_IXGRP)
|
||||
os.chmod(version_path, mode=stat.S_IRUSR | stat.S_IEXEC | stat.S_IRGRP | stat.S_IXGRP)
|
||||
|
||||
|
||||
generate_torch_npu_version()
|
||||
@@ -206,6 +208,23 @@ def check_tensorpipe_valid(base_dir):
|
||||
return os.path.exists(tensorpipe_path)
|
||||
|
||||
|
||||
def generate_dbg_files_and_strip():
|
||||
library_dir = Path(BASE_DIR).joinpath("build/packages/torch_npu")
|
||||
dbg_dir = Path(BASE_DIR).joinpath("build/dbg")
|
||||
os.makedirs(dbg_dir, exist_ok=True)
|
||||
library_files = [Path(i) for i in library_dir.rglob('*.so')]
|
||||
for library_file in library_files:
|
||||
subprocess.check_call(["eu-strip", library_file, "-f",
|
||||
str(dbg_dir.joinpath(library_file.name)) + ".debug"], cwd=BASE_DIR) # Compliant
|
||||
|
||||
|
||||
def patchelf_dynamic_library():
|
||||
library_dir = Path(BASE_DIR).joinpath("build/packages/torch_npu/lib")
|
||||
library_files = [str(i) for i in library_dir.rglob('*.so')]
|
||||
for library_file in library_files:
|
||||
subprocess.check_call(["patchelf", "--remove-needed", "libgomp.so.1", library_file], cwd=BASE_DIR) # Compliant
|
||||
|
||||
|
||||
def CppExtension(name, sources, *args, **kwargs):
|
||||
r'''
|
||||
Creates a :class:`setuptools.Extension` for C++.
|
||||
@@ -289,6 +308,7 @@ class CPPLibBuild(build_clib, object):
|
||||
build_type_dir = os.path.join(build_dir)
|
||||
output_lib_path = os.path.join(build_type_dir, "packages/torch_npu/lib")
|
||||
os.makedirs(build_type_dir, exist_ok=True)
|
||||
os.chmod(build_type_dir, mode=BUILD_PERMISSION)
|
||||
os.makedirs(output_lib_path, exist_ok=True)
|
||||
self.build_lib = os.path.relpath(os.path.join(build_dir, "packages/torch_npu"))
|
||||
self.build_temp = os.path.relpath(build_type_dir)
|
||||
@@ -317,6 +337,14 @@ class CPPLibBuild(build_clib, object):
|
||||
build_args = ['-j', str(multiprocessing.cpu_count())]
|
||||
|
||||
subprocess.check_call([self.cmake, BASE_DIR] + cmake_args, cwd=build_type_dir, env=os.environ)
|
||||
for base_dir, dirs, files in os.walk(build_type_dir):
|
||||
for dir_name in dirs:
|
||||
dir_path = os.path.join(base_dir, dir_name)
|
||||
os.chmod(dir_path, mode=BUILD_PERMISSION)
|
||||
for file_name in files:
|
||||
file_path = os.path.join(base_dir, file_name)
|
||||
os.chmod(file_path, mode=BUILD_PERMISSION)
|
||||
|
||||
subprocess.check_call(['make'] + build_args, cwd=build_type_dir, env=os.environ)
|
||||
|
||||
|
||||
@@ -338,12 +366,22 @@ class InstallCmd(install):
|
||||
return super(InstallCmd, self).finalize_options()
|
||||
|
||||
|
||||
def add_ops_files(base_dir, file_list):
|
||||
# add ops header files
|
||||
plugin_path = os.path.join(base_dir, 'third_party/op-plugin/op_plugin/include')
|
||||
if os.path.exists(plugin_path):
|
||||
file_list.append('third_party/op-plugin/op_plugin/include/*.h')
|
||||
return
|
||||
|
||||
|
||||
def get_src_py_and_dst():
|
||||
ret = []
|
||||
generated_python_files = glob.glob(
|
||||
os.path.join(BASE_DIR, "torch_npu", '**/*.py'),
|
||||
recursive=True) + glob.glob(
|
||||
os.path.join(BASE_DIR, "torch_npu", '**/*.yaml'),
|
||||
recursive=True) + glob.glob(
|
||||
os.path.join(BASE_DIR, "torch_npu", 'acl.json'),
|
||||
recursive=True)
|
||||
for src in generated_python_files:
|
||||
dst = os.path.join(
|
||||
@@ -361,6 +399,7 @@ def get_src_py_and_dst():
|
||||
"third_party/acl/inc/*/*.h",
|
||||
"third_party/acl/inc/*/*/*.h"
|
||||
]
|
||||
add_ops_files(BASE_DIR, header_files)
|
||||
glob_header_files = []
|
||||
for regex_pattern in header_files:
|
||||
glob_header_files += glob.glob(os.path.join(BASE_DIR, regex_pattern), recursive=True)
|
||||
@@ -411,6 +450,12 @@ class PythonPackageBuild(build_py, object):
|
||||
|
||||
class BdistWheelBuild(bdist_wheel):
|
||||
def run(self):
|
||||
if which('patchelf') is not None:
|
||||
patchelf_dynamic_library()
|
||||
|
||||
if which('eu-strip') is not None:
|
||||
generate_dbg_files_and_strip()
|
||||
|
||||
torch_dependencies = ["libc10.so", "libtorch.so", "libtorch_cpu.so", "libtorch_python.so"]
|
||||
cann_dependencies = ["libhccl.so", "libascendcl.so", "libacl_op_compiler.so", "libge_runner.so",
|
||||
"libgraph.so", "libacl_tdt_channel.so", "libfmk_parser.so", "libascend_protobuf.so"]
|
||||
@@ -447,7 +492,8 @@ include_directories = [
|
||||
BASE_DIR,
|
||||
os.path.join(BASE_DIR, 'patch/include'),
|
||||
os.path.join(BASE_DIR, 'third_party/hccl/inc'),
|
||||
os.path.join(BASE_DIR, 'third_party/acl/inc')
|
||||
os.path.join(BASE_DIR, 'third_party/acl/inc'),
|
||||
os.path.join(BASE_DIR, 'third_party/profiler')
|
||||
]
|
||||
|
||||
extra_link_args = []
|
||||
@@ -472,7 +518,7 @@ if DEBUG:
|
||||
extra_link_args += ['-O0', '-g', '-Wl,-z,now']
|
||||
else:
|
||||
extra_compile_args += ['-DNDEBUG']
|
||||
extra_link_args += ['-Wl,-z,now,-s']
|
||||
extra_link_args += ['-Wl,-z,now']
|
||||
|
||||
# valid manylinux tags
|
||||
manylinux_tags = [
|
||||
@@ -523,6 +569,7 @@ classifiers = [
|
||||
"Programming Language :: Python :: 3.10",
|
||||
]
|
||||
|
||||
requirements = ['torch==2.1.0+cpu' if platform.machine() == 'x86_64' else 'torch==2.1.0']
|
||||
|
||||
setup(
|
||||
name=os.environ.get('TORCH_NPU_PACKAGE_NAME', 'torch_npu'),
|
||||
@@ -546,6 +593,7 @@ setup(
|
||||
extra_link_args=extra_link_args + ['-Wl,-rpath,$ORIGIN/lib'],
|
||||
),
|
||||
],
|
||||
install_requires=requirements,
|
||||
extras_require={
|
||||
},
|
||||
package_data={
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
import subprocess
|
||||
import ctypes
|
||||
import torch
|
||||
import torch.utils.cpp_extension
|
||||
|
||||
import torch_npu
|
||||
from torch_npu.testing.testcase import TestCase, run_tests
|
||||
|
||||
|
||||
PYTORCH_INSTALL_PATH = os.path.dirname(os.path.realpath(torch.__file__))
|
||||
PYTORCH_NPU_INSTALL_PATH = os.path.dirname(os.path.realpath(torch_npu.__file__))
|
||||
|
||||
|
||||
def create_build_path(build_directory):
|
||||
if os.path.exists(build_directory):
|
||||
shutil.rmtree(build_directory, ignore_errors=True)
|
||||
os.makedirs(build_directory, exist_ok=True)
|
||||
|
||||
|
||||
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:
|
||||
raise RuntimeError('Failed to build stub: {}'.format(build_stub_cmd))
|
||||
|
||||
|
||||
class TestPluggableAllocator(TestCase):
|
||||
module = None
|
||||
new_alloc = None
|
||||
build_directory = "allocator/build"
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
# Build Extension
|
||||
BASE_DIR = os.path.abspath("./../")
|
||||
build_stub(BASE_DIR)
|
||||
create_build_path(cls.build_directory)
|
||||
CANN_LIB_PATH = os.path.join(BASE_DIR, 'third_party/acl/libs')
|
||||
extra_ldflags = []
|
||||
extra_ldflags.append("-lascendcl")
|
||||
extra_ldflags.append(f"-L{CANN_LIB_PATH}")
|
||||
extra_ldflags.append("-lc10")
|
||||
extra_ldflags.append(f"-L{PYTORCH_INSTALL_PATH}")
|
||||
extra_include_paths = ["cpp_extensions"]
|
||||
extra_include_paths.append(os.path.join(PYTORCH_NPU_INSTALL_PATH, 'include'))
|
||||
|
||||
cls.module = torch.utils.cpp_extension.load(
|
||||
name="pluggable_allocator_extensions",
|
||||
sources=[
|
||||
"cpp_extensions/pluggable_allocator_extensions.cpp"
|
||||
],
|
||||
extra_include_paths=extra_include_paths,
|
||||
extra_cflags=["-g"],
|
||||
extra_ldflags=extra_ldflags,
|
||||
build_directory=cls.build_directory,
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
def test_pluggable_allocator(self):
|
||||
os_path = os.path.join(TestPluggableAllocator.build_directory, 'pluggable_allocator_extensions.so')
|
||||
# Load the allocator
|
||||
TestPluggableAllocator.new_alloc = torch_npu.npu.memory.NPUPluggableAllocator(os_path, 'my_malloc', 'my_free')
|
||||
# Swap the current allocator
|
||||
torch_npu.npu.memory.change_current_allocator(TestPluggableAllocator.new_alloc)
|
||||
# This will allocate memory in the device using the new allocator
|
||||
self.assertFalse(self.module.check_custom_allocator_used())
|
||||
npu_tensor = torch.zeros(10, device='npu')
|
||||
cpu_tensor = torch.zeros(10)
|
||||
self.assertRtolEqual(npu_tensor.cpu().numpy(), cpu_tensor.numpy())
|
||||
self.assertTrue(self.module.check_custom_allocator_used())
|
||||
|
||||
def test_set_get_device_stats_fn(self):
|
||||
os_path = os.path.join(TestPluggableAllocator.build_directory, 'pluggable_allocator_extensions.so')
|
||||
myallocator = ctypes.CDLL(os_path)
|
||||
get_device_stats_fn = ctypes.cast(getattr(myallocator, "my_get_device_stats"), ctypes.c_void_p).value
|
||||
|
||||
msg = "get_device_stats_fn_ is not define, please set by set_get_device_stats_fn"
|
||||
with self.assertRaisesRegex(RuntimeError, msg):
|
||||
torch.npu.memory_stats_as_nested_dict()
|
||||
|
||||
TestPluggableAllocator.new_alloc.allocator().set_get_device_stats_fn(get_device_stats_fn)
|
||||
self.assertEqual(torch.npu.memory_stats_as_nested_dict()["num_alloc_retries"], 0)
|
||||
|
||||
def test_set_reset_peak_status_fn(self):
|
||||
os_path = os.path.join(TestPluggableAllocator.build_directory, 'pluggable_allocator_extensions.so')
|
||||
myallocator = ctypes.CDLL(os_path)
|
||||
reset_peak_status_fn = ctypes.cast(getattr(myallocator, "my_reset_peak_status"), ctypes.c_void_p).value
|
||||
|
||||
msg = "reset_peak_status_fn_ is not define, please set by set_reset_peak_status_fn"
|
||||
with self.assertRaisesRegex(RuntimeError, msg):
|
||||
torch.npu.reset_peak_memory_stats()
|
||||
|
||||
TestPluggableAllocator.new_alloc.allocator().set_reset_peak_status_fn(reset_peak_status_fn)
|
||||
torch.npu.reset_peak_memory_stats()
|
||||
self.assertEqual(torch.npu.max_memory_allocated(), 0)
|
||||
|
||||
def test_set_snapshot_fn(self):
|
||||
os_path = os.path.join(TestPluggableAllocator.build_directory, 'pluggable_allocator_extensions.so')
|
||||
myallocator = ctypes.CDLL(os_path)
|
||||
snapshot_fn = ctypes.cast(getattr(myallocator, "my_snapshot"), ctypes.c_void_p).value
|
||||
|
||||
msg = "snapshot_fn_ is not define, please set by set_snapshot_fn"
|
||||
with self.assertRaisesRegex(RuntimeError, msg):
|
||||
torch.npu.memory_snapshot()
|
||||
|
||||
TestPluggableAllocator.new_alloc.allocator().set_snapshot_fn(snapshot_fn)
|
||||
self.assertEqual(torch.npu.memory_snapshot(), [])
|
||||
|
||||
def test_pluggable_allocator_after_init(self):
|
||||
os_path = os.path.join(TestPluggableAllocator.build_directory, 'pluggable_allocator_extensions.so')
|
||||
# Do an initial memory allocator
|
||||
ori_tensor = torch.zeros(10, device='npu')
|
||||
# Load the allocator
|
||||
new_alloc = torch_npu.npu.memory.NPUPluggableAllocator(os_path, 'my_malloc', 'my_free')
|
||||
msg = "Can't swap an already initialized allocator"
|
||||
with self.assertRaisesRegex(RuntimeError, msg):
|
||||
torch_npu.npu.memory.change_current_allocator(new_alloc)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_tests()
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,106 @@
|
||||
# Owner(s): ["module: autograd"]
|
||||
|
||||
import torch
|
||||
import torch_npu
|
||||
import torch_npu.testing
|
||||
from torch.testing._internal.common_utils import TestCase, run_tests, gradcheck
|
||||
|
||||
|
||||
class TestAutogradComplex(TestCase):
|
||||
def test_view_func_for_complex_views(self):
|
||||
# case 1: both parent and child have view_func
|
||||
x = torch.randn(2, 2, 2, dtype=torch.double, requires_grad=True)
|
||||
y = x.detach().requires_grad_(True)
|
||||
|
||||
x0 = x.clone()
|
||||
x1 = torch.view_as_complex(x0)
|
||||
x2 = torch.view_as_real(x1)
|
||||
x2.mul_(2)
|
||||
x2.sum().abs().backward()
|
||||
|
||||
y0 = y.clone()
|
||||
y0.mul_(2)
|
||||
y0.sum().abs().backward()
|
||||
|
||||
self.assertEqual(x.grad, y.grad)
|
||||
|
||||
# case 2: parent has view_func but child does not
|
||||
x = torch.randn(2, 2, 2, dtype=torch.double, requires_grad=True)
|
||||
y = x.detach().requires_grad_(True)
|
||||
|
||||
def fn(a):
|
||||
b = a.clone()
|
||||
b1 = torch.view_as_complex(b)
|
||||
b2 = b1.reshape(b1.numel())
|
||||
return b2
|
||||
|
||||
x0 = fn(x)
|
||||
x0.mul_(2)
|
||||
x0.sum().abs().backward()
|
||||
|
||||
y0 = fn(y)
|
||||
y1 = y0.mul(2)
|
||||
y1.sum().abs().backward()
|
||||
|
||||
self.assertEqual(x.grad, y.grad)
|
||||
|
||||
# case 3: parent does not have a view_func but child does
|
||||
x = torch.randn(10, dtype=torch.cdouble, requires_grad=True)
|
||||
y = x.detach().requires_grad_(True)
|
||||
|
||||
def fn(a, dim0_size=5):
|
||||
b = a.clone()
|
||||
b1 = b.reshape(dim0_size, 2)
|
||||
b2 = torch.view_as_real(b1)
|
||||
return b2
|
||||
|
||||
x0 = fn(x)
|
||||
x0.mul_(2)
|
||||
x0.sum().abs().backward()
|
||||
|
||||
y0 = fn(y)
|
||||
y1 = y0.mul(2)
|
||||
y1.sum().abs().backward()
|
||||
|
||||
self.assertEqual(x.grad, y.grad)
|
||||
|
||||
def test_view_with_multi_output(self):
|
||||
x = torch.randn(2, 2, 2, dtype=torch.double)
|
||||
|
||||
x1 = torch.view_as_complex(x)
|
||||
# Taking an invalid view should always be allowed as long as it is not
|
||||
# modified inplace
|
||||
res = x1.unbind(0)
|
||||
|
||||
with self.assertRaisesRegex(RuntimeError, "output of a function that returns multiple views"):
|
||||
res[0] += torch.rand(2, requires_grad=True)
|
||||
|
||||
x.requires_grad_(True)
|
||||
x1 = torch.view_as_complex(x)
|
||||
# Taking an invalid view should always be allowed as long as it is not
|
||||
# modified inplace
|
||||
res = x1.unbind(0)
|
||||
|
||||
with self.assertRaisesRegex(RuntimeError, "output of a function that returns multiple views"):
|
||||
res[0] += torch.rand(2, requires_grad=True)
|
||||
|
||||
def as_identity(self):
|
||||
# view_as_real and view_as_complex behavior should be like an identity
|
||||
def func(z):
|
||||
z_ = torch.view_as_complex(z)
|
||||
z_select = torch.select(z_, z_.dim() - 1, 0)
|
||||
z_select_real = torch.view_as_real(z_select)
|
||||
return z_select_real.sum()
|
||||
|
||||
z = torch.randn(10, 2, 2, dtype=torch.double, requires_grad=True)
|
||||
gradcheck(func, [z])
|
||||
func(z).backward()
|
||||
|
||||
z1 = z.clone().detach().requires_grad_(True)
|
||||
torch.select(z1, z1.dim() - 2, 0).sum().backward()
|
||||
|
||||
self.assertEqual(z.grad, z1.grad)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
run_tests()
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
# Owner(s): ["module: unknown"]
|
||||
|
||||
import argparse
|
||||
import torch
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
# Required args.
|
||||
parser.add_argument('--foo', help='foo', required=True)
|
||||
parser.add_argument('--bar', help='bar', required=True)
|
||||
_ = parser.parse_args()
|
||||
|
||||
x = torch.ones((3, 3), requires_grad=True)
|
||||
(3 * x).sum().backward()
|
||||
@@ -0,0 +1,6 @@
|
||||
# Owner(s): ["module: unknown"]
|
||||
|
||||
import torch
|
||||
|
||||
x = torch.ones((3, 3), requires_grad=True)
|
||||
(3 * x).sum().backward()
|
||||
@@ -0,0 +1,30 @@
|
||||
# Owner(s): ["module: unknown"]
|
||||
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
import torch_npu
|
||||
|
||||
|
||||
class Model(nn.Module):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.linear = nn.Linear(20, 20)
|
||||
|
||||
def forward(self, input_):
|
||||
out = self.linear(input_[:, 10:30])
|
||||
return out.sum()
|
||||
|
||||
|
||||
def main():
|
||||
data = torch.randn(10, 50).npu()
|
||||
model = Model().npu()
|
||||
optimizer = torch.optim.SGD(model.parameters(), lr=0.0001)
|
||||
for i in range(10):
|
||||
optimizer.zero_grad()
|
||||
loss = model(data)
|
||||
loss.backward()
|
||||
optimizer.step()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -1,3 +1,4 @@
|
||||
import unittest
|
||||
import numpy as np
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
@@ -18,18 +19,16 @@ class TestActivations(TestCase):
|
||||
"""
|
||||
input1.requires_grad = True
|
||||
res = input1 * torch.tanh(F.softplus(input1))
|
||||
output = res.sum()
|
||||
output.backward()
|
||||
res.backward(torch.ones_like(res))
|
||||
return res.detach(), input1.grad
|
||||
|
||||
def npu_mish(self, input1):
|
||||
input1.requires_grad = True
|
||||
model = Mish()
|
||||
res = model(input1)
|
||||
output = res.sum()
|
||||
output.backward()
|
||||
res.backward(torch.ones_like(res))
|
||||
return res.detach().cpu(), input1.grad.cpu()
|
||||
|
||||
|
||||
def test_mish(self):
|
||||
dtype_list = [np.float16, np.float32]
|
||||
format_list = [-1, 0, 2]
|
||||
@@ -0,0 +1,71 @@
|
||||
import unittest
|
||||
import numpy as np
|
||||
import torch
|
||||
import torch_npu
|
||||
from torch_npu.testing.testcase import TestCase, run_tests
|
||||
from torch_npu.contrib.function import npu_bbox_coder_encode_yolo, \
|
||||
npu_bbox_coder_encode_xyxy2xywh, npu_bbox_coder_decode_xywh2xyxy
|
||||
|
||||
|
||||
class TestBboxCoder(TestCase):
|
||||
def test_npu_bbox_coder_encode_xyxy2xywh(self):
|
||||
np.random.seed(123)
|
||||
data1 = np.random.randint(low=0, high=512, size=(6, 4))
|
||||
bboxes = torch.tensor(data1, dtype=torch.int64)
|
||||
data2 = np.random.randint(low=0, high=512, size=(6, 4))
|
||||
gt_bboxes = torch.tensor(data2, dtype=torch.int64)
|
||||
bboxes = bboxes.npu()
|
||||
gt_bboxes = gt_bboxes.npu()
|
||||
npuout_1 = npu_bbox_coder_encode_xyxy2xywh(bboxes, gt_bboxes)
|
||||
npuout_2 = npu_bbox_coder_encode_xyxy2xywh(bboxes / 512., gt_bboxes / 512.,
|
||||
is_normalized=True, normalized_scale=512.)
|
||||
expect_cpu = torch.tensor([[1.1807, -0.7979, -0.4014, 0.7285],
|
||||
[1.1064, -2.4883, -2.2051, 0.2026],
|
||||
[1.3047, -6.5430, 2.0156, 0.8291],
|
||||
[0.7993, -0.1396, -0.9336, 0.9038],
|
||||
[-4.6250, -17.8906, 1.8389, 3.0938],
|
||||
[-0.3145, -0.5000, -2.7676, 0.2954]], dtype=torch.float32)
|
||||
self.assertRtolEqual(expect_cpu.numpy(), npuout_1.cpu().numpy())
|
||||
self.assertRtolEqual(expect_cpu.numpy(), npuout_2.cpu().numpy())
|
||||
|
||||
def test_npu_bbox_coder_encode_yolo(self):
|
||||
np.random.seed(234)
|
||||
data1 = np.random.randint(low=0, high=512, size=(6, 4))
|
||||
bboxes = torch.tensor(data1, dtype=torch.int64)
|
||||
data2 = np.random.randint(low=0, high=512, size=(6, 4))
|
||||
gt_bboxes = torch.tensor(data2, dtype=torch.int64)
|
||||
stride = torch.randint(0, 32, size=(6,))
|
||||
bboxes = bboxes.npu()
|
||||
gt_bboxes = gt_bboxes.npu()
|
||||
stride = stride.npu()
|
||||
npu_output = npu_bbox_coder_encode_yolo(bboxes, gt_bboxes, stride)
|
||||
expect_cpu = torch.tensor([[1.0000e-06, 1.0000e-06, -1.1692e+00, -8.7373e-01],
|
||||
[1.0000e+00, 1.0000e-06, -1.3816e+01, -1.3816e+01],
|
||||
[1.0000e-06, 1.0000e-06, 7.8846e-01, -6.0799e-01],
|
||||
[8.5000e-01, 1.0000e-06, -1.3816e+01, -2.2460e+00],
|
||||
[1.0000e+00, 6.5000e-01, -1.3312e+00, -1.3816e+01],
|
||||
[1.0000e+00, 1.0000e-06, 4.1058e-01, 2.4875e+00]], dtype=torch.float32)
|
||||
self.assertRtolEqual(expect_cpu.numpy(), npu_output.cpu().numpy())
|
||||
|
||||
def test_npu_bbox_coder_decode_xywh2xyxy(self):
|
||||
max_shape = 512
|
||||
np.random.seed(345)
|
||||
data1 = np.random.randint(low=0, high=max_shape, size=(6, 4))
|
||||
bboxes = torch.tensor(data1, dtype=torch.int64)
|
||||
data2 = np.random.randn(6, 4)
|
||||
pred_bboxes = torch.tensor(data2, dtype=torch.float32)
|
||||
bboxes = bboxes.npu()
|
||||
pred_bboxes = pred_bboxes.npu()
|
||||
npu_output = npu_bbox_coder_decode_xywh2xyxy(bboxes, pred_bboxes,
|
||||
max_shape=(max_shape, max_shape))
|
||||
expect_cpu = torch.tensor([[69.6262, 511.0000, 116.1755, 274.9286],
|
||||
[50.0117, 511.0000, 28.3380, 456.6909],
|
||||
[354.6850, 227.5013, 275.1128, 219.0241],
|
||||
[0.0000, 301.9681, 0.0000, 291.4622],
|
||||
[201.7177, 84.3664, 325.5544, 87.1693],
|
||||
[283.7152, 407.1944, 0.0000, 511.0000]], dtype=torch.float32)
|
||||
self.assertRtolEqual(expect_cpu.numpy(), npu_output.cpu().numpy())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_tests()
|
||||
@@ -0,0 +1,47 @@
|
||||
import unittest
|
||||
import numpy as np
|
||||
import torch
|
||||
import torch_npu
|
||||
|
||||
from torch_npu.testing.testcase import TestCase, run_tests
|
||||
from torch_npu.testing.common_utils import create_common_tensor
|
||||
from torch_npu.contrib.module import BiLSTM
|
||||
|
||||
|
||||
class TestBidirectionalLstm(TestCase):
|
||||
|
||||
def npu_bidirectional_lstm(self, input1):
|
||||
input1 = input1.npu()
|
||||
input1.requires_grad = True
|
||||
rnn = BiLSTM(8, 4).npu()
|
||||
input1.retain_grad()
|
||||
output = rnn(input1)
|
||||
output.backward(torch.ones(input1.size(), dtype=torch.float).npu())
|
||||
input_grad = input1.grad.cpu()
|
||||
return output.detach().cpu(), input_grad.cpu()
|
||||
|
||||
def test_bidirectional_lstm(self):
|
||||
np.random.seed(123)
|
||||
data1 = np.random.randn(2, 2, 8)
|
||||
cpu_input = torch.tensor(data1, dtype=torch.float32)
|
||||
npu_input = cpu_input.npu()
|
||||
|
||||
npu_output, npu_inputgrad = self.npu_bidirectional_lstm(npu_input)
|
||||
expect_cpu_output = torch.tensor([[[0.1078, 0.0723, 0.0158, 0.1555, -0.0975, 0.0867, -0.1653, -0.0974],
|
||||
[0.1635, 0.3083, -0.2793, 0.0748, -0.1528, 0.1982, -0.0063, 0.1506]],
|
||||
|
||||
[[0.0743, 0.1489, -0.0777, 0.0052, -0.2747, 0.0872, -0.1923, -0.2612],
|
||||
[-0.1760, 0.2629, -0.2959, 0.0299, 0.3979, 0.1146, -0.1663, 0.0682]]],
|
||||
dtype=torch.float32)
|
||||
expect_cpu_inputgrad = torch.tensor([[[0.5643, -0.2415, -0.7003, -0.1445, 0.3078, 0.0442, -0.5876, -0.3430],
|
||||
[-0.1395, 0.2832, -0.3813, 0.0043, 0.0973, 0.0093, -0.2702, -0.0069]],
|
||||
|
||||
[[-0.0751, -0.0903, -0.4377, -0.2069, 0.0934, -0.1738, -0.1134, -0.0765],
|
||||
[0.3855, -0.1033, -0.2906, -0.2387, -0.0037, 0.0606, -0.2736, -0.1440]]],
|
||||
dtype=torch.float32)
|
||||
self.assertRtolEqual(expect_cpu_output, npu_output)
|
||||
self.assertRtolEqual(expect_cpu_inputgrad, npu_inputgrad)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_tests()
|
||||
@@ -0,0 +1,55 @@
|
||||
import unittest
|
||||
import numpy as np
|
||||
import torch
|
||||
import torch_npu
|
||||
|
||||
from torch_npu.testing.testcase import TestCase, run_tests
|
||||
from torch_npu.testing.common_utils import create_common_tensor
|
||||
from torch_npu.contrib.module import LabelSmoothingCrossEntropy
|
||||
|
||||
|
||||
class TestCrossentropy(TestCase):
|
||||
def test_npu_crossentropy_1(self):
|
||||
np.random.seed(123)
|
||||
data1 = np.random.randn(2, 10)
|
||||
x = torch.tensor(data1, dtype=torch.float32)
|
||||
data2 = np.random.randint(low=0, high=10, size=(2,))
|
||||
y = torch.tensor(data2, dtype=torch.float32)
|
||||
|
||||
x = x.npu()
|
||||
y = y.npu()
|
||||
x.requires_grad = True
|
||||
m = LabelSmoothingCrossEntropy(10)
|
||||
npu_output = m(x, y)
|
||||
npu_output.backward()
|
||||
expect_cpu_xgrad = torch.tensor([[0.0112, 0.0899, 0.0440, 0.0074, 0.0186, 0.1729, 0.0029, 0.0216,
|
||||
0.1176, -0.4861],
|
||||
[0.0085, 0.0152, 0.0744, -0.4912, 0.0107, 0.0108, 0.1520, 0.1491,
|
||||
0.0457, 0.0246]], dtype=torch.float32)
|
||||
self.assertRtolEqual(torch.tensor(3.8078), npu_output.detach().cpu())
|
||||
self.assertRtolEqual(expect_cpu_xgrad, x.grad.cpu())
|
||||
|
||||
def test_npu_crossentropy_2(self):
|
||||
np.random.seed(234)
|
||||
data1 = np.random.randn(2, 10)
|
||||
x = torch.tensor(data1, dtype=torch.float32)
|
||||
data2 = np.random.randint(low=0, high=10, size=(2,))
|
||||
y = torch.tensor(data2, dtype=torch.float32)
|
||||
|
||||
x = x.npu()
|
||||
y = y.npu()
|
||||
x.requires_grad = True
|
||||
m = LabelSmoothingCrossEntropy(10, 0.1)
|
||||
npu_output = m(x, y)
|
||||
npu_output.backward()
|
||||
expect_cpu_xgrad = torch.tensor([[6.6930e-02, 5.7021e-03, 3.9844e-02, 7.4777e-02, 2.3734e-02,
|
||||
-4.1566e-03, 6.5645e-03, 7.5835e-02, -4.1660e-01, 1.2737e-01],
|
||||
[1.4708e-02, 8.3806e-02, 4.2438e-03, 1.0031e-01, -4.3430e-04,
|
||||
5.1546e-02, 1.3015e-01, 2.4124e-02, 2.7007e-02, -4.3545e-01]],
|
||||
dtype=torch.float32)
|
||||
self.assertRtolEqual(torch.tensor(3.0848), npu_output.cpu())
|
||||
self.assertRtolEqual(expect_cpu_xgrad, x.grad.cpu())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_tests()
|
||||
@@ -0,0 +1,108 @@
|
||||
import unittest
|
||||
import numpy as np
|
||||
import torch
|
||||
import torch_npu
|
||||
|
||||
from torch_npu.testing.testcase import TestCase, run_tests
|
||||
from torch_npu.testing.common_utils import create_common_tensor
|
||||
from torch_npu.contrib.module import DCNv2
|
||||
|
||||
|
||||
class TestDeformConv(TestCase):
|
||||
def test_npu_deform_conv_1(self):
|
||||
np.random.seed(226)
|
||||
data1 = np.random.randn(2, 2, 3, 3)
|
||||
x = torch.tensor(data1, dtype=torch.float32)
|
||||
model = DCNv2(2, 2, 3, 2, 1)
|
||||
|
||||
x = x.npu()
|
||||
x.requires_grad = True
|
||||
model = model.npu()
|
||||
|
||||
output = model(x)
|
||||
output.sum().backward()
|
||||
expect_cpu_output = torch.tensor([[[[0.0077, 0.0699],
|
||||
[0.1435, -0.0298]],
|
||||
|
||||
[[0.0494, -0.1641],
|
||||
[-0.4070, -0.0126]]],
|
||||
|
||||
[[[0.2375, -0.3983],
|
||||
[-0.3438, 0.2228]],
|
||||
|
||||
[[-0.0948, -0.1294],
|
||||
[-0.1455, -0.1956]]]], dtype=torch.float32)
|
||||
expect_cpu_xgrad = torch.tensor([[[[0.0355, 0.1740, 0.0355],
|
||||
[0.1678, 0.0109, 0.1678],
|
||||
[0.0355, 0.1740, 0.0355]],
|
||||
|
||||
[[-0.1422, -0.2028, -0.1422],
|
||||
[-0.0641, 0.2660, -0.0641],
|
||||
[-0.1422, -0.2028, -0.1422]]],
|
||||
|
||||
[[[0.0355, 0.1740, 0.0355],
|
||||
[0.1678, 0.0109, 0.1678],
|
||||
[0.0355, 0.1740, 0.0355]],
|
||||
|
||||
[[-0.1422, -0.2028, -0.1422],
|
||||
[-0.0641, 0.2660, -0.0641],
|
||||
[-0.1422, -0.2028, -0.1422]]]], dtype=torch.float32)
|
||||
self.assertRtolEqual(expect_cpu_output, output.detach().cpu())
|
||||
self.assertRtolEqual(expect_cpu_xgrad, x.grad.cpu())
|
||||
|
||||
def test_npu_deform_conv_2(self):
|
||||
np.random.seed(546)
|
||||
data1 = np.random.randn(2, 2, 5, 5)
|
||||
x = torch.tensor(data1, dtype=torch.float32)
|
||||
model = DCNv2(2, 2, 3, 2, 1)
|
||||
|
||||
x = x.npu()
|
||||
x.requires_grad = True
|
||||
model = model.npu()
|
||||
|
||||
output = model(x)
|
||||
output.sum().backward()
|
||||
expect_cpu_output = torch.tensor([[[[-0.1421, -0.0099, -0.2894],
|
||||
[-0.0360, -0.4846, 0.2676],
|
||||
[-0.2791, 0.0011, -0.0440]],
|
||||
|
||||
[[0.0051, -0.1212, 0.0374],
|
||||
[-0.0317, 0.0370, -0.0739],
|
||||
[0.1564, 0.0738, -0.2175]]],
|
||||
|
||||
[[[-0.3272, -0.0703, 0.1305],
|
||||
[-0.0163, 0.1823, -0.0286],
|
||||
[-0.5419, 0.1746, 0.1011]],
|
||||
|
||||
[[-0.0256, 0.6328, 0.0427],
|
||||
[-0.4237, 0.0432, 0.2582],
|
||||
[0.3830, -0.0413, -0.0663]]]], dtype=torch.float32)
|
||||
expect_cpu_xgrad = torch.tensor([[[[0.0355, 0.1740, 0.0355, 0.1740, 0.0355],
|
||||
[0.1678, 0.0109, 0.1678, 0.0109, 0.1678],
|
||||
[0.0355, 0.1740, 0.0355, 0.1740, 0.0355],
|
||||
[0.1678, 0.0109, 0.1678, 0.0109, 0.1678],
|
||||
[0.0355, 0.1740, 0.0355, 0.1740, 0.0355]],
|
||||
|
||||
[[-0.1422, -0.2028, -0.1422, -0.2028, -0.1422],
|
||||
[-0.0641, 0.2660, -0.0641, 0.2660, -0.0641],
|
||||
[-0.1422, -0.2028, -0.1422, -0.2028, -0.1422],
|
||||
[-0.0641, 0.2660, -0.0641, 0.2660, -0.0641],
|
||||
[-0.1422, -0.2028, -0.1422, -0.2028, -0.1422]]],
|
||||
|
||||
[[[0.0355, 0.1740, 0.0355, 0.1740, 0.0355],
|
||||
[0.1678, 0.0109, 0.1678, 0.0109, 0.1678],
|
||||
[0.0355, 0.1740, 0.0355, 0.1740, 0.0355],
|
||||
[0.1678, 0.0109, 0.1678, 0.0109, 0.1678],
|
||||
[0.0355, 0.1740, 0.0355, 0.1740, 0.0355]],
|
||||
|
||||
[[-0.1422, -0.2028, -0.1422, -0.2028, -0.1422],
|
||||
[-0.0641, 0.2660, -0.0641, 0.2660, -0.0641],
|
||||
[-0.1422, -0.2028, -0.1422, -0.2028, -0.1422],
|
||||
[-0.0641, 0.2660, -0.0641, 0.2660, -0.0641],
|
||||
[-0.1422, -0.2028, -0.1422, -0.2028, -0.1422]]]], dtype=torch.float32)
|
||||
self.assertRtolEqual(expect_cpu_output, output.detach().cpu())
|
||||
self.assertRtolEqual(expect_cpu_xgrad, x.grad.cpu())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_tests()
|
||||
@@ -0,0 +1,18 @@
|
||||
from PIL import Image
|
||||
import numpy as np
|
||||
|
||||
import torch
|
||||
import torch_npu
|
||||
from torch_npu.testing.testcase import TestCase, run_tests
|
||||
from torch_npu.contrib.module import FusedColorJitter
|
||||
|
||||
|
||||
class TestFusedColorJitter(TestCase):
|
||||
def test_fusedcolorjitter(self):
|
||||
image = Image.fromarray(torch.randint(0, 256, size=(224, 224, 3)).numpy().astype(np.uint8))
|
||||
fcj = FusedColorJitter(0.1, 0.1, 0.1, 0.1)
|
||||
output = fcj(image)
|
||||
self.assertEqual(output is not None, True)
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_tests()
|
||||
@@ -14,8 +14,8 @@ class TestIou(TestCase):
|
||||
box2 = box2.float().npu()
|
||||
iou1 = npu_iou(box1, box2, mode="iou")
|
||||
iou2 = npu_iou(box1, box2)
|
||||
expedt_iou1 = torch.tensor([[0.5469, 0.2373]], dtype=torch.float32)
|
||||
expedt_iou2 = torch.tensor([[0.5469, 0.2373]], dtype=torch.float32)
|
||||
expedt_iou1 = torch.tensor([[0.5474, 0.2373]], dtype=torch.float32)
|
||||
expedt_iou2 = torch.tensor([[0.5474, 0.2373]], dtype=torch.float32)
|
||||
self.assertRtolEqual(expedt_iou1, iou1.cpu())
|
||||
self.assertRtolEqual(expedt_iou2, iou2.cpu())
|
||||
|
||||
@@ -41,8 +41,8 @@ class TestIou(TestCase):
|
||||
box2 = box2.float().npu() / 100.
|
||||
iou1 = npu_iou(box1, box2, mode="iou", is_normalized=True, normalized_scale=100.)
|
||||
iou2 = npu_iou(box1, box2, is_normalized=True, normalized_scale=100.)
|
||||
expedt_iou1 = torch.tensor([[0.5469, 0.2373]], dtype=torch.float32)
|
||||
expedt_iou2 = torch.tensor([[0.5469, 0.2373]], dtype=torch.float32)
|
||||
expedt_iou1 = torch.tensor([[0.5474, 0.2373]], dtype=torch.float32)
|
||||
expedt_iou2 = torch.tensor([[0.5474, 0.2373]], dtype=torch.float32)
|
||||
self.assertRtolEqual(expedt_iou1, iou1.cpu())
|
||||
self.assertRtolEqual(expedt_iou2, iou2.cpu())
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import unittest
|
||||
import torch
|
||||
import torch_npu
|
||||
from torch_npu.testing.testcase import TestCase, run_tests
|
||||
from torch_npu.contrib.module import LinearA8W8Quant
|
||||
|
||||
DEVICE_NAME = torch_npu.npu.get_device_name(0)[:10]
|
||||
|
||||
|
||||
class TestLinearA8W8Quant(TestCase):
|
||||
|
||||
def npu_linear_quant(self, in_features, out_features, x1, x2, scale):
|
||||
model = LinearA8W8Quant(in_features, out_features, bias=False, pertoken_scale=False, offset=False)
|
||||
model = model.npu()
|
||||
model.weight.data = x2
|
||||
model.scale.data = scale
|
||||
output = model(x1)
|
||||
return output
|
||||
|
||||
@unittest.skipIf(DEVICE_NAME == 'Ascend910A' or DEVICE_NAME == 'Ascend310P',
|
||||
"OP `QuantBatchMatmulV3` is not only supported on 910A and 310P, skip this ut for this device type!")
|
||||
def test_npu_linear_quant(self):
|
||||
x1 = torch.randint(-1, 1, (1, 5), dtype=torch.int8).npu()
|
||||
x2 = torch.randint(-1, 1, (127, 5), dtype=torch.int8).npu()
|
||||
scale = torch.randn(1, dtype=torch.float32).npu()
|
||||
supported_output = torch_npu.npu_quant_matmul(x1, x2.t(), scale)
|
||||
in_features = 5
|
||||
out_features = 127
|
||||
npu_out = self.npu_linear_quant(in_features, out_features, x1, x2, scale)
|
||||
self.assertRtolEqual(supported_output, npu_out, 0.001)
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_tests()
|
||||
@@ -0,0 +1,71 @@
|
||||
import unittest
|
||||
import numpy as np
|
||||
import torch
|
||||
import torch_npu
|
||||
|
||||
from torch_npu.testing.testcase import TestCase, run_tests
|
||||
from torch_npu.contrib.module import LinearWeightQuant
|
||||
|
||||
DEVICE_NAME = torch_npu.npu.get_device_name(0)[:10]
|
||||
|
||||
|
||||
def f32_2_s9(array):
|
||||
array_round = np.round(array)
|
||||
array_round_clip = np.clip(array_round, -256, 255)
|
||||
return array_round_clip
|
||||
|
||||
|
||||
class TestLinearWeightQuant(TestCase):
|
||||
def cpu_linear_weight_quant(self, weight_cpu, x_cpu, antiquant_scale_cpu, antiquant_offset_cpu):
|
||||
x_cpu = x_cpu.to(torch.float32)
|
||||
antiquant_weight = (weight_cpu + antiquant_offset_cpu) * antiquant_scale_cpu
|
||||
antiquant_weight = antiquant_weight.to(torch.float32)
|
||||
cpu_out = torch.matmul(x_cpu, antiquant_weight).numpy()
|
||||
cpu_out = cpu_out.astype("float16")
|
||||
return cpu_out
|
||||
|
||||
def npu_linear_weight_quant(self, in_features, out_features, antiquant_scale, weight, x, antiquant_offset=None):
|
||||
model = LinearWeightQuant(in_features,
|
||||
out_features,
|
||||
bias=False,
|
||||
device=torch.device(f'npu:0'),
|
||||
dtype=x.dtype,
|
||||
antiquant_offset=True,
|
||||
quant_scale=False,
|
||||
quant_offset=False,
|
||||
antiquant_group_size=0
|
||||
)
|
||||
model = model.npu()
|
||||
model.weight.data = weight
|
||||
model.antiquant_scale.data = antiquant_scale
|
||||
model.antiquant_offset.data = antiquant_offset
|
||||
npu_out = model(x)
|
||||
|
||||
return npu_out
|
||||
|
||||
@unittest.skipIf(DEVICE_NAME != 'Ascend910B',
|
||||
"OP `WeightQuantBatchMatmulV2` is only supported on 910B, skip this ut for this device type!")
|
||||
def test_npu_linear_weight_quant(self):
|
||||
m = 1024
|
||||
k = 11264
|
||||
n = 1664
|
||||
x_cpu = torch.randn((m, k), dtype=torch.float16)
|
||||
weight_cpu = torch.randn((n, k), dtype=torch.float16)
|
||||
weight_cpu = weight_cpu.to(torch.int8)
|
||||
weight_cpu = weight_cpu.to(torch.float16)
|
||||
weight_cpu_trans = weight_cpu.transpose(0, 1)
|
||||
antiquant_scale_cpu = torch.randn((n), dtype=torch.float16)
|
||||
antiquant_offset_cpu = torch.randn((n), dtype=torch.float16)
|
||||
|
||||
x_npu = x_cpu.npu()
|
||||
weight_npu = weight_cpu_trans.to(torch.int8).npu()
|
||||
antiquant_scale_npu = antiquant_scale_cpu.npu()
|
||||
antiquant_offset_npu = antiquant_offset_cpu.npu()
|
||||
|
||||
npu_out = self.npu_linear_weight_quant(k, n, antiquant_scale_npu, weight_npu, x_npu, antiquant_offset_npu)
|
||||
cpu_out = self.cpu_linear_weight_quant(weight_cpu_trans, x_cpu, antiquant_scale_cpu, antiquant_offset_cpu)
|
||||
npu_out = npu_out.cpu()
|
||||
self.assertRtolEqual(cpu_out, npu_out.numpy(), 0.01)
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_tests()
|
||||
@@ -0,0 +1,76 @@
|
||||
import unittest
|
||||
import numpy as np
|
||||
import torch
|
||||
import torch_npu
|
||||
from torch_npu.testing.testcase import TestCase, run_tests
|
||||
from torch_npu.contrib.function import npu_multiclass_nms, \
|
||||
npu_batched_multiclass_nms
|
||||
|
||||
|
||||
class TestMultiClassNms(TestCase):
|
||||
def test_npu_multiclass_nms_1(self):
|
||||
np.random.seed(123)
|
||||
data1 = np.random.randint(low=1, high=255, size=(1000, 4))
|
||||
boxes = torch.tensor(data1, dtype=torch.int64)
|
||||
data2 = np.random.randn(1000, 81)
|
||||
scores = torch.tensor(data2, dtype=torch.float32)
|
||||
boxes = boxes.npu().half()
|
||||
scores = scores.npu().half()
|
||||
det_bboxes, det_labels = npu_multiclass_nms(boxes, scores, score_thr=0.3, nms_thr=0.5, max_num=3)
|
||||
expect_det_bboxes = torch.tensor([[81.9375, 183.8750, 35.0000, 172.0000, 4.1797],
|
||||
[52.0000, 47.0000, 196.8750, 67.0000, 3.8750],
|
||||
[76.0000, 140.0000, 42.0000, 132.0000, 3.8613]], dtype=torch.float16)
|
||||
expect_det_labels = torch.tensor([69., 31., 48.], dtype=torch.float16)
|
||||
self.assertRtolEqual(expect_det_bboxes, det_bboxes.cpu())
|
||||
self.assertRtolEqual(expect_det_labels, det_labels.cpu())
|
||||
|
||||
def test_npu_multiclass_nms_2(self):
|
||||
np.random.seed(123)
|
||||
data1 = np.random.randn(1000, 4)
|
||||
boxes = torch.tensor(data1, dtype=torch.float32)
|
||||
data2 = np.random.randn(1000, 81)
|
||||
scores = torch.tensor(data2, dtype=torch.float32)
|
||||
boxes = boxes.npu().half()
|
||||
scores = scores.npu().half()
|
||||
det_bboxes, det_labels = npu_multiclass_nms(boxes, scores, score_thr=0.3, nms_thr=0.5, max_num=3)
|
||||
expect_det_bboxes = torch.tensor([[0.1643, 0.7480, 0.1807, -0.2734, 4.1836],
|
||||
[-0.9736, -0.1373, 0.9473, 1.0938, 4.1641],
|
||||
[1.5234, -0.6831, -1.8359, 1.1035, 4.0664]], dtype=torch.float16)
|
||||
expect_det_labels = torch.tensor([46., 8., 69.], dtype=torch.float16)
|
||||
self.assertRtolEqual(expect_det_bboxes, det_bboxes.cpu())
|
||||
self.assertRtolEqual(expect_det_labels, det_labels.cpu())
|
||||
|
||||
def test_npu_batched_multiclass_nms_1(self):
|
||||
np.random.seed(339)
|
||||
data1 = np.random.randint(low=1, high=255, size=(4, 200, 80, 4))
|
||||
boxes = torch.tensor(data1, dtype=torch.int64)
|
||||
data2 = np.random.randn(4, 200, 81)
|
||||
scores = torch.tensor(data2, dtype=torch.float32)
|
||||
boxes = boxes.npu().half()
|
||||
scores = scores.npu().half()
|
||||
det_bboxes, det_labels = npu_batched_multiclass_nms(boxes, scores, score_thr=0.3, nms_thr=0.5, max_num=3)
|
||||
expect_det_bboxes = torch.tensor([[[195.0000, 133.0000, 123.0000, 36.0000, 4.3984],
|
||||
[70.0000, 113.0000, 149.0000, 22.9844, 3.8184],
|
||||
[203.0000, 250.0000, 9.0000, 81.9375, 3.5996]],
|
||||
|
||||
[[60.0000, 19.0000, 233.8750, 142.0000, 3.7852],
|
||||
[147.0000, 218.0000, 223.0000, 86.9375, 3.6426],
|
||||
[19.0000, 113.0000, 91.9375, 238.8750, 3.5449]],
|
||||
|
||||
[[163.8750, 47.9688, 221.8750, 218.0000, 3.8281],
|
||||
[5.9961, 81.9375, 110.0000, 171.0000, 3.7734],
|
||||
[155.0000, 133.0000, 138.0000, 108.0000, 3.4844]],
|
||||
|
||||
[[238.8750, 78.0000, 188.0000, 17.0000, 3.9121],
|
||||
[79.0000, 115.9375, 83.0000, 246.0000, 3.5879],
|
||||
[11.0000, 94.0000, 243.0000, 226.8750, 3.4805]]], dtype=torch.float16)
|
||||
expect_det_labels = torch.tensor([[27., 36., 78.],
|
||||
[19., 27., 39.],
|
||||
[54., 18., 27.],
|
||||
[72., 43., 31.]], dtype=torch.float16)
|
||||
self.assertRtolEqual(expect_det_bboxes, det_bboxes.cpu())
|
||||
self.assertRtolEqual(expect_det_labels, det_labels.cpu())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_tests()
|
||||
@@ -1,8 +1,8 @@
|
||||
import unittest
|
||||
import torch
|
||||
import torch_npu
|
||||
|
||||
from torch_npu.testing.testcase import TestCase, run_tests
|
||||
from torch_npu.testing.common_utils import create_common_tensor
|
||||
from torch_npu.contrib.module import ROIAlign
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class TestRoiAlign(TestCase):
|
||||
|
||||
input1.requires_grad_(True)
|
||||
roi.requires_grad_(True)
|
||||
model = ROIAlign(output_size, spatial_scale, sampling_ratio).npu()
|
||||
model = ROIAlign(output_size, spatial_scale, sampling_ratio, aligned=aligned).npu()
|
||||
output = model(input1, roi)
|
||||
output.sum().backward()
|
||||
return output.detach().cpu(), input1.grad.cpu()
|
||||
@@ -41,12 +41,12 @@ class TestRoiAlign(TestCase):
|
||||
[16.5000, 18.5000, 20.5000],
|
||||
[28.5000, 30.5000, 32.5000]]]],
|
||||
dtype=torch.float32)
|
||||
expedt_cpu_inputgrad = torch.tensor([[[[0.2397, 0.2346, 0.2346, 0.2346, 0.2346, 0.2907],
|
||||
[0.2346, 0.2296, 0.2296, 0.2296, 0.2296, 0.2845],
|
||||
[0.2346, 0.2296, 0.2296, 0.2296, 0.2296, 0.2845],
|
||||
[0.2346, 0.2296, 0.2296, 0.2296, 0.2296, 0.2845],
|
||||
[0.2346, 0.2296, 0.2296, 0.2296, 0.2296, 0.2845],
|
||||
[0.2907, 0.2845, 0.2845, 0.2845, 0.2845, 0.3525]]]],
|
||||
expedt_cpu_inputgrad = torch.tensor([[[[0.2500, 0.2500, 0.2500, 0.2500, 0.2500, 0.2500],
|
||||
[0.2500, 0.2500, 0.2500, 0.2500, 0.2500, 0.2500],
|
||||
[0.2500, 0.2500, 0.2500, 0.2500, 0.2500, 0.2500],
|
||||
[0.2500, 0.2500, 0.2500, 0.2500, 0.2500, 0.2500],
|
||||
[0.2500, 0.2500, 0.2500, 0.2500, 0.2500, 0.2500],
|
||||
[0.2500, 0.2500, 0.2500, 0.2500, 0.2500, 0.2500]]]],
|
||||
dtype=torch.float32)
|
||||
|
||||
self.assertRtolEqual(expedt_cpu_output, npu_output)
|
||||
@@ -65,12 +65,12 @@ class TestRoiAlign(TestCase):
|
||||
expedt_cpu_output = torch.tensor([[[[2.7500, 4.5000, 6.5000],
|
||||
[13.2500, 15.0000, 17.0000],
|
||||
[25.2500, 27.0000, 29.0000]]]], dtype=torch.float32)
|
||||
expedt_cpu_inputgrad = torch.tensor([[[[0.2397, 0.2346, 0.2346, 0.2346, 0.2346, 0.2907],
|
||||
[0.2346, 0.2296, 0.2296, 0.2296, 0.2296, 0.2845],
|
||||
[0.2346, 0.2296, 0.2296, 0.2296, 0.2296, 0.2845],
|
||||
[0.2346, 0.2296, 0.2296, 0.2296, 0.2296, 0.2845],
|
||||
[0.2346, 0.2296, 0.2296, 0.2296, 0.2296, 0.2845],
|
||||
[0.2907, 0.2845, 0.2845, 0.2845, 0.2845, 0.3525]]]],
|
||||
expedt_cpu_inputgrad = torch.tensor([[[[0.5625, 0.3750, 0.3750, 0.3750, 0.3750, 0.1875],
|
||||
[0.3750, 0.2500, 0.2500, 0.2500, 0.2500, 0.1250],
|
||||
[0.3750, 0.2500, 0.2500, 0.2500, 0.2500, 0.1250],
|
||||
[0.3750, 0.2500, 0.2500, 0.2500, 0.2500, 0.1250],
|
||||
[0.3750, 0.2500, 0.2500, 0.2500, 0.2500, 0.1250],
|
||||
[0.1875, 0.1250, 0.1250, 0.1250, 0.1250, 0.0625]]]],
|
||||
dtype=torch.float32)
|
||||
|
||||
self.assertRtolEqual(expedt_cpu_output, npu_output)
|
||||
@@ -1,10 +1,12 @@
|
||||
import time
|
||||
import unittest
|
||||
|
||||
import numpy as np
|
||||
import torch
|
||||
import torch_npu
|
||||
|
||||
from torch_npu.testing.testcase import TestCase, run_tests
|
||||
from torch_npu.testing.common_utils import create_common_tensor
|
||||
from torch_npu.testing.common_utils import create_common_tensor, SupportedDevices
|
||||
from torch_npu.contrib.function import roll
|
||||
|
||||
|
||||
@@ -48,6 +50,23 @@ class TestRoll(TestCase):
|
||||
slow_output, slow_time = self.npu_slow_roll_op_exec(npu_input, shift_size, (1, 2))
|
||||
fast_output, fast_time = self.npu_fast_roll_op_exec(npu_input, shift_size, (1, 2))
|
||||
self.assertRtolEqual(slow_output, fast_output)
|
||||
if item[0] == np.uint8:
|
||||
continue
|
||||
self.assertTrue(slow_time > fast_time)
|
||||
|
||||
@SupportedDevices(['Ascend910B'])
|
||||
def test_roll_shape_format_uint8(self):
|
||||
dtype_list = [np.uint8]
|
||||
format_list = [-1, 2]
|
||||
shape_list = [[32, 56, 56, 16]]
|
||||
shape_format = [
|
||||
[i, j, k] for i in dtype_list for j in format_list for k in shape_list
|
||||
]
|
||||
for item in shape_format:
|
||||
_, npu_input = create_common_tensor(item, -10, 10)
|
||||
shift_size = 3
|
||||
slow_output, slow_time = self.npu_slow_roll_op_exec(npu_input, shift_size, (1, 2))
|
||||
fast_output, fast_time = self.npu_fast_roll_op_exec(npu_input, shift_size, (1, 2))
|
||||
self.assertTrue(slow_time > fast_time)
|
||||
|
||||
|
||||
@@ -40,6 +40,23 @@ class TestTransferToNpu(TestCase):
|
||||
c = a.to(device_id)
|
||||
d = torch.tensor(1, device=device_id)
|
||||
|
||||
def test_wrap_autocast(self):
|
||||
a = torch.randn([3, 3], device='cuda')
|
||||
b = torch.randn([3, 3], device='cuda')
|
||||
c = a @ b
|
||||
c_before_autocast = c.dtype
|
||||
|
||||
with torch.autocast('cuda'):
|
||||
c = a @ b
|
||||
c_after_autocast_args = c.dtype
|
||||
|
||||
with torch.autocast(device_type='cuda'):
|
||||
c = a @ b
|
||||
c_after_autocast_kwargs = c.dtype
|
||||
|
||||
self.assertNotEqual(c_before_autocast, c_after_autocast_args)
|
||||
self.assertEqual(c_after_autocast_args, c_after_autocast_kwargs)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_tests()
|
||||
@@ -0,0 +1,11 @@
|
||||
#include <torch/extension.h>
|
||||
|
||||
void foo() { }
|
||||
|
||||
TORCH_LIBRARY_IMPL(__test, CPU, m) {
|
||||
m.impl("foo", foo);
|
||||
}
|
||||
|
||||
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
|
||||
m.def("bar", foo);
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
#include <sys/types.h>
|
||||
#include <iostream>
|
||||
#include <torch/extension.h>
|
||||
|
||||
#include "third_party/acl/inc/acl/acl_base.h"
|
||||
#include "third_party/acl/inc/acl/acl_rt.h"
|
||||
#include "torch_npu/csrc/core/npu/NPUCachingAllocator.h"
|
||||
|
||||
extern "C" {
|
||||
using c10_npu::NPUCachingAllocator::DeviceStats;
|
||||
using c10_npu::NPUCachingAllocator::SnapshotInfo;
|
||||
static bool useflag = false;
|
||||
|
||||
void* my_malloc(ssize_t size, int device, aclrtStream stream)
|
||||
{
|
||||
void *ptr;
|
||||
aclrtMallocAlign32(&ptr, size, aclrtMemMallocPolicy::ACL_MEM_MALLOC_HUGE_FIRST);
|
||||
std::cout<<"alloc ptr = "<<ptr<<", size = "<<size<<std::endl;
|
||||
useflag = true;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void my_free(void* ptr, ssize_t size, int device, aclrtStream stream)
|
||||
{
|
||||
std::cout<<"free ptr = "<<ptr<<std::endl;
|
||||
aclrtFree(ptr);
|
||||
}
|
||||
|
||||
bool check_custom_allocator_used()
|
||||
{
|
||||
return useflag;
|
||||
}
|
||||
|
||||
DeviceStats my_get_device_stats(int device)
|
||||
{
|
||||
DeviceStats stats;
|
||||
return stats;
|
||||
}
|
||||
|
||||
void my_reset_peak_status(int device)
|
||||
{
|
||||
std::cout<<"resetPeakStatus success!"<<std::endl;
|
||||
}
|
||||
|
||||
SnapshotInfo my_snapshot()
|
||||
{
|
||||
SnapshotInfo result;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
|
||||
m.def("my_malloc", &my_malloc, "");
|
||||
m.def("my_free", &my_free, "");
|
||||
m.def("check_custom_allocator_used", &check_custom_allocator_used, "");
|
||||
}
|
||||
+6
-4
@@ -1,15 +1,16 @@
|
||||
import math
|
||||
import unittest
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
import torch_npu
|
||||
from torch_npu.testing.testcase import TestCase, run_tests
|
||||
from torch_npu.testing.common_utils import create_common_tensor
|
||||
from torch_npu.testing.common_utils import SupportedDevices
|
||||
|
||||
|
||||
class TestIncreFlashAttention(TestCase):
|
||||
|
||||
def supported_op_exec(self, query, key, value):
|
||||
def supported_op_exec(self, query_states1, past_key, past_value, head_dim, hidden_size):
|
||||
attn_weights1 = torch.matmul(query_states1, past_key.transpose(2, 3)) / 0.0078125
|
||||
attn_weights1 = torch.max(attn_weights1, torch.full(
|
||||
(1, 1), torch.finfo(attn_weights1.dtype).min, device=attn_weights1.device))
|
||||
@@ -24,10 +25,11 @@ class TestIncreFlashAttention(TestCase):
|
||||
tensor = torch.reshape(tensor, (tensor.shape[0], tensor.shape[1], -1))
|
||||
return tensor
|
||||
|
||||
def custom_op_exec(self, query, key, value, head_dim):
|
||||
def custom_op_exec(self, query, key, value, head_dim, hidden_size):
|
||||
scale = 1 / 0.0078125
|
||||
return torch_npu.npu_incre_flash_attention(q, k, v, num_heads=32, input_layout="BSH", scale_value=scale)
|
||||
return torch_npu.npu_incre_flash_attention(query, key, value, num_heads=32, input_layout="BSH", scale_value=scale)
|
||||
|
||||
@SupportedDevices(['Ascend910B'])
|
||||
def test_npu_incre_flash_attention(self, device="npu"):
|
||||
|
||||
q = torch.randn(1, 32, 1, 128, dtype=torch.float16).npu()
|
||||
@@ -0,0 +1,33 @@
|
||||
import unittest
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
import torch_npu
|
||||
from torch_npu.testing.testcase import TestCase, run_tests
|
||||
from torch_npu.testing.common_utils import SupportedDevices
|
||||
|
||||
|
||||
class TestMaskedSoftmaxWithRelPosBias(TestCase):
|
||||
|
||||
def supported_op_exec(self, x, relative_pos_bias, atten_mask):
|
||||
# add + add + softmax
|
||||
y = torch.add(x, atten_mask)
|
||||
y = torch.add(y, relative_pos_bias)
|
||||
softmax_out = torch.nn.functional.softmax(y, dim=-1)
|
||||
return softmax_out.cpu()
|
||||
|
||||
def custom_op_exec(self, x, relative_pos_bias, atten_mask):
|
||||
return torch_npu.npu_masked_softmax_with_rel_pos_bias(x, atten_mask, relative_pos_bias).cpu()
|
||||
|
||||
@SupportedDevices(['Ascend910B'])
|
||||
def test_npu_masked_softmax_with_rel_pos_bias(self, device="npu"):
|
||||
x = torch.randn(1, 2, 3, 4, 4, dtype=torch.float)
|
||||
relative_pos_bias = torch.randn(1, 1, 3, 4, 4, dtype=torch.float)
|
||||
atten_mask = torch.randn(1, 2, 1, 4, 4, dtype=torch.float)
|
||||
|
||||
supported_output = self.supported_op_exec(x, relative_pos_bias, atten_mask)
|
||||
custom_output = self.custom_op_exec(x.npu(), relative_pos_bias.npu(), atten_mask.npu())
|
||||
self.assertRtolEqual(supported_output, custom_output)
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_tests()
|
||||
@@ -0,0 +1,55 @@
|
||||
import unittest
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
import torch_npu
|
||||
from torch_npu.testing.testcase import TestCase, run_tests
|
||||
from torch_npu.testing.common_utils import create_common_tensor
|
||||
|
||||
DEVICE_NAME = torch_npu.npu.get_device_name(0)[:10]
|
||||
|
||||
|
||||
class TestAntiQuant(TestCase):
|
||||
|
||||
def custom_op_exec(self, input_x, scale, offset, dst_dtype, src_dtype):
|
||||
scale = torch.broadcast_to(scale, input_x.shape)
|
||||
if offset is None:
|
||||
offset = torch.zeros_like(scale)
|
||||
|
||||
x = input_x.to(torch.float32)
|
||||
|
||||
offset_temp = x + offset
|
||||
output = offset_temp * scale
|
||||
|
||||
output = output.to(dst_dtype)
|
||||
return output.cpu().detach()
|
||||
|
||||
def npu_op_exec(self, input_x, scale, offset, dst_dtype, src_dtype):
|
||||
output = torch_npu.npu_anti_quant(input_x, scale, offset=offset, dst_dtype=dst_dtype, src_dtype=src_dtype)
|
||||
return output.cpu().detach()
|
||||
|
||||
@unittest.skipIf(DEVICE_NAME != 'Ascend910B',
|
||||
"OP `AntiQuant` is only supported on 910B, skip this ut for this device type!")
|
||||
def test_anti_quant(self, device="npu"):
|
||||
shape_format = [
|
||||
[[np.int8, -1, [10, 100]], [np.float32, -1, [100]], [np.float32, -1, [100]], torch.float16, None],
|
||||
[[np.int8, -1, [10, 100]], [np.float32, -1, [100]], [np.float32, -1, [100]], torch.bfloat16, None],
|
||||
[[np.int8, -1, [10, 100]], [np.float32, -1, [100]], [np.float32, -1, [100]], torch.float16, torch.int8],
|
||||
[[np.int8, -1, [10, 100]], [np.float32, -1, [100]], [np.float32, -1, [100]], torch.bfloat16, torch.int8],
|
||||
]
|
||||
|
||||
for item in shape_format:
|
||||
cpu_input_x, npu_input_x = create_common_tensor(item[0], -127, 127)
|
||||
cpu_scale, npu_scale = create_common_tensor(item[1], -100, 100)
|
||||
cpu_offset, npu_offset = (None, None) if item[2] is None else create_common_tensor(item[2], -100, 100)
|
||||
|
||||
npu_output = self.npu_op_exec(npu_input_x, npu_scale, npu_offset, *item[3:])
|
||||
custom_output = self.custom_op_exec(cpu_input_x, cpu_scale, cpu_offset, *item[3:])
|
||||
|
||||
if item[3] == torch.bfloat16:
|
||||
npu_output = npu_output.to(torch.float32)
|
||||
custom_output = custom_output.to(torch.float32)
|
||||
self.assertRtolEqual(npu_output, custom_output)
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_tests()
|
||||
+3
@@ -1,3 +1,4 @@
|
||||
import unittest
|
||||
import torch
|
||||
|
||||
import torch_npu
|
||||
@@ -63,6 +64,7 @@ class TestBoundingBoxDecode(TestCase):
|
||||
output = output.numpy()
|
||||
return output
|
||||
|
||||
@unittest.skip("skip test_decode_shape_format_fp32 now")
|
||||
def test_decode_shape_format_fp32(self):
|
||||
input1 = torch.tensor([[1., 2., 3., 4.], [3., 4., 5., 6.]],
|
||||
dtype=torch.float32).to("npu")
|
||||
@@ -75,6 +77,7 @@ class TestBoundingBoxDecode(TestCase):
|
||||
1, 1, 1, 1, (10, 10), 0.1)
|
||||
self.assertRtolEqual(npu_output, custom_output)
|
||||
|
||||
@unittest.skip("skip test_decode_shape_format_fp16 now")
|
||||
def test_decode_shape_format_fp16(self):
|
||||
input1_fp16 = torch.tensor([[1., 2., 3., 4.], [3., 4., 5., 6.]],
|
||||
dtype=torch.float16).to("npu")
|
||||
+2
-1
@@ -19,7 +19,8 @@ class TestFusedAttentionQKV(TestCase):
|
||||
v_kernel = torch_npu.npu_format_cast(v_kernel.t().contiguous(), 29)
|
||||
|
||||
norm_shape = (1024,)
|
||||
norm, mean, variance = torch.native_layer_norm(ln_input, norm_shape, gamma, beta, eps=1e-05)
|
||||
norm, mean, _ = torch.native_layer_norm(ln_input, norm_shape, gamma, beta, eps=1e-05)
|
||||
variance = torch.var(ln_input, -1, keepdim=False, unbiased=False)
|
||||
q_layer = self.confusion_transpose(torch.nn.functional.linear(norm, q_kernel, q_bias), (24, 512, 16, 64))
|
||||
k_layer = self.confusion_transpose(torch.nn.functional.linear(norm, k_kernel, k_bias), (24, 512, 16, 64))
|
||||
v_layer = self.confusion_transpose(torch.nn.functional.linear(norm, v_kernel, v_bias), (24, 512, 16, 64))
|
||||
@@ -0,0 +1,89 @@
|
||||
import math
|
||||
import unittest
|
||||
import numpy as np
|
||||
import torch
|
||||
import torch_npu
|
||||
from torch_npu.testing.testcase import TestCase, run_tests
|
||||
from torch_npu.testing.common_utils import SupportedDevices
|
||||
|
||||
|
||||
class TestNPUFlashAttention(TestCase):
|
||||
def supported_op_exec(self, query, key, value, atten_mask):
|
||||
scale = 0.08838
|
||||
qk = torch.matmul(query, key.transpose(2, 3)).mul(scale)
|
||||
qk = qk + atten_mask * (-10000.0)
|
||||
softmax_res = torch.nn.functional.softmax(qk, dim=-1, dtype=torch.float32).to(torch.float16)
|
||||
attention_out = torch.matmul(softmax_res, value)
|
||||
return attention_out
|
||||
|
||||
def custom_op_exec(self, query, key, value, sparse_params):
|
||||
scale = 0.08838
|
||||
atten_mask = None
|
||||
if sparse_params[0] == 0:
|
||||
shape = [1, 8, 256, 256]
|
||||
atten_mask_u = np.triu(np.ones(shape), k=sparse_params[1] + 1)
|
||||
atten_mask_l = np.tril(np.ones(shape), k=-sparse_params[2] - 1)
|
||||
atten_masks = atten_mask_u + atten_mask_l
|
||||
atten_mask = torch.tensor(atten_masks).to(torch.float16).bool().npu()
|
||||
if sparse_params[0] == 2 or sparse_params[0] == 3 or sparse_params[0] == 4:
|
||||
atten_masks = torch.from_numpy(np.triu(np.ones([2048, 2048]), k=1))
|
||||
atten_mask = torch.tensor(atten_masks).to(torch.float16).bool().npu()
|
||||
return torch_npu.npu_fusion_attention(
|
||||
query, key, value, head_num=8, input_layout="BNSD", scale=scale, sparse_mode=sparse_params[0],
|
||||
atten_mask=atten_mask, pre_tockens=sparse_params[1], next_tockens=sparse_params[2])
|
||||
|
||||
def get_atten_mask(self, sparse_mode=0, pre_tokens=65536, next_tokens=65536):
|
||||
atten_masks = []
|
||||
shape = [1, 8, 256, 256]
|
||||
if sparse_mode == 0:
|
||||
atten_mask_u = np.triu(np.ones(shape), k=next_tokens + 1)
|
||||
atten_mask_l = np.tril(np.ones(shape), k=-pre_tokens - 1)
|
||||
atten_masks = atten_mask_u + atten_mask_l
|
||||
|
||||
elif sparse_mode == 1:
|
||||
atten_masks = np.zeros(shape)
|
||||
pre_tokens = 65536
|
||||
next_tokens = 65536
|
||||
|
||||
elif sparse_mode == 2:
|
||||
atten_masks = np.triu(np.ones(shape), k=1)
|
||||
|
||||
elif sparse_mode == 3:
|
||||
atten_masks = np.triu(np.ones(shape), k=1)
|
||||
|
||||
elif sparse_mode == 4:
|
||||
atten_mask_u = np.triu(np.ones(shape), k=next_tokens + 1)
|
||||
atten_mask_l = np.tril(np.ones(shape), k=-pre_tokens - 1)
|
||||
atten_masks = atten_mask_u + atten_mask_l
|
||||
|
||||
atten_mask = torch.tensor(atten_masks).to(torch.float16)
|
||||
return atten_mask
|
||||
|
||||
# sparse_params = [sparse_mode, pre_tokens, next_tokens]
|
||||
def check_result(self, query, key, value, sparse_params):
|
||||
atten_mask = self.get_atten_mask(sparse_params[0], sparse_params[1], sparse_params[2])
|
||||
output = self.supported_op_exec(query, key, value, atten_mask)
|
||||
fa_result = self.custom_op_exec(query.npu(), key.npu(), value.npu(), sparse_params)
|
||||
self.assertRtolEqual(output, fa_result[0], prec=0.01, prec16=0.01)
|
||||
|
||||
|
||||
@SupportedDevices(['Ascend910B'])
|
||||
def test_npu_flash_attention(self, device="npu"):
|
||||
query = torch.randn(1, 8, 256, 256, dtype=torch.float16)
|
||||
key = torch.randn(1, 8, 256, 256, dtype=torch.float16)
|
||||
value = torch.randn(1, 8, 256, 256, dtype=torch.float16)
|
||||
|
||||
# sparse_params: [sparse_mode, pre_tokens, next_tokens]
|
||||
sparse_params_list = [
|
||||
[0, 128, 128],
|
||||
[1, 65536, 65536],
|
||||
[2, 65536, 0],
|
||||
[3, 65536, 0],
|
||||
[4, 128, 128]
|
||||
]
|
||||
|
||||
for sparse_params in sparse_params_list:
|
||||
self.check_result(query, key, value, sparse_params)
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_tests()
|
||||
@@ -53,7 +53,7 @@ class TestNpuIndexing(TestCase):
|
||||
return out
|
||||
|
||||
def npu_op_exec(self, mat, begin, end, strides):
|
||||
output = torch.npu_indexing(mat, begin, end, strides)
|
||||
output = torch_npu.npu_indexing(mat, begin, end, strides)
|
||||
return output
|
||||
|
||||
def split_op_exec(self, mat, begin, end, strides):
|
||||
@@ -1,3 +1,4 @@
|
||||
import unittest
|
||||
import torch
|
||||
|
||||
import torch_npu
|
||||
@@ -38,6 +39,7 @@ class TestNpuIou(TestCase):
|
||||
output = output.numpy()
|
||||
return output
|
||||
|
||||
@unittest.skip("skip test_iou_fp16 now")
|
||||
def test_iou_fp16(self):
|
||||
bboxes = torch.tensor([[0, 0, 10, 10],
|
||||
[10, 10, 20, 20],
|
||||
@@ -54,6 +56,7 @@ class TestNpuIou(TestCase):
|
||||
output_custom = self.custom_op_exec(bboxes, gtboxes)
|
||||
self.assertRtolEqual(output_npu, output_custom)
|
||||
|
||||
@unittest.skip("skip test_iou_fp16_pt now")
|
||||
def test_iou_fp16_pt(self):
|
||||
bboxes = torch.tensor([[1, 2, 3, 4],
|
||||
[5, 6, 7, 8],
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user