Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Range operator lowering minimizer #1004

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

frank-wei
Copy link
Contributor

Summary:
During our perf tuning, we are seeing mtml_instagram_model lag behind AIT around 23% on mergenet (525662456/1670)
How do we compare the perf between AIT and AOTI? Refering the idea from Oleg, I tried to implement a minimizer leveraging acc tracer + fx splitter. It is good these two backend still can use the same acc tracer so we can make sure the front end graphs are exactly the same. Then we can leverage the splitter to define a range of operator to lower. In this way, we can directly compare the perf of a small subgraph between these two backends.

How to use it?

  1. attach --debug_operator_range="0, 100" randomly and you will see graph nodes printed out in log

  1. attach the precise range you want. For ex, --debug_operator_range="1613,1635" and you will see logs like this
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_122 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_124 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_125 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_126 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_127 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_128 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_129 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_130 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_131 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_132 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_133 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_134 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_135 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_136 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_137 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_138 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_139 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_140 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_141 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_142 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_143 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_144 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_145 to selected nodes

Differential Revision: D57030900

Summary:
During our perf tuning, we are seeing mtml_instagram_model lag behind AIT around 23% on mergenet (525662456/1670)
How do we compare the perf between AIT and AOTI? Refering the idea from Oleg, I tried to implement a minimizer leveraging acc tracer + fx splitter. It is good these two backend still can use the same acc tracer so we can make sure the front end graphs are exactly the same. Then we can leverage the splitter to define a range of operator to lower. In this way, we can directly compare the perf of a small subgraph between these two backends.

How to use it?
1) attach --debug_operator_range="0, 100" randomly and you will see graph nodes printed out in log
```

```

2) attach the precise range you want. For ex, --debug_operator_range="1613,1635" and you will see logs like this
```
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_122 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_124 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_125 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_126 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_127 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_128 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_129 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_130 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_131 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_132 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_133 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_134 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_135 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_136 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_137 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_138 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_139 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_140 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_141 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_142 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_143 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_144 to selected nodes
INFO:fx2ait.ait_splitter:Add n.op=call_function, n.target=<function linear at 0x7f01014a7b50>, n.name=linear_145 to selected nodes
```

Differential Revision: D57030900
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 7, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57030900

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants