Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactor] Graceful as_tensor #549

Merged
merged 2 commits into from
Nov 2, 2023
Merged

[Refactor] Graceful as_tensor #549

merged 2 commits into from
Nov 2, 2023

Conversation

vmoens
Copy link
Contributor

@vmoens vmoens commented Oct 30, 2023

No description provided.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 30, 2023
@github-actions
Copy link

github-actions bot commented Oct 30, 2023

$\color{#D29922}\textsf{\Large⚠\kern{0.2cm}\normalsize Warning}$ Result of CPU Benchmark Tests

Total Benchmarks: 105. Improved: $\large\color{#35bf28}3$. Worsened: $\large\color{#d91a1a}3$.

Expand to view detailed results
Name Max Mean Ops Ops on Repo HEAD Change
test_plain_set_nested 42.5030μs 24.1435μs 41.4190 KOps/s 41.7646 KOps/s $\color{#d91a1a}-0.83\%$
test_plain_set_stack_nested 0.2823ms 0.2269ms 4.4079 KOps/s 4.5233 KOps/s $\color{#d91a1a}-2.55\%$
test_plain_set_nested_inplace 0.1006ms 28.6267μs 34.9324 KOps/s 35.8339 KOps/s $\color{#d91a1a}-2.52\%$
test_plain_set_stack_nested_inplace 0.3000ms 0.2636ms 3.7929 KOps/s 3.8366 KOps/s $\color{#d91a1a}-1.14\%$
test_items 0.4099ms 4.5546μs 219.5583 KOps/s 233.7261 KOps/s $\textbf{\color{#d91a1a}-6.06\%}$
test_items_nested 0.4868ms 0.4560ms 2.1927 KOps/s 2.3125 KOps/s $\textbf{\color{#d91a1a}-5.18\%}$
test_items_nested_locked 3.4603ms 0.4895ms 2.0429 KOps/s 2.2872 KOps/s $\textbf{\color{#d91a1a}-10.68\%}$
test_items_nested_leaf 0.3108ms 0.2749ms 3.6371 KOps/s 3.8215 KOps/s $\color{#d91a1a}-4.82\%$
test_items_stack_nested 2.4825ms 2.3885ms 418.6783 Ops/s 420.9006 Ops/s $\color{#d91a1a}-0.53\%$
test_items_stack_nested_leaf 2.4420ms 2.1643ms 462.0342 Ops/s 465.6369 Ops/s $\color{#d91a1a}-0.77\%$
test_items_stack_nested_locked 1.3145ms 1.1805ms 847.0899 Ops/s 853.3825 Ops/s $\color{#d91a1a}-0.74\%$
test_keys 32.3020μs 6.3636μs 157.1438 KOps/s 159.0306 KOps/s $\color{#d91a1a}-1.19\%$
test_keys_nested 0.8121ms 0.2222ms 4.5009 KOps/s 4.1713 KOps/s $\textbf{\color{#35bf28}+7.90\%}$
test_keys_nested_locked 0.2489ms 0.2199ms 4.5484 KOps/s 4.5046 KOps/s $\color{#35bf28}+0.97\%$
test_keys_nested_leaf 0.3358ms 0.2099ms 4.7633 KOps/s 4.7268 KOps/s $\color{#35bf28}+0.77\%$
test_keys_stack_nested 4.5594ms 2.2003ms 454.4821 Ops/s 456.2638 Ops/s $\color{#d91a1a}-0.39\%$
test_keys_stack_nested_leaf 2.3049ms 2.1874ms 457.1729 Ops/s 455.5102 Ops/s $\color{#35bf28}+0.37\%$
test_keys_stack_nested_locked 1.1333ms 0.9776ms 1.0229 KOps/s 1.0261 KOps/s $\color{#d91a1a}-0.31\%$
test_values 21.2010μs 1.9272μs 518.8893 KOps/s 512.5396 KOps/s $\color{#35bf28}+1.24\%$
test_values_nested 0.1122ms 76.2655μs 13.1121 KOps/s 12.9625 KOps/s $\color{#35bf28}+1.15\%$
test_values_nested_locked 0.1445ms 76.1755μs 13.1276 KOps/s 13.1479 KOps/s $\color{#d91a1a}-0.15\%$
test_values_nested_leaf 0.1012ms 67.6455μs 14.7830 KOps/s 14.5369 KOps/s $\color{#35bf28}+1.69\%$
test_values_stack_nested 1.9909ms 1.9078ms 524.1575 Ops/s 517.2766 Ops/s $\color{#35bf28}+1.33\%$
test_values_stack_nested_leaf 1.9549ms 1.8993ms 526.5189 Ops/s 525.0676 Ops/s $\color{#35bf28}+0.28\%$
test_values_stack_nested_locked 0.9044ms 0.7685ms 1.3013 KOps/s 1.2826 KOps/s $\color{#35bf28}+1.45\%$
test_membership 28.4020μs 2.1939μs 455.8093 KOps/s 449.7583 KOps/s $\color{#35bf28}+1.35\%$
test_membership_nested 29.2020μs 4.3594μs 229.3886 KOps/s 239.4377 KOps/s $\color{#d91a1a}-4.20\%$
test_membership_nested_leaf 0.2544ms 4.3626μs 229.2220 KOps/s 238.5282 KOps/s $\color{#d91a1a}-3.90\%$
test_membership_stacked_nested 45.7030μs 17.9053μs 55.8494 KOps/s 57.4093 KOps/s $\color{#d91a1a}-2.72\%$
test_membership_stacked_nested_leaf 43.4030μs 17.9414μs 55.7370 KOps/s 57.3656 KOps/s $\color{#d91a1a}-2.84\%$
test_membership_nested_last 35.0030μs 9.2563μs 108.0350 KOps/s 112.0245 KOps/s $\color{#d91a1a}-3.56\%$
test_membership_nested_leaf_last 35.7020μs 9.2401μs 108.2237 KOps/s 111.8013 KOps/s $\color{#d91a1a}-3.20\%$
test_membership_stacked_nested_last 0.3027ms 0.2763ms 3.6193 KOps/s 3.6883 KOps/s $\color{#d91a1a}-1.87\%$
test_membership_stacked_nested_leaf_last 41.8030μs 20.8108μs 48.0521 KOps/s 49.3035 KOps/s $\color{#d91a1a}-2.54\%$
test_nested_getleaf 84.6050μs 19.0398μs 52.5216 KOps/s 52.8907 KOps/s $\color{#d91a1a}-0.70\%$
test_nested_get 58.5040μs 18.0279μs 55.4697 KOps/s 55.8321 KOps/s $\color{#d91a1a}-0.65\%$
test_stacked_getleaf 1.1758ms 1.0521ms 950.4723 Ops/s 953.9275 Ops/s $\color{#d91a1a}-0.36\%$
test_stacked_get 1.0892ms 1.0066ms 993.4404 Ops/s 996.4553 Ops/s $\color{#d91a1a}-0.30\%$
test_nested_getitemleaf 42.7030μs 18.9481μs 52.7757 KOps/s 52.9378 KOps/s $\color{#d91a1a}-0.31\%$
test_nested_getitem 42.2020μs 18.0281μs 55.4689 KOps/s 55.6558 KOps/s $\color{#d91a1a}-0.34\%$
test_stacked_getitemleaf 1.2368ms 1.0559ms 947.0282 Ops/s 952.6311 Ops/s $\color{#d91a1a}-0.59\%$
test_stacked_getitem 1.1089ms 1.0046ms 995.4013 Ops/s 999.2165 Ops/s $\color{#d91a1a}-0.38\%$
test_lock_nested 71.1162ms 1.8514ms 540.1277 Ops/s 561.5011 Ops/s $\color{#d91a1a}-3.81\%$
test_lock_stack_nested 0.1004s 23.3517ms 42.8234 Ops/s 42.6498 Ops/s $\color{#35bf28}+0.41\%$
test_unlock_nested 68.1842ms 1.8565ms 538.6564 Ops/s 535.9287 Ops/s $\color{#35bf28}+0.51\%$
test_unlock_stack_nested 0.1052s 24.0568ms 41.5683 Ops/s 41.5179 Ops/s $\color{#35bf28}+0.12\%$
test_flatten_speed 1.2463ms 1.2004ms 833.0746 Ops/s 809.8160 Ops/s $\color{#35bf28}+2.87\%$
test_unflatten_speed 2.2773ms 2.1564ms 463.7428 Ops/s 455.8887 Ops/s $\color{#35bf28}+1.72\%$
test_common_ops 1.5389ms 1.3012ms 768.5055 Ops/s 752.5421 Ops/s $\color{#35bf28}+2.12\%$
test_creation 27.2010μs 7.4437μs 134.3414 KOps/s 131.9778 KOps/s $\color{#35bf28}+1.79\%$
test_creation_empty 34.7020μs 16.1691μs 61.8463 KOps/s 60.4169 KOps/s $\color{#35bf28}+2.37\%$
test_creation_nested_1 56.3040μs 28.8675μs 34.6410 KOps/s 33.8513 KOps/s $\color{#35bf28}+2.33\%$
test_creation_nested_2 58.3040μs 31.6039μs 31.6417 KOps/s 30.5691 KOps/s $\color{#35bf28}+3.51\%$
test_clone 0.1183ms 29.0647μs 34.4061 KOps/s 34.0480 KOps/s $\color{#35bf28}+1.05\%$
test_getitem[int] 63.1040μs 33.0734μs 30.2358 KOps/s 29.6301 KOps/s $\color{#35bf28}+2.04\%$
test_getitem[slice_int] 0.1210ms 65.6902μs 15.2230 KOps/s 15.1632 KOps/s $\color{#35bf28}+0.39\%$
test_getitem[range] 0.1329ms 97.5027μs 10.2561 KOps/s 10.0189 KOps/s $\color{#35bf28}+2.37\%$
test_getitem[tuple] 0.1446ms 53.9814μs 18.5249 KOps/s 18.1000 KOps/s $\color{#35bf28}+2.35\%$
test_getitem[list] 0.2776ms 91.5492μs 10.9231 KOps/s 10.6862 KOps/s $\color{#35bf28}+2.22\%$
test_setitem_dim[int] 65.1040μs 41.5633μs 24.0597 KOps/s 23.8184 KOps/s $\color{#35bf28}+1.01\%$
test_setitem_dim[slice_int] 0.1054ms 73.2663μs 13.6488 KOps/s 13.5132 KOps/s $\color{#35bf28}+1.00\%$
test_setitem_dim[range] 0.1380ms 97.3373μs 10.2735 KOps/s 9.9716 KOps/s $\color{#35bf28}+3.03\%$
test_setitem_dim[tuple] 96.6060μs 60.6504μs 16.4879 KOps/s 16.2875 KOps/s $\color{#35bf28}+1.23\%$
test_setitem 0.1395ms 37.3932μs 26.7429 KOps/s 26.2262 KOps/s $\color{#35bf28}+1.97\%$
test_set 0.1319ms 35.9999μs 27.7779 KOps/s 27.0060 KOps/s $\color{#35bf28}+2.86\%$
test_set_shared 3.7778ms 0.2390ms 4.1845 KOps/s 4.0770 KOps/s $\color{#35bf28}+2.64\%$
test_update 0.1567ms 41.5564μs 24.0637 KOps/s 23.7981 KOps/s $\color{#35bf28}+1.12\%$
test_update_nested 0.2142ms 61.2752μs 16.3198 KOps/s 16.1315 KOps/s $\color{#35bf28}+1.17\%$
test_set_nested 0.1872ms 40.1084μs 24.9324 KOps/s 24.4698 KOps/s $\color{#35bf28}+1.89\%$
test_set_nested_new 0.2160ms 63.6277μs 15.7164 KOps/s 15.5564 KOps/s $\color{#35bf28}+1.03\%$
test_select 0.2846ms 0.1171ms 8.5422 KOps/s 8.5034 KOps/s $\color{#35bf28}+0.46\%$
test_unbind_speed 3.7438ms 0.7925ms 1.2619 KOps/s 1.2742 KOps/s $\color{#d91a1a}-0.97\%$
test_unbind_speed_stack0 80.7200ms 10.9011ms 91.7342 Ops/s 94.0306 Ops/s $\color{#d91a1a}-2.44\%$
test_unbind_speed_stack1 6.0604μs 1.1301μs 884.8661 KOps/s 914.1068 KOps/s $\color{#d91a1a}-3.20\%$
test_creation[device0] 0.6321ms 0.5398ms 1.8525 KOps/s 1.8415 KOps/s $\color{#35bf28}+0.60\%$
test_creation_from_tensor 3.7645ms 0.6067ms 1.6483 KOps/s 1.6357 KOps/s $\color{#35bf28}+0.77\%$
test_add_one[memmap_tensor0] 1.8927ms 38.8888μs 25.7144 KOps/s 25.1145 KOps/s $\color{#35bf28}+2.39\%$
test_contiguous[memmap_tensor0] 27.5020μs 10.2420μs 97.6369 KOps/s 92.4418 KOps/s $\textbf{\color{#35bf28}+5.62\%}$
test_stack[memmap_tensor0] 79.1050μs 31.6486μs 31.5970 KOps/s 31.2161 KOps/s $\color{#35bf28}+1.22\%$
test_memmaptd_index 0.4711ms 0.3691ms 2.7096 KOps/s 2.6552 KOps/s $\color{#35bf28}+2.05\%$
test_memmaptd_index_astensor 1.6249ms 1.4871ms 672.4555 Ops/s 679.7767 Ops/s $\color{#d91a1a}-1.08\%$
test_memmaptd_index_op 3.2203ms 3.1702ms 315.4397 Ops/s 312.2523 Ops/s $\color{#35bf28}+1.02\%$
test_reshape_pytree 0.1080ms 39.3602μs 25.4063 KOps/s 24.9471 KOps/s $\color{#35bf28}+1.84\%$
test_reshape_td 83.3050μs 48.9179μs 20.4424 KOps/s 19.8111 KOps/s $\color{#35bf28}+3.19\%$
test_view_pytree 0.1663ms 39.2326μs 25.4890 KOps/s 25.3136 KOps/s $\color{#35bf28}+0.69\%$
test_view_td 30.1020μs 11.2609μs 88.8028 KOps/s 92.3158 KOps/s $\color{#d91a1a}-3.81\%$
test_unbind_pytree 97.7060μs 45.1342μs 22.1562 KOps/s 21.8966 KOps/s $\color{#35bf28}+1.19\%$
test_unbind_td 0.1528ms 0.1170ms 8.5439 KOps/s 8.4185 KOps/s $\color{#35bf28}+1.49\%$
test_split_pytree 96.8060μs 43.8691μs 22.7951 KOps/s 22.5715 KOps/s $\color{#35bf28}+0.99\%$
test_split_td 0.8954ms 0.1289ms 7.7604 KOps/s 7.6432 KOps/s $\color{#35bf28}+1.53\%$
test_add_pytree 0.1183ms 56.4160μs 17.7255 KOps/s 17.8559 KOps/s $\color{#d91a1a}-0.73\%$
test_add_td 0.1320ms 92.7091μs 10.7864 KOps/s 10.6473 KOps/s $\color{#35bf28}+1.31\%$
test_distributed 39.9030μs 11.0902μs 90.1694 KOps/s 89.8639 KOps/s $\color{#35bf28}+0.34\%$
test_tdmodule 1.2016ms 33.7098μs 29.6649 KOps/s 29.8086 KOps/s $\color{#d91a1a}-0.48\%$
test_tdmodule_dispatch 0.3657ms 62.6310μs 15.9665 KOps/s 15.6994 KOps/s $\color{#35bf28}+1.70\%$
test_tdseq 67.8040μs 38.5406μs 25.9467 KOps/s 25.8674 KOps/s $\color{#35bf28}+0.31\%$
test_tdseq_dispatch 0.6219ms 78.0157μs 12.8179 KOps/s 12.9113 KOps/s $\color{#d91a1a}-0.72\%$
test_instantiation_functorch 2.2301ms 2.0230ms 494.3074 Ops/s 494.8191 Ops/s $\color{#d91a1a}-0.10\%$
test_instantiation_td 2.3539ms 1.6488ms 606.4877 Ops/s 604.1471 Ops/s $\color{#35bf28}+0.39\%$
test_exec_functorch 0.2851ms 0.2389ms 4.1859 KOps/s 4.1213 KOps/s $\color{#35bf28}+1.57\%$
test_exec_td 0.2689ms 0.2253ms 4.4380 KOps/s 4.3632 KOps/s $\color{#35bf28}+1.71\%$
test_vmap_mlp_speed[True-True] 10.9447ms 1.4528ms 688.3471 Ops/s 676.6861 Ops/s $\color{#35bf28}+1.72\%$
test_vmap_mlp_speed[True-False] 6.8988ms 0.7619ms 1.3126 KOps/s 1.1250 KOps/s $\textbf{\color{#35bf28}+16.67\%}$
test_vmap_mlp_speed[False-True] 10.2813ms 1.2306ms 812.5949 Ops/s 817.5482 Ops/s $\color{#d91a1a}-0.61\%$
test_vmap_mlp_speed[False-False] 6.3302ms 0.5782ms 1.7295 KOps/s 1.7547 KOps/s $\color{#d91a1a}-1.43\%$

@vmoens vmoens added the Refactor Refactoring code - not a new feature label Nov 2, 2023
@vmoens vmoens merged commit 09b327c into main Nov 2, 2023
15 of 30 checks passed
@vmoens vmoens deleted the graceful_as_tensor branch November 2, 2023 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Refactor Refactoring code - not a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants