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

Create utility that asserts that IRModules aren't modified in-place #11372

Closed
areusch opened this issue May 19, 2022 · 2 comments
Closed

Create utility that asserts that IRModules aren't modified in-place #11372

areusch opened this issue May 19, 2022 · 2 comments

Comments

@areusch
Copy link
Contributor

areusch commented May 19, 2022

Background: In TVM, the IRModule data structure is intended to be immutable. This is a property which unfortunately can't be enforced by a C++ language construct such as const because it is perceived to be too big of a hammer for that problem (I think one of the core challenges is that due to pointers, it's too difficult to propagate const through generic data structures such as Map). Instead, we have to enforce this through convention of not implementing functions on IR data structures which may mutate them.

We are pretty good about this but unfortunately definitely not perfect. We could use a backstop here to provide us a guarantee, in test, that a pass doesn't mutate an IRModule but instead creates a copy wherever state is changed. This task captures writing that test utility.

@areusch
Copy link
Contributor Author

areusch commented May 19, 2022

@gigiblender may take a look at this

@gigiblender
Copy link
Contributor

#11498

@areusch areusch closed this as completed Jun 2, 2022
Lunderberg added a commit to Lunderberg/mlc-llm that referenced this issue Feb 14, 2024
A pass must not mutate the `IRModule` that it receives as input.
Unlike most functions exposed through the python API, the
`IRModule.__setitem__` method mutates the underlying `IRModuleNode`.
This can impact other users of the shared `IRModule` object, which
expect mutation to be done using copy-on-write.

See apache/tvm#11372 for more details.
MasterJH5574 pushed a commit to mlc-ai/mlc-llm that referenced this issue Feb 14, 2024
A pass must not mutate the `IRModule` that it receives as input.
Unlike most functions exposed through the python API, the
`IRModule.__setitem__` method mutates the underlying `IRModuleNode`.
This can impact other users of the shared `IRModule` object, which
expect mutation to be done using copy-on-write.

See apache/tvm#11372 for more details.
Lunderberg added a commit to octoml/mlc-llm that referenced this issue Feb 15, 2024
A pass must not mutate the `IRModule` that it receives as input.
Unlike most functions exposed through the python API, the
`IRModule.__setitem__` method mutates the underlying `IRModuleNode`.
This can impact other users of the shared `IRModule` object, which
expect mutation to be done using copy-on-write.

See apache/tvm#11372 for more details.
Lunderberg added a commit to octoml/mlc-llm that referenced this issue Feb 15, 2024
A pass must not mutate the `IRModule` that it receives as input.
Unlike most functions exposed through the python API, the
`IRModule.__setitem__` method mutates the underlying `IRModuleNode`.
This can impact other users of the shared `IRModule` object, which
expect mutation to be done using copy-on-write.

See apache/tvm#11372 for more details.
Lunderberg added a commit to octoml/mlc-llm that referenced this issue Feb 22, 2024
A pass must not mutate the `IRModule` that it receives as input.
Unlike most functions exposed through the python API, the
`IRModule.__setitem__` method mutates the underlying `IRModuleNode`.
This can impact other users of the shared `IRModule` object, which
expect mutation to be done using copy-on-write.

See apache/tvm#11372 for more details.
Lunderberg added a commit to octoml/mlc-llm that referenced this issue Feb 28, 2024
A pass must not mutate the `IRModule` that it receives as input.
Unlike most functions exposed through the python API, the
`IRModule.__setitem__` method mutates the underlying `IRModuleNode`.
This can impact other users of the shared `IRModule` object, which
expect mutation to be done using copy-on-write.

See apache/tvm#11372 for more details.
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