Commit 171349b
committed
perf(avx/avx2): plain-move lowering for constant-mask load/store
Half-confined constant-mask load_masked/store_masked shapes now emit
plain moves instead of vpmaskmov/vmaskmov, which never store-forward on
Intel and are microcoded on AMD.
AVX (256-bit, xsimd_avx.hpp):
- store_masked: an exact-half prefix/suffix is one plain 128-bit store; a
boundary-crossing prefix stores the lower half plain and delegates only
the upper remainder, so no shape emits vmaskmov.
- load_masked: stay in the value domain so half-confined prefixes reach
the sse2 kernels (vmovss/vmovq/vmovlps/vmovsd); an exact-half prefix or
suffix is one plain 128-bit load. Only boundary-crossing shapes keep the
single 256-bit vmaskmov load (1 uop, no hazard). detail::zero_extend_lo
uses _mm256_zextps128_ps256 (no instruction).
AVX2 int (xsimd_avx2_128.hpp):
- Gate the integer kernels on detail::lowers_to_plain_moves and delegate
half-confined shapes to the sse2 float/double kernels via an
int->same-width-float bitcast, mirroring the float sibling. Non-plain
masks keep the native vpmaskmov path.
Previously float prefix<2> loads lowered to mask constant + vpmaskmovd +
zero-extend copy (integer domain feeding float FMA); now one vmovq.
Measured in FINUFFT spread/interp tails (Meteor Lake AVX2, paired A/B):
the vpmaskmov+copy form cost 1.5-2% end to end; plain moves are neutral
vs hand-rolled narrow loads.1 parent 4bb4fe4 commit 171349b
2 files changed
Lines changed: 74 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
985 | 985 | | |
986 | 986 | | |
987 | 987 | | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
988 | 1001 | | |
989 | 1002 | | |
990 | 1003 | | |
| |||
1021 | 1034 | | |
1022 | 1035 | | |
1023 | 1036 | | |
1024 | | - | |
1025 | 1037 | | |
1026 | | - | |
| 1038 | + | |
| 1039 | + | |
1027 | 1040 | | |
1028 | | - | |
1029 | | - | |
| 1041 | + | |
| 1042 | + | |
1030 | 1043 | | |
1031 | | - | |
1032 | | - | |
1033 | | - | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
1034 | 1058 | | |
1035 | 1059 | | |
1036 | 1060 | | |
| |||
1076 | 1100 | | |
1077 | 1101 | | |
1078 | 1102 | | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
1079 | 1125 | | |
1080 | | - | |
| 1126 | + | |
1081 | 1127 | | |
1082 | 1128 | | |
1083 | 1129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
| 144 | + | |
| 145 | + | |
145 | 146 | | |
146 | 147 | | |
147 | 148 | | |
148 | 149 | | |
149 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
150 | 159 | | |
151 | 160 | | |
152 | 161 | | |
153 | 162 | | |
154 | 163 | | |
155 | 164 | | |
156 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
157 | 174 | | |
158 | 175 | | |
159 | 176 | | |
| |||
0 commit comments