Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Bug] [opt] [doc] Fix OffsetAndExtractBitsStmt optimization and impro…
…ve documentation on virtual/physical indices (#1259)
- Loading branch information
1 parent
ca81fdf
commit 7738915
Showing
6 changed files
with
88 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import taichi as ti | ||
|
||
|
||
@ti.host_arch_only | ||
def test_indices(): | ||
a = ti.var(ti.f32, shape=(128, 32, 8)) | ||
|
||
b = ti.var(ti.f32) | ||
ti.root.dense(ti.j, 32).dense(ti.i, 16).place(b) | ||
|
||
ti.get_runtime().materialize() | ||
|
||
mapping_a = a.snode().physical_index_position() | ||
|
||
assert mapping_a == {0: 0, 1: 1, 2: 2} | ||
|
||
mapping_b = b.snode().physical_index_position() | ||
|
||
assert mapping_b == {0: 1, 1: 0} | ||
# Note that b is column-major: | ||
# the virtual first index exposed to the user comes second in memory layout. |