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

Serialization of psyir tree #2786

Open
schreiberx opened this issue Nov 15, 2024 · 2 comments
Open

Serialization of psyir tree #2786

schreiberx opened this issue Nov 15, 2024 · 2 comments

Comments

@schreiberx
Copy link
Collaborator

A serialization/deepcopy of a psyir tree is currently not possible.
Using copy.deepcopy on certain files leads, e.g., to this error message:

  File "[...]/src/psyclone/psyir/nodes/node.py", line 162, in _check_is_orphan
    raise GenerationError(
psyclone.errors.GenerationError: Generation Error: Item 'Reference' can't be added as child of 'Assignment' because it is not an orphan. It already has a 'Assignment' as a parent.

Allowing for this would have several advantages, e.g.,

  • The PsyIR can be cached to persistent storage and read back if required
  • The PsyIR could be deep-copied to work independently on it.
@schreiberx schreiberx changed the title Serialisation of psyir tree Serialization of psyir tree Nov 15, 2024
@arporter
Copy link
Member

A deep copy of the tree is possible and in fact is performed by the Fortran backend prior to code generation (because it has to 'flatten' the nested symbol tables). node.copy() does this.

@schreiberx
Copy link
Collaborator Author

Thanks for the clarification - I wasn't aware of this. Then it's just about the "pickle" problem.

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

2 participants