-
Notifications
You must be signed in to change notification settings - Fork 53
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
fusion should reject / error out with ambiguous in-place update semantics. #2839
Comments
Linking issue Lightning-AI/lightning-thunder#731 (comment) |
Good point. This is kind of a non-broadcast version of #2664. The solution is to have a kind of sync analysis for aliased inputs. |
Yeah, we touched that conversation a couple times. In this instance, I think it's more of a question on how we want to interpret our API. I've always view nvfuser's fusion definition is building a computational graph, rather than translating a python program. At the same time, if we are always parsing a python program, maybe the sequence is just implicit and my understanding of the protocol is wrong. |
fyi @kiya00 . The check we have in Thunder is on the conservative side and I think our assumption is that the whole fusion is done within a single kernel. Likely the sanity check is not detecting this pattern. |
I agree but I thought with aliasing we were still SSA, and the guarantee was just that we would place the result back into the aliased input after computation. That way the semantics are unambiguous since we can analyze it as an SSA program, and if the user wants to specify another behavior like using the modified |
Hi @jjsjann123 , is this going to be fixed in the nvfuser, or I need to update the sanity check to detect this? |
I agree with you and that's a reasonable protocol. Maybe we should just go with that. Our code base as-is doesn't abide to that yet. In the example above, if there is a user program, where input buffer |
Haven't got an conclusion on that yet. I don't have any actionable item for you at the moment. I'm hoping nvfuser would be able to pay some technical debts on in-place support via establishing a protocol and supporting more cases. We might need to update thunder's integration logic, but that's a longer story. I'll keep you updated. |
cc'ing @Priya2698 |
closing with Priya's recent segmentation pass #2999 |
Since we do not handle racing conditions. nvfuser's behavior of inplace update could be affected by segmentation result. A small example would be in below, if we force a segment with
segment_set
, the output from the fusion changes.I think this means that any usage of source buffer (
T0
) that's not leading to the alias target buffer (T2
) is ambiguous in nvfuser's definition and we should error out in these scenarios.But this means that we are going to give off quite some false negative cases and that might be too intrusive. We can try to update this in integration fusion logic.
The text was updated successfully, but these errors were encountered: