- Notifications
You must be signed in to change notification settings - Fork26.3k
Commit863d0eb
Optimize Triton template heuristics (#170444)
Summary:This diff contains three small optimizations:1) Directly cache the triton Config object import. Not a huge win, but measurably faster than relying on importlib's cache.2) Only copy configs when the new value is different from the old one. Configs are fairly large objects, so unneccesary dict copies get expensive.3) Replace `gcd(k, BLOCK_K) == BLOCK_K` with `(k % BLOCK_K) == 0`. This is equivalent when `BLOCK_K > 0`, which must be true.Test Plan:```tlp buck run mode/opt //scripts/paulzhan:repro```and then looking at perfetto.Differential Revision: D88415189Pull Requestresolved:#170444Approved by:https://github.com/PaulZhang12,https://github.com/eellison,https://github.com/shunting3141 parentc047f39 commit863d0eb
File tree
2 files changed
+48
-23
lines changed- test/inductor
- torch/_inductor/template_heuristics
2 files changed
+48
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2283 | 2283 | | |
2284 | 2284 | | |
2285 | 2285 | | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
2286 | 2305 | | |
2287 | 2306 | | |
2288 | 2307 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
48 | 51 | | |
49 | 52 | | |
50 | 53 | | |
| |||
625 | 628 | | |
626 | 629 | | |
627 | 630 | | |
628 | | - | |
629 | | - | |
630 | | - | |
631 | | - | |
632 | | - | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | | - | |
637 | | - | |
638 | | - | |
639 | | - | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
640 | 651 | | |
641 | 652 | | |
642 | 653 | | |
| |||
753 | 764 | | |
754 | 765 | | |
755 | 766 | | |
756 | | - | |
757 | | - | |
758 | 767 | | |
759 | 768 | | |
760 | 769 | | |
| |||
1667 | 1676 | | |
1668 | 1677 | | |
1669 | 1678 | | |
1670 | | - | |
1671 | | - | |
1672 | | - | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
1673 | 1682 | | |
1674 | 1683 | | |
1675 | 1684 | | |
1676 | 1685 | | |
1677 | 1686 | | |
1678 | 1687 | | |
1679 | | - | |
1680 | | - | |
1681 | | - | |
1682 | | - | |
1683 | | - | |
1684 | | - | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
1685 | 1691 | | |
1686 | 1692 | | |
1687 | 1693 | | |
| |||
0 commit comments
Comments
(0)