Commit bce6ec1
Optimize tensor descriptor functor template instantiation
Replace inline lambdas with named functor structs in transform_tensor_descriptor
to reduce template instantiation overhead and improve compile times.
Changes:
- Add three named functors in tensor_descriptor.hpp:
- convert_visible_to_hidden_id: maps visible dimension ID to hidden ID
- convert_visible_ids_to_hidden_ids: maps sequence of visible IDs to hidden IDs
- generate_arithmetic_sequence_from_scan: generates consecutive hidden dim ID ranges
- Add utility functions in sequence_helper.hpp and tuple_helper.hpp:
- unpack_and_merge_sequences(): unpacks tuple of sequences and merges them
- generate_identity_sequences(): creates Tuple<Sequence<0>, Sequence<1>, ...>
- Update 14 call sites across threadwise transfer, wrapper, and device files
to use generate_identity_sequences() instead of generate_tuple with lambdas
- Add comprehensive unit tests:
- unit_sequence_helper.cpp: tests for new utility functions
- unit_tensor_descriptor_functors.cpp: tests for new functors
Co-Authored-By: Claude <[email protected]>1 parent f16d910 commit bce6ec1
19 files changed
Lines changed: 549 additions & 73 deletions
File tree
- include/ck
- tensor_description
- tensor_operation/gpu
- device
- thread
- utility
- wrapper
- operations
- utils
- test/util
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
| 39 | + | |
41 | 40 | | |
42 | | - | |
43 | | - | |
| 41 | + | |
44 | 42 | | |
45 | 43 | | |
46 | 44 | | |
| |||
311 | 309 | | |
312 | 310 | | |
313 | 311 | | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
314 | 347 | | |
315 | 348 | | |
316 | 349 | | |
| |||
327 | 360 | | |
328 | 361 | | |
329 | 362 | | |
330 | | - | |
331 | | - | |
| 363 | + | |
| 364 | + | |
332 | 365 | | |
333 | | - | |
334 | | - | |
| 366 | + | |
| 367 | + | |
335 | 368 | | |
336 | 369 | | |
337 | 370 | | |
| |||
341 | 374 | | |
342 | 375 | | |
343 | 376 | | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
355 | 380 | | |
356 | 381 | | |
357 | 382 | | |
| |||
364 | 389 | | |
365 | 390 | | |
366 | 391 | | |
| 392 | + | |
367 | 393 | | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
| 394 | + | |
374 | 395 | | |
375 | 396 | | |
376 | 397 | | |
377 | 398 | | |
378 | | - | |
| 399 | + | |
379 | 400 | | |
380 | 401 | | |
381 | | - | |
382 | | - | |
| 402 | + | |
383 | 403 | | |
384 | 404 | | |
385 | 405 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
| 46 | + | |
| 47 | + | |
51 | 48 | | |
52 | 49 | | |
53 | 50 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
739 | 739 | | |
740 | 740 | | |
741 | 741 | | |
742 | | - | |
743 | | - | |
| 742 | + | |
744 | 743 | | |
745 | 744 | | |
746 | 745 | | |
| |||
Lines changed: 3 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
894 | 894 | | |
895 | 895 | | |
896 | 896 | | |
897 | | - | |
898 | | - | |
| 897 | + | |
899 | 898 | | |
900 | 899 | | |
901 | 900 | | |
| |||
944 | 943 | | |
945 | 944 | | |
946 | 945 | | |
947 | | - | |
948 | | - | |
| 946 | + | |
949 | 947 | | |
950 | 948 | | |
951 | 949 | | |
| |||
993 | 991 | | |
994 | 992 | | |
995 | 993 | | |
996 | | - | |
997 | | - | |
| 994 | + | |
998 | 995 | | |
999 | 996 | | |
1000 | 997 | | |
| |||
Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
833 | 833 | | |
834 | 834 | | |
835 | 835 | | |
836 | | - | |
837 | | - | |
| 836 | + | |
838 | 837 | | |
839 | 838 | | |
840 | 839 | | |
| |||
892 | 891 | | |
893 | 892 | | |
894 | 893 | | |
895 | | - | |
896 | | - | |
| 894 | + | |
897 | 895 | | |
898 | 896 | | |
899 | 897 | | |
| |||
Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
692 | 692 | | |
693 | 693 | | |
694 | 694 | | |
695 | | - | |
696 | | - | |
| 695 | + | |
697 | 696 | | |
698 | 697 | | |
699 | 698 | | |
| |||
744 | 743 | | |
745 | 744 | | |
746 | 745 | | |
747 | | - | |
748 | | - | |
| 746 | + | |
749 | 747 | | |
750 | 748 | | |
751 | 749 | | |
| |||
Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
514 | 514 | | |
515 | 515 | | |
516 | 516 | | |
517 | | - | |
518 | | - | |
| 517 | + | |
519 | 518 | | |
520 | 519 | | |
521 | 520 | | |
| |||
563 | 562 | | |
564 | 563 | | |
565 | 564 | | |
566 | | - | |
567 | | - | |
| 565 | + | |
568 | 566 | | |
569 | 567 | | |
570 | 568 | | |
| |||
Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
656 | 656 | | |
657 | 657 | | |
658 | 658 | | |
659 | | - | |
660 | | - | |
| 659 | + | |
661 | 660 | | |
662 | 661 | | |
663 | 662 | | |
| |||
706 | 705 | | |
707 | 706 | | |
708 | 707 | | |
709 | | - | |
710 | | - | |
| 708 | + | |
711 | 709 | | |
712 | 710 | | |
713 | 711 | | |
| |||
Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
548 | 548 | | |
549 | 549 | | |
550 | 550 | | |
551 | | - | |
552 | | - | |
| 551 | + | |
553 | 552 | | |
554 | 553 | | |
555 | 554 | | |
| |||
598 | 597 | | |
599 | 598 | | |
600 | 599 | | |
601 | | - | |
602 | | - | |
| 600 | + | |
603 | 601 | | |
604 | 602 | | |
605 | 603 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
37 | 55 | | |
0 commit comments