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

Add support for Python 3.9 #33

Closed
jansel opened this issue Mar 11, 2022 · 4 comments
Closed

Add support for Python 3.9 #33

jansel opened this issue Mar 11, 2022 · 4 comments
Assignees

Comments

@jansel
Copy link
Contributor

jansel commented Mar 11, 2022

The process for adding support for Python 3.9 is as follows.

First, examine the 10 new bytecodes in 3.9:

RERAISE
raising exceptions is currently not supported and breaks the graph. So this can just call unimplemented() for now. See issue pytorch/pytorch#93720 for more on exceptions.

WITH_EXCEPT_START
might affect support for with no_grad(): and related ops

LOAD_ASSERTION_ERROR
LIST_TO_TUPLE
LIST_EXTEND
SET_UPDATE
DICT_UPDATE
DICT_MERGE
IS_OP
CONTAINS_OP
these are all simple aliases for things TorchDynamo already supports and should be easy to handle

Next, update the versions supported in setup.py so the build works.

Next, iteratively add support for ops and fix issues until all tests pass. pytest tests to run tests.

Next, iteratively fix issues in ./torchbench.py until all models pass and match the coverage of Python 3.8

@jansel
Copy link
Contributor Author

jansel commented Mar 28, 2022

Looks like 3.9 also added
_PyInterpreterState_SetEvalFrameFunc https://docs.python.org/dev/c-api/init.html#c._PyInterpreterState_SetEvalFrameFunc
and added a new PyThreadState *tstate arg to the the eval_frame function:
https://docs.python.org/dev/c-api/init.html#c._PyFrameEvalFunction

Both of those will require changes to _eval_frame.c

@jansel
Copy link
Contributor Author

jansel commented Mar 28, 2022

@hsrussell is taking a look at this one

@jansel
Copy link
Contributor Author

jansel commented Mar 31, 2022

def LIST_TO_TUPLE(self, inst):
   self.push(BuiltinVariable(tuple).call_function(self, [self.pop()], {}))

@yanboliang
Copy link
Contributor

Fixed by #154

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants