-
Notifications
You must be signed in to change notification settings - Fork 65
Define the EXPERIMENTAL_PREFER_TRACING flag and the traceable option | feat(torchlib) #1176
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
Conversation
Signed-off-by: Justin Chu <[email protected]> [ghstack-poisoned]
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1176 +/- ##
==========================================
+ Coverage 78.67% 78.71% +0.03%
==========================================
Files 118 118
Lines 15334 15348 +14
Branches 2392 2394 +2
==========================================
+ Hits 12064 12081 +17
+ Misses 2876 2873 -3
Partials 394 394 ☔ View full report in Codecov by Sentry. |
…g and the traceable option | feat(torchlib)" As an effort described in #1095, this PR - adds an experimental `TORCHLIB_EXPERIMENTAL_PREFER_TRACING` flag to allow the tracer to trace a function when possible. - defined the `traceable` option in the torch_op decorator to mark a function as `traceable`. [ghstack-poisoned]
…ble option | feat(torchlib)" As an effort described in #1095, this PR - adds an experimental `TORCHLIB_EXPERIMENTAL_PREFER_TRACING` flag to allow the tracer to trace a function when possible. - defined the `traceable` option in the torch_op decorator to mark a function as `traceable`. [ghstack-poisoned]
@@ -112,6 +113,7 @@ def torch_op( | |||
private: Whether the function is private (not directly exposed). It should | |||
be true for all functions with names starting with "_". | |||
complex: Whether the function expects complex-valued inputs. | |||
traceable: Whether the function can be traced. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this comment. Could you elaborate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A function is traceable if it can both be scripted and traced and produce the same result for a given input. Does that sound reasonable? I will add this to the docstring if it does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- A function can be tagged with traceable if its if branches (if any) can be statically evaluated.
- A function should be tagged with traceable if it contains if branches and/or CastLike nodes so that they can be evaluated away with the
EXPERIMENTAL_PREFER_TRACING
on. - A function without if branches or CastLike nodes should not be tagged with traceable because inlining will do the same thing.
- A function with
@graph
defined for aScan
op is not traceable yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any chance one could wrongly tag a function traceable, and create a bug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a chance. We should be able to catch them in the op info tests.
…g and the traceable option | feat(torchlib)" As an effort described in #1095, this PR - adds an experimental `TORCHLIB_EXPERIMENTAL_PREFER_TRACING` flag to allow the tracer to trace a function when possible. - defined the `traceable` option in the torch_op decorator to mark a function as `traceable`. [ghstack-poisoned]
…ble option | feat(torchlib)" As an effort described in #1095, this PR - adds an experimental `TORCHLIB_EXPERIMENTAL_PREFER_TRACING` flag to allow the tracer to trace a function when possible. - defined the `traceable` option in the torch_op decorator to mark a function as `traceable`. [ghstack-poisoned]
…g and the traceable option | feat(torchlib)" As an effort described in #1095, this PR - adds an experimental `TORCHLIB_EXPERIMENTAL_PREFER_TRACING` flag to allow the tracer to trace a function when possible. - defined the `traceable` option in the torch_op decorator to mark a function as `traceable`. [ghstack-poisoned]
…ble option | feat(torchlib)" As an effort described in #1095, this PR - adds an experimental `TORCHLIB_EXPERIMENTAL_PREFER_TRACING` flag to allow the tracer to trace a function when possible. - defined the `traceable` option in the torch_op decorator to mark a function as `traceable`. [ghstack-poisoned]
…g and the traceable option | feat(torchlib)" As an effort described in #1095, this PR - adds an experimental `TORCHLIB_EXPERIMENTAL_PREFER_TRACING` flag to allow the tracer to trace a function when possible. - defined the `traceable` option in the torch_op decorator to mark a function as `traceable`. [ghstack-poisoned]
…ble option | feat(torchlib)" As an effort described in #1095, this PR - adds an experimental `TORCHLIB_EXPERIMENTAL_PREFER_TRACING` flag to allow the tracer to trace a function when possible. - defined the `traceable` option in the torch_op decorator to mark a function as `traceable`. [ghstack-poisoned]
…g and the traceable option | feat(torchlib)" As an effort described in #1095, this PR - adds an experimental `TORCHLIB_EXPERIMENTAL_PREFER_TRACING` flag to allow the tracer to trace a function when possible. - defined the `traceable` option in the torch_op decorator to mark a function as `traceable`. [ghstack-poisoned]
…ble option | feat(torchlib)" As an effort described in #1095, this PR - adds an experimental `TORCHLIB_EXPERIMENTAL_PREFER_TRACING` flag to allow the tracer to trace a function when possible. - defined the `traceable` option in the torch_op decorator to mark a function as `traceable`. [ghstack-poisoned]
…g and the traceable option | feat(torchlib)" As an effort described in #1095, this PR - adds an experimental `TORCHLIB_EXPERIMENTAL_PREFER_TRACING` flag to allow the tracer to trace a function when possible. - defined the `traceable` option in the torch_op decorator to mark a function as `traceable`. [ghstack-poisoned]
…ble option | feat(torchlib)" As an effort described in #1095, this PR - adds an experimental `TORCHLIB_EXPERIMENTAL_PREFER_TRACING` flag to allow the tracer to trace a function when possible. - defined the `traceable` option in the torch_op decorator to mark a function as `traceable`. [ghstack-poisoned]
…t(torchlib) (#1180) Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom): * #1178 * #1177 * #1176 * __->__ #1180 ### Changes - Create env to test with TORCHLIB_EXPERIMENTAL_PREFER_TRACING on - Test with Python 3.11 as well - Fixes #1061 - Fix aten::any.dims and aten::all.dims
…g and the traceable option | feat(torchlib)" As an effort described in #1095, this PR - adds an experimental `TORCHLIB_EXPERIMENTAL_PREFER_TRACING` flag to allow the tracer to trace a function when possible. - defined the `traceable` option in the torch_op decorator to mark a function as `traceable`. [ghstack-poisoned]
…ble option | feat(torchlib)" As an effort described in #1095, this PR - adds an experimental `TORCHLIB_EXPERIMENTAL_PREFER_TRACING` flag to allow the tracer to trace a function when possible. - defined the `traceable` option in the torch_op decorator to mark a function as `traceable`. [ghstack-poisoned]
Will merge now. LMK if I should create follow ups |
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom): * #1178 * __->__ #1177 * #1176 As an effort described in #1095, this PR marks functions with if branches as traceable.
Stack from ghstack (oldest at bottom):
As an effort described in #1095, this PR
TORCHLIB_EXPERIMENTAL_PREFER_TRACING
flag to allow the tracer to trace a function when possible.traceable
option in the torch_op decorator to mark a function astraceable
.