|
418 | 418 | ; ((union e (GammaF c (FMul a x) (FMul b y))))) |
419 | 419 |
|
420 | 420 | ; Hoisting common factors OUT of GammaF - ONE-DIRECTIONAL |
421 | | -(rule ((= e (GammaF c (FAdd x a) (FAdd x b)))) |
422 | | - ((union e (FAdd x (GammaF c a b))))) |
423 | | -(rule ((= e (GammaF c (FMul x a) (FMul x b)))) |
424 | | - ((union e (FMul x (GammaF c a b))))) |
| 421 | +; DISABLED: GammaF hoisting for FAdd/FMul/FDiv causes egraph explosion on mouse-shader. |
| 422 | +; New FMul/FDiv/GammaF nodes feed back into floating-point rules (reciprocals, negation |
| 423 | +; distribution, select absorption) and other GammaF distribution rules, creating a |
| 424 | +; multi-way amplification loop. FMul: 73K matches, FDiv: 1.37M matches at iter 6. |
| 425 | +; FAdd not flagged yet but has identical feedback structure via FAdd associativity. |
| 426 | +; (rule ((= e (GammaF c (FAdd x a) (FAdd x b)))) |
| 427 | +; ((union e (FAdd x (GammaF c a b))))) |
| 428 | +; (rule ((= e (GammaF c (FMul x a) (FMul x b)))) |
| 429 | +; ((union e (FMul x (GammaF c a b))))) |
425 | 430 |
|
426 | 431 | ; ============================================================================= |
427 | 432 | ; Theta (Loop) Optimization Rules - ONE-DIRECTIONAL |
|
762 | 767 |
|
763 | 768 | ; Division operations: select(c, a / x, b / x) = select(c, a, b) / x - ONE-DIRECTIONAL |
764 | 769 | ; Integer division uses GammaI |
| 770 | +; NOTE: Integer GammaI hoisting rules are kept because integer arithmetic lacks the |
| 771 | +; associativity and reciprocal rules that amplify the float explosion. Monitor if |
| 772 | +; integer-heavy shaders cause similar issues (see floating_point.egg factoring notes). |
765 | 773 | (rule ((= e (GammaI c (SDiv a x) (SDiv b x)))) |
766 | 774 | ((union e (SDiv (GammaI c a b) x)))) |
767 | 775 | (rule ((= e (GammaI c (UDiv a x) (UDiv b x)))) |
768 | 776 | ((union e (UDiv (GammaI c a b) x)))) |
769 | 777 | ; Float division uses GammaF |
770 | | -(rule ((= e (GammaF c (FDiv a x) (FDiv b x)))) |
771 | | - ((union e (FDiv (GammaF c a b) x)))) |
| 778 | +; DISABLED: See FMul/FAdd hoisting comment above. 1,167 matches at iter 6 on mouse-shader. |
| 779 | +; (rule ((= e (GammaF c (FDiv a x) (FDiv b x)))) |
| 780 | +; ((union e (FDiv (GammaF c a b) x)))) |
772 | 781 |
|
773 | 782 | ; Division with common dividend: select(c, x / a, x / b) = x / select(c, a, b) - ONE-DIRECTIONAL |
774 | 783 | (rule ((= e (GammaI c (SDiv x a) (SDiv x b)))) |
775 | 784 | ((union e (SDiv x (GammaI c a b))))) |
776 | 785 | (rule ((= e (GammaI c (UDiv x a) (UDiv x b)))) |
777 | 786 | ((union e (UDiv x (GammaI c a b))))) |
778 | | -(rule ((= e (GammaF c (FDiv x a) (FDiv x b)))) |
779 | | - ((union e (FDiv x (GammaF c a b))))) |
| 787 | +; DISABLED: See FMul/FAdd hoisting comment above. 1,370,111 matches at iter 6 on mouse-shader. |
| 788 | +; (rule ((= e (GammaF c (FDiv x a) (FDiv x b)))) |
| 789 | +; ((union e (FDiv x (GammaF c a b))))) |
780 | 790 |
|
781 | 791 | ; Remainder/modulo operations - ONE-DIRECTIONAL |
782 | 792 | ; Integer remainder/modulo uses GammaI |
|
0 commit comments