Commit 4339c2f
committed
feat: solver-aware canonicalization for Z3 AVX intrinsics
AVX instructions like vpermd only use a subset of bits from their
control operands (e.g., 3 bits out of 32 per lane). Z3 treats the
unused bits as free variables, causing the solver to enumerate
functionally-identical solutions that differ only in don't-care bits.
Every z3_avx function that has don't-care bits now requires a Solver
parameter and adds constraints zeroing unused bits:
- _generic_permutexvar: index bits per lane
- _generic_permutex2var: offset + source selector bits per lane
- _generic_permutevar: control bits per lane (ps: 2, pd: 1)
- _generic_blendv: sign bit only per lane
- _generic_blend: element count bits of imm8
- _shuffle_pd_generic: lane count * 2 bits of imm8
- _permute_pd_generic: bits [1:0] of imm8
- _select4_128b: bit 2 unused per control nibble
- _generic_alignr: shift bits of imm8
The solver from synthesize_gadget_with_symbolic flows through
_evaluate -> _dispatch_intrinsic_by_signature -> z3_avx functions.
Uses inspect.signature (cached via lru_cache) to detect which
intrinsics accept the solver parameter.1 parent 9d5f18d commit 4339c2f
File tree
4 files changed
+669
-249
lines changed- vxsort/smallsort/codegen
- src
- tests
4 files changed
+669
-249
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
237 | 239 | | |
238 | 240 | | |
239 | 241 | | |
240 | | - | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
241 | 252 | | |
242 | 253 | | |
| 254 | + | |
| 255 | + | |
243 | 256 | | |
244 | 257 | | |
245 | 258 | | |
246 | | - | |
| 259 | + | |
247 | 260 | | |
248 | 261 | | |
249 | 262 | | |
250 | 263 | | |
251 | 264 | | |
252 | 265 | | |
253 | | - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
254 | 269 | | |
255 | 270 | | |
256 | 271 | | |
| |||
539 | 554 | | |
540 | 555 | | |
541 | 556 | | |
542 | | - | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
543 | 564 | | |
544 | 565 | | |
545 | | - | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
546 | 573 | | |
547 | 574 | | |
548 | 575 | | |
| |||
720 | 747 | | |
721 | 748 | | |
722 | 749 | | |
| 750 | + | |
723 | 751 | | |
724 | 752 | | |
725 | 753 | | |
| |||
751 | 779 | | |
752 | 780 | | |
753 | 781 | | |
754 | | - | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
755 | 789 | | |
756 | 790 | | |
757 | | - | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
758 | 800 | | |
759 | 801 | | |
760 | 802 | | |
| |||
776 | 818 | | |
777 | 819 | | |
778 | 820 | | |
779 | | - | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
780 | 828 | | |
781 | | - | |
| 829 | + | |
782 | 830 | | |
783 | 831 | | |
784 | 832 | | |
| |||
1092 | 1140 | | |
1093 | 1141 | | |
1094 | 1142 | | |
1095 | | - | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
1096 | 1146 | | |
1097 | 1147 | | |
1098 | 1148 | | |
| |||
0 commit comments