Commit ac3e1a4
authored
MLIR implementation of euclidean algorithm (#1357)
The euclidean algorithm was being built for every inverse gate in a
circuit. The aim of this PR is to improve compilation times in circuit
related contracts by reducing the MLIR size and this is done by
declaring the euclidean algorithm only once and the just calling it.
## Benchmark
The following are the compilation times it took with the `no_inline`
attribute and with an O2 optimization level. The `Before` column
contains the compilation times for the main branch
([ref](21cc66c)
-> without the optimization done in #1348), while the `After` column
contains the compilations times for this branch
([ref](b2a4a66)
-> again, without the optimization done in #1348 ). These were ran on a
MacBook Air M1 with 16 GB.
| Class Hash | Before (ms) | After (ms) | Improvement |
|------------|-------------|-----------|---------------|
|`0x1b5fbe104c033025dbb7fb37011781cc9344e881b4828cdaa023a80fecafde4` |
130730 | 110260 | 1.19x|
|`0x3100defca27214e5f78f25e48a5b05e45899c6834cb4d34f48384c18e14dff7` |
125509 | 107107 | 1.17x|
|`0x79666cdb4fc3cbcafbd74f4ea4e2855bf455c5a7c70915f5679325c54032771` |
123684 | 112580 | 1.10x|
|`0xa40ecaa08eaef629d433b15f6b017461df8bea9b4e7299eb8ba3632e32b5a5` |
132966 | 118622 | 1.12x|
|`0x4ffeed293927cd56686a9038a10026a2d3b9602f789d1f163c1c4ac9a822a82` |
177028 | 155397 | 1.14x|
|`0x2269858a40ea0535cb373b0c981c91b907466edf6d65bcaf669760bbee0ae4d` |
169722 | 149323 | 1.14x|
|`0x5ff378cb2f16804539ecb92e84f273aafbab57d450530e9fe8e87771705a673` |
138254 | 120414 | 1.15x|
|`0x4edde37ca59d9dff8f4ac8945b1c4860b606abd61d74727904ad7494fccdfa9` |
138312 | 120037 | 1.15x|
## Correctness
Blocks 1560000 to 1580000 were executed and no diffs were found when
comparing with the VM
## Checklist
- [ ] Linked to Github Issue
- [ ] Unit tests added
- [ ] Integration tests added.
- [ ] This change requires new documentation.
- [ ] Documentation has been added/updated.2 files changed
+215
-94
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
332 | 333 | | |
333 | 334 | | |
334 | 335 | | |
| 336 | + | |
335 | 337 | | |
336 | 338 | | |
337 | 339 | | |
| |||
475 | 477 | | |
476 | 478 | | |
477 | 479 | | |
| 480 | + | |
478 | 481 | | |
479 | 482 | | |
480 | 483 | | |
481 | 484 | | |
482 | 485 | | |
| 486 | + | |
483 | 487 | | |
484 | 488 | | |
485 | 489 | | |
| |||
638 | 642 | | |
639 | 643 | | |
640 | 644 | | |
641 | | - | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
642 | 651 | | |
| 652 | + | |
643 | 653 | | |
644 | 654 | | |
645 | | - | |
646 | 655 | | |
647 | 656 | | |
648 | 657 | | |
649 | | - | |
650 | | - | |
651 | | - | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
652 | 673 | | |
653 | 674 | | |
654 | 675 | | |
| |||
1037 | 1058 | | |
1038 | 1059 | | |
1039 | 1060 | | |
1040 | | - | |
1041 | | - | |
1042 | | - | |
1043 | | - | |
1044 | | - | |
1045 | | - | |
1046 | | - | |
1047 | | - | |
1048 | | - | |
1049 | | - | |
1050 | | - | |
1051 | | - | |
1052 | | - | |
1053 | | - | |
1054 | | - | |
1055 | | - | |
1056 | | - | |
1057 | | - | |
1058 | | - | |
1059 | | - | |
1060 | | - | |
1061 | | - | |
1062 | | - | |
1063 | | - | |
1064 | | - | |
1065 | | - | |
1066 | | - | |
1067 | | - | |
1068 | | - | |
1069 | | - | |
1070 | | - | |
1071 | | - | |
1072 | | - | |
1073 | | - | |
1074 | | - | |
1075 | | - | |
1076 | | - | |
1077 | | - | |
1078 | | - | |
1079 | | - | |
1080 | | - | |
1081 | | - | |
1082 | | - | |
1083 | | - | |
1084 | | - | |
1085 | | - | |
1086 | | - | |
1087 | | - | |
1088 | | - | |
1089 | | - | |
1090 | | - | |
1091 | | - | |
1092 | | - | |
1093 | | - | |
1094 | | - | |
1095 | | - | |
1096 | | - | |
1097 | | - | |
1098 | | - | |
1099 | | - | |
1100 | | - | |
1101 | | - | |
1102 | | - | |
1103 | | - | |
1104 | | - | |
1105 | | - | |
1106 | | - | |
1107 | | - | |
1108 | | - | |
1109 | | - | |
1110 | | - | |
1111 | | - | |
1112 | | - | |
1113 | | - | |
1114 | | - | |
1115 | | - | |
1116 | | - | |
1117 | | - | |
1118 | | - | |
1119 | | - | |
1120 | | - | |
1121 | 1061 | | |
1122 | 1062 | | |
1123 | 1063 | | |
| |||
0 commit comments