-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[Tracking Issue] BufferAccess Migration Followup Items #10505
Comments
Can we remove |
Let us first finish the items, streamline changes and likely remove load/store in next release. So we have sufficent timewindow and error message for people to react |
Part of tracking issue apache#10505, restrict multi-lane indexing to at most one index per buffer access. This removes ambiguity as an expression such as `A[T.ramp(i,1,2), T.ramp(j,1,2)]`, which could be interpreted either as `[A[i,j], A[i+1,j+1]]` or as `[A[i,j], A[i,j+1], A[i+1,j], A[i+1,j+1]]`, depending on whether the implied iterators of the two ramp nodes are shared.
Part of tracking issue apache#10505, restrict multi-lane indexing to at most one index per buffer access. This removes ambiguity as an expression such as `A[T.ramp(i,1,2), T.ramp(j,1,2)]`, which could be interpreted either as `[A[i,j], A[i+1,j+1]]` or as `[A[i,j], A[i,j+1], A[i+1,j], A[i+1,j+1]]`, depending on whether the implied iterators of the two ramp nodes are shared.
I agree with adding additional restrictions. I've created draft PRs #10512 and #10513, to test the impact of different rules on existing test cases. Each requires that only a single index can have multiple lanes, while #10513 additional requires that to be the last index. @tqchen After thinking on your comment here, I agree that if there are no issues introduced by using the stricter restriction, we should use it, as we can also loosen the condition later if needed. |
Thanks for the great efforts! Here is my question: Whether we will have some SSA (or no-alias?) property on |
@wrongtest great point. I agree it is important to summarize the aliasing property. @vinx13 perhaps can add more comments on this |
While Buffers should not alias each other unless necessary, because aliased buffers increase complexity for TIR transformations. Passes that rewrite buffers should clearly indicate how aliased buffers are handled. For example, when changing the underlying layout of stored elements in a buffer, all buffer aliases must also be updated. While buffer aliasing is typically free at runtime, this imposes a cost for buffer aliasing both to compile times and development complexity. We should also extend |
Both PRs for testing indexing restrictions, #10512 and #10513, have passed CI. I think I agree with the tighter restriction, that only the last index may have more than one lane. While there are cases where a ramp index in an earlier lane could be transformed into a ramp index in the last lane, those would be relatively rare, as it would require a ramp index to be present in user-defined calls. I have closed #10512, and converted #10513 from a draft PR to an open PR. |
Thanks @Lunderberg , if @vinx13 you also agree, can you review and merge #10513? |
Since |
) * [TIR] Restirct Buffer indices, only last index can be multi-lane Part of tracking issue #10505, restrict multi-lane indexing to at most one index per buffer access. This removes ambiguity as an expression such as `A[T.ramp(i,1,2), T.ramp(j,1,2)]`, which could be interpreted either as `[A[i,j], A[i+1,j+1]]` or as `[A[i,j], A[i,j+1], A[i+1,j], A[i+1,j+1]]`, depending on whether the implied iterators of the two ramp nodes are shared. * Improved readability based on review suggestions. * Resolve lint error.
Also related to I have the proposed changes in #10816 , which should maintain backwards compatibility on the python API, and for constructor calls to |
Thanks @Lunderberg , it would be great to deliberate on the choice of |
Following some debugging with @areusch on an issue caused by |
@Lunderberg this also relates to apache/tvm-rfcs#63 where we can use buffer declaration to create alias, I think this should be the right way do go. Additionally, it would be great to make buffer declaration(alias creation) explicit |
Thank you, and I feel silly for forgetting RFC#63 after the draft discussions, and definitely agreed on the explicit aliasing being a better option for the long term. |
…che#10513) * [TIR] Restirct Buffer indices, only last index can be multi-lane Part of tracking issue apache#10505, restrict multi-lane indexing to at most one index per buffer access. This removes ambiguity as an expression such as `A[T.ramp(i,1,2), T.ramp(j,1,2)]`, which could be interpreted either as `[A[i,j], A[i+1,j+1]]` or as `[A[i,j], A[i,j+1], A[i+1,j], A[i+1,j+1]]`, depending on whether the implied iterators of the two ramp nodes are shared. * Improved readability based on review suggestions. * Resolve lint error.
As part of the follow-up (and as part of RFC#70), PR #10940 has now landed, removing the pre-flattened buffer map. The (And updated the tracking issue's checklist.) |
This is a tracking issue created for followup tracking items in #9727.
The particular PR contains an important new feature(transform_layout). The main goal of this issue is to do followup shepherding around the IR change part(buffer access and related allocations), which have a broader impact. The particular PR takes many rounds of reviews and but still have quite a few points that would benefit from systematic clarification, cleanup and further polish.
Given that there is an important followup(of layout transform) that depend on the change, and the PR is already at a state where incremental changes can further block the progress as other concurrent changes are made. We took the deliberation to merge PR, then continue to do post-hoc shepherding. This decision is supposed to happen in rare circumstance with clear followup actions to backup the decisions.
This is the tracking issue for followup shepherd actions
High-level gist of change
Load/Store are deprecated and changes to BufferLoad/Store of 1D array. BufferLoad/Store of 1D elements are being used in the place of Load/Store. Overall this is a good directly as we unify more analysis onto the (possibly multi-dimensional) buffer access, opens doors for special memory unit that are in nature multi-dimensional.
However, we do need more clarifications and systematic review/cleanup (see check list).
Check List
preflatten_buffer_map
(possible via buffer redeclaration)address_of
, ideally to 1D acesscc @Hzfengsy @junrushao
The text was updated successfully, but these errors were encountered: