[bug] Fix the mapping from virtual axes to physical axes again #3170
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related issue = #3154
In Taichi docs, there is a subsection introducing row-major vs column-major dense layouts:
taichi/docs/lang/articles/advanced/layout.md
Line 87 in 801f7bd
However, in Taichi v0.8.1,
is equivalent to
The reason is that virtual axes (user-view) are set according to the appearance order in SNode definition of physical axes (
ti.i
,ti.j
, ... in the physical world). In the first example, the first axis in user-view isti.j
, and the second axis isti.i
, while in the second example, the first axis isti.i
, and the second axis isti.j
. Now comes the tricky thing - as for the memory layouts, in the first example we splitti.j
first, and in the second example we splitti.i
first. That is, the major axes in layouts are the same as the first axes in user-view. So essentially there is no user-viable difference between these two examples, which breaks the docs.This PR, together with #3159, fixes this issue by setting virtual axes according to the alphabetical order of physical axes. Now in both examples, the first axis in user-view is
ti.i
, and the second axis in user-view isti.j
. Then the column-major layout is finally created in the first example.