pytorch
57b22bc6 - [Dynamo] Backend registration with ``entry_points`` (#93873)

Commit
1 year ago
[Dynamo] Backend registration with ``entry_points`` (#93873) Fixes #91824 This PR add a new dynamo backend registration mechanism through ``entry_points``. The ``entry_points`` of a package is provides a way for the package to reigster a plugin for another one. The docs of the new mechanism: ![image](https://user-images.githubusercontent.com/23381083/216133221-18cf18e2-6ad6-4cf7-8da2-9b9b883389c8.png) (the typo '...named "my_backend" that has been..." has been fixed to '...named "my_compiler" that has been...') # Discussion ## About the test I did not add a test for this PR as it is hard either to install a fack package during a test or manually hack the entry points function by replacing it with a fake one. I have tested this PR offline with the hidet compiler and it works fine. Please let me know if you have any good idea to test this PR. ## About the dependency of ``importlib_metadata`` This PR will add a dependency ``importlib_metadata`` for the python < 3.10 because the modern usage of ``importlib`` gets stable at this python version (see the documentation of the importlib package [here](https://docs.python.org/3/library/importlib.html)). For python < 3.10, the package ``importlib_metadata`` implements the feature of ``importlib``. The current PR will hint the user to install this ``importlib_metata`` if their python version < 3.10. ## About the name and docs Please let me know how do you think the name ``torch_dynamo_backend`` as the entry point group name and the documentation of this registration mechanism. Pull Request resolved: https://github.com/pytorch/pytorch/pull/93873 Approved by: https://github.com/malfet, https://github.com/jansel
Author
Committer
Parents
Loading