[ONNX] Update 'Functionalize' pass to support pre-decomp graph; Drop 'aten_graph' arg for 'DynamoExporter' (#99667)
Summary
- Previously this was required by and entangled with `tracing_mode=symbolic` for `dynamic` tracing.
That is resolved by #99555 and its follow ups.
- Later decomposition pass will do graph lowering, so this step is duplicated.
- Updated `Functionalization` to workaround https://github.com/pytorch/pytorch/issues/99774#issuecomment-1527949391
Todo
- Training vs eval in dynamo_export
So we are effectively exporting all models in traning mode by
default. But for the sake of this export we are only interested in eval mode.
The question is, should we call `model.eval()` in `dynamo_export`?
Tests with model containing batch norm fails 'functionalization' in training mode.
We are explicitly calling `model.eval()` for these model for now.
- Merge decomp and functionalize pass. Both calls into `make_fx`.
Merging potentially increases performance. However it is unclear
if it will result in different behavior.
Fixes #99662. (For the functionalization issue. Still need missing op support.)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/99667
Approved by: https://github.com/titaiwangms