-
Notifications
You must be signed in to change notification settings - Fork 24.9k
[DRAFT] Evaluate feasability of using FunctionalTensor for Example Value #155606
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
base: main
Are you sure you want to change the base?
Conversation
853dce0
to
a86b126
Compare
fa32d14
to
50d5189
Compare
776779f
to
42df2fe
Compare
42df2fe
to
885557f
Compare
@@ -3245,7 +3246,7 @@ def get_fake_value(node, tx, allow_non_graph_fake=False): | |||
) | |||
|
|||
try: | |||
with tx.fake_mode, enable_python_dispatcher(): | |||
with tx.functional_mode, tx.fake_mode, enable_python_dispatcher(): |
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.
run_node has issues here for self.bn
- namely, several lines above we perform a deep copy on the nnmodule for BatchNorm (
pytorch/torch/_dynamo/utils.py
Line 3234 in 12b0213
nnmodule = deepcopy_to_fake_tensor(nnmodule, tx.fake_mode) |
There are seemingly two conflicting things here:
- the
example_value
in node extracted here needs to be functional to record potential mutations when running the node, and a functional tensor can only be acted on by other functional tensors - the
deep copy
linked above does not support functional tensors for the Parameter's (such as running_mean) as the torch__dispatch__ does not support Parameter types
So the seeming solution would be to enable deep copy on Parameter type for functional tensors, but since these are parameters aren't they inheritly stateful?
585c463
to
638a21c
Compare
c6fa6cf
to
a9806f5
Compare
|
b92f98d
to
229a574
Compare
229a574
to
9cee5f7
Compare
WIP - gathering initial signals
To replace one view and mutation metadata pass
Key test:
These 4 cases we were most concerned with can be ran with
Results in
Sample failure:
Like
cc @H-Huang @awgu @wanchaol @fegin @fduwjj @wz337 @wconstab @d4l3k @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @jerryzh168 @gujinghui @PenghuiCheng @jianyuh @min-jean-cho @yanbing-j @Guobing-Chen @Xia-Weiwen @snadampal @mcarilli @ptrblck @leslie-fang-intel @EikanWang @voznesenskym @penguinwu @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @chenyang78 @kadeng @muchulee8 @amjames @chauhang @aakhundov