-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Mutate free variables in CommReducer in cache_write #2354
Conversation
f21422d
to
be80e43
Compare
Thanks, @vinx13 can you please add a regression test case, as per https://docs.tvm.ai/contribute/code_review.html#ensure-test-coverage |
@tqchen If variables from the outer loop are allowed in |
I agree with @sgrechanik-h this is something that needs discussion. The question is whether we should always restrict CommReducer to be pure function or allow it to be a closure, I do agree that maybe having a pure function restriction makese sense. Thanks for pointing this out. As a followup to this, maybe a proper change would be have checks that restricts CommReducer to be pure and report error properly. |
I'm not sure, I guess there must be a practical example where a combiner using an outer loop variable is necessary, since @vinx13 started to fix it. On the other hand, in some cases such dependencies may be expressed with tuple inputs if CommReducer's purity is important. |
@sgrechanik-h |
VarReplacer in cache_write should mutate combiner of Reduce expression because CommReducer may contain free variables from outer loop.
see https://discuss.tvm.ai/t/cache-write-does-not-replace-vars-in-reducer-identity/1402
cc @tqchen