Commit c4c1a8a
committed
Optimize TCQ with block-level AVX2 dispatch
Previously, TCQ evaluated coefficients along anti-diagonal scan lines
in a portable C loop (trellis_loop_diagonal_st8), invoking individual
fine-grained RTCD SIMD functions per coefficient.
This fine-grained dispatch structure incurred significant overhead:
- Repeated RTCD function calls and indirect branches on every coeff.
- Register spills to memory structures across subroutine boundaries.
- Optimization barriers preventing compiler vector scheduling across
the full diagonal loop.
This patch introduces a coarse-grained, block-level RTCD entry point:
av2_trellis_loop_diagonal_st8()
with AVX2 specialization (av2_trellis_loop_diagonal_st8_avx2).
Updates are now executed contiguously within AVX2 registers without
exiting to scalar C code per coefficient.
Unit tests are added to compare the the new and original implementation.
We can see that the TCQ function becomes 3-10% faster.
=====================================================================
TX Size Pure C (us) Base AVX2 (us) Patch AVX2 (us) vs Base AVX2
---------------------------------------------------------------
4x4 110313 45646 44360 1.03x (+2.8%)
8x8 369747 102636 96537 1.06x (+5.9%)
16x16 343618 81354 74201 1.10x (+8.8%)
32x32 268794 60375 54646 1.10x (+9.5%)
4x8 195707 64939 61781 1.05x (+4.9%)
8x4 201683 65227 61872 1.05x (+5.1%)
8x16 175484 44150 40669 1.09x (+7.9%)
16x8 180465 44455 40943 1.09x (+7.9%)
16x32 134924 30975 28011 1.11x (+9.6%)
32x16 134311 30946 28192 1.10x (+8.9%)
4x16 364581 103343 96494 1.07x (+6.6%)
16x4 390933 104326 97702 1.07x (+6.3%)
8x32 343005 81586 74379 1.10x (+8.8%)
32x8 352547 81916 74820 1.09x (+8.7%)
=====================================================================
Change-Id: Ib14c7e995e37e4c0af0750af50c78db3d2adb3b51 parent 735d104 commit c4c1a8a
4 files changed
Lines changed: 777 additions & 67 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| 249 | + | |
| 250 | + | |
249 | 251 | | |
250 | 252 | | |
251 | 253 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
935 | 935 | | |
936 | 936 | | |
937 | 937 | | |
938 | | - | |
939 | | - | |
940 | | - | |
941 | | - | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
942 | 944 | | |
943 | 945 | | |
944 | 946 | | |
| |||
985 | 987 | | |
986 | 988 | | |
987 | 989 | | |
988 | | - | |
| 990 | + | |
989 | 991 | | |
990 | 992 | | |
991 | 993 | | |
992 | 994 | | |
993 | 995 | | |
994 | | - | |
995 | | - | |
996 | | - | |
997 | | - | |
998 | | - | |
999 | | - | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
1000 | 1002 | | |
1001 | | - | |
1002 | | - | |
1003 | | - | |
1004 | | - | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
1005 | 1007 | | |
1006 | | - | |
1007 | | - | |
| 1008 | + | |
| 1009 | + | |
1008 | 1010 | | |
1009 | 1011 | | |
1010 | | - | |
| 1012 | + | |
1011 | 1013 | | |
1012 | 1014 | | |
1013 | 1015 | | |
1014 | 1016 | | |
1015 | 1017 | | |
1016 | | - | |
| 1018 | + | |
1017 | 1019 | | |
1018 | 1020 | | |
1019 | 1021 | | |
| |||
1041 | 1043 | | |
1042 | 1044 | | |
1043 | 1045 | | |
1044 | | - | |
| 1046 | + | |
1045 | 1047 | | |
1046 | 1048 | | |
1047 | 1049 | | |
1048 | 1050 | | |
1049 | 1051 | | |
1050 | | - | |
1051 | | - | |
1052 | | - | |
1053 | | - | |
1054 | | - | |
1055 | | - | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
1056 | 1058 | | |
1057 | 1059 | | |
1058 | | - | |
1059 | | - | |
1060 | | - | |
1061 | | - | |
1062 | | - | |
1063 | | - | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
1064 | 1066 | | |
1065 | 1067 | | |
1066 | | - | |
| 1068 | + | |
1067 | 1069 | | |
1068 | 1070 | | |
1069 | 1071 | | |
1070 | 1072 | | |
1071 | 1073 | | |
1072 | 1074 | | |
1073 | | - | |
| 1075 | + | |
1074 | 1076 | | |
1075 | 1077 | | |
1076 | 1078 | | |
| |||
1353 | 1355 | | |
1354 | 1356 | | |
1355 | 1357 | | |
1356 | | - | |
| 1358 | + | |
1357 | 1359 | | |
1358 | 1360 | | |
1359 | 1361 | | |
| |||
0 commit comments