Skip to content
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

[Lang] Indexing for new local matrix implementation #5783

Merged
merged 108 commits into from
Sep 14, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
4ce08c8
cherrypick Matrix repr support
AD1024 Aug 15, 2022
549a359
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 15, 2022
07a4dc1
matrix assign
AD1024 Aug 15, 2022
d2264f4
Merge branch 'matrix-repr' of github.com:AD1024/taichi into matrix-repr
AD1024 Aug 15, 2022
efca3f0
move checks to caller side
AD1024 Aug 15, 2022
82c9413
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 15, 2022
38ec750
use ==
AD1024 Aug 15, 2022
13159fd
merge and format
AD1024 Aug 15, 2022
9c91103
refine impl
AD1024 Aug 17, 2022
28f3e0a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 17, 2022
bf719a3
no long in use
AD1024 Aug 17, 2022
72e8f26
Merge branch 'matrix-repr' of github.com:AD1024/taichi into matrix-repr
AD1024 Aug 17, 2022
65199ea
add some comments
AD1024 Aug 17, 2022
cbf1ea8
get rid of always-true condition
AD1024 Aug 23, 2022
4c8d6b7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 23, 2022
1a9df8c
save
AD1024 Aug 23, 2022
834699e
some fixes for print and matrix expr
AD1024 Aug 23, 2022
23d7bf7
fix codegen alloca size
AD1024 Aug 23, 2022
6a8a8cb
unsupport empty matrix
AD1024 Aug 24, 2022
08926ef
only check and cast elements
AD1024 Aug 24, 2022
1ae02aa
fmt Vectors to one line
AD1024 Aug 24, 2022
17412e8
lift duplicate part
AD1024 Aug 24, 2022
5421fe1
clean-up
AD1024 Aug 24, 2022
b9fd3a9
clean-up cse code
AD1024 Aug 24, 2022
43a456a
breaks ci; keep as original impl
AD1024 Aug 24, 2022
78ad14a
handle alloca
AD1024 Aug 24, 2022
40825f4
move checks to front
AD1024 Aug 24, 2022
88d01b6
Merge branch 'master' into matrix-repr
AD1024 Aug 24, 2022
f395d2a
reuse code
AD1024 Aug 24, 2022
2a6a8e6
Revert "clean-up cse code"
AD1024 Aug 24, 2022
7f8ca37
clean up together
AD1024 Aug 24, 2022
988abb3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 24, 2022
93b3a03
also checks for tlctx
AD1024 Aug 24, 2022
13d2efd
Merge branch 'matrix-repr' of github.com:AD1024/taichi into matrix-repr
AD1024 Aug 24, 2022
b2e101a
format
AD1024 Aug 24, 2022
6fcf070
fix codegen: allocate pointer to vector
AD1024 Aug 24, 2022
f43d2a8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 24, 2022
c613318
check real matrix when allocating memory
AD1024 Aug 24, 2022
41b6641
Merge branch 'matrix-repr' of github.com:AD1024/taichi into matrix-repr
AD1024 Aug 24, 2022
9fc758d
format and fix tc for variable holding matrix expression
AD1024 Aug 24, 2022
f635b7c
refactor: change to `make_local_matrix` which returns only an Expr; p…
AD1024 Aug 25, 2022
f82dc25
get rid of duplicated check
AD1024 Aug 25, 2022
bd68c23
save changes
AD1024 Aug 25, 2022
5d00c98
format
AD1024 Aug 25, 2022
3451397
also rename cxx part
AD1024 Aug 25, 2022
5ed0e93
Apply suggestions from code review
strongoier Aug 25, 2022
0fee707
add indexing p1
AD1024 Aug 15, 2022
25e886c
pick fixes
AD1024 Aug 15, 2022
e5c8c9a
fin indexing
AD1024 Aug 15, 2022
6b139dc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 15, 2022
afa66c9
some fixes
AD1024 Aug 24, 2022
dc144ce
fix assignment
AD1024 Aug 25, 2022
b1c3cc9
fix indexing
AD1024 Aug 25, 2022
8cb1b3a
Merge branch 'master' into matrix-indexing
AD1024 Aug 25, 2022
ca50050
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 25, 2022
02327d7
reuse code
AD1024 Aug 26, 2022
d2a7403
Merge branch 'master' into matrix-indexing
AD1024 Aug 26, 2022
6e89607
fix compilation
AD1024 Aug 26, 2022
991c64c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 26, 2022
4f722de
remove unused code
AD1024 Aug 26, 2022
a6b0d20
Merge branch 'matrix-indexing' of github.com:AD1024/taichi into matri…
AD1024 Aug 26, 2022
64a3e04
Merge branch 'master' of github.com:taichi-dev/taichi into matrix-ind…
AD1024 Aug 30, 2022
8a32024
move to `impl.subscript`
AD1024 Aug 30, 2022
39d1243
add some tests
AD1024 Aug 30, 2022
9a6461d
enable fetching store destination for tensor types
AD1024 Aug 30, 2022
8bcc6dc
disable indexing check for now
AD1024 Aug 31, 2022
77ed7ad
fix dynamic index check
AD1024 Aug 31, 2022
d1c3480
Merge branch 'master' of github.com:taichi-dev/taichi into matrix-ind…
AD1024 Aug 31, 2022
10fec4f
fix matrix solve test
AD1024 Sep 1, 2022
c7fa2ed
fix print on cuda
AD1024 Aug 23, 2022
4284ee5
check real matrix
AD1024 Sep 1, 2022
e7002f0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 1, 2022
9375327
uncomment
AD1024 Sep 1, 2022
608da83
Merge branch 'matrix-indexing' of github.com:AD1024/taichi into matri…
AD1024 Sep 1, 2022
b468eb4
fix index read
AD1024 Sep 2, 2022
3d792b5
Merge branch 'master' of github.com:taichi-dev/taichi into matrix-ind…
AD1024 Sep 2, 2022
ff295ae
check flag for dead store elem
AD1024 Sep 2, 2022
87029e5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 2, 2022
2302a24
turn off cfg for new matrix impl
AD1024 Sep 2, 2022
50193fd
Merge branch 'matrix-indexing' of github.com:AD1024/taichi into matri…
AD1024 Sep 2, 2022
c92b578
disable cfg pass for new impl
AD1024 Sep 2, 2022
7682699
rm debug code
AD1024 Sep 2, 2022
bc04628
disable in transformation pass
AD1024 Sep 2, 2022
e13dcd5
turn on indexing check
AD1024 Sep 4, 2022
a12de9e
fix element wise copy
AD1024 Sep 4, 2022
9721042
check type
AD1024 Sep 4, 2022
fece2e7
fix intermediate matrix
AD1024 Sep 5, 2022
b226289
fix field fill
AD1024 Sep 5, 2022
05e7497
fix vector_arg
AD1024 Sep 5, 2022
2d7471f
fix slice
AD1024 Sep 5, 2022
553f98f
fix transpose for vector
AD1024 Sep 5, 2022
1a0ab9c
save fixes
AD1024 Sep 6, 2022
9e21163
fix for global tmp var
AD1024 Sep 6, 2022
2bb10b7
revert local change
AD1024 Sep 6, 2022
504808a
fix test_scan
AD1024 Sep 6, 2022
70c49c3
remove dup arch
AD1024 Sep 6, 2022
22bd093
refine test case
AD1024 Sep 6, 2022
f623d57
fill in type if idexpr is already type-checked
AD1024 Sep 6, 2022
18f121a
rename func && modify docstring
AD1024 Sep 7, 2022
abe2c85
Merge branch 'master' of github.com:taichi-dev/taichi into matrix-ind…
AD1024 Sep 7, 2022
3ace1a1
merge changes (except llvm 15 part)
AD1024 Sep 7, 2022
1cd3d5e
fix compilation
AD1024 Sep 7, 2022
ad27eb0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 7, 2022
9ba4a03
unused
AD1024 Sep 7, 2022
bc113fc
Merge branch 'matrix-indexing' of https://github.com/AD1024/taichi in…
AD1024 Sep 7, 2022
595d5af
fix GlobalTmpVar in loop
AD1024 Sep 7, 2022
4b1a619
add index mismatch tests
AD1024 Sep 7, 2022
19ec61f
remove unused code
AD1024 Sep 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix transpose for vector
  • Loading branch information
AD1024 committed Sep 5, 2022
commit 553f98fa31f0c49bdbc5c29a689ec70971a5bf10
5 changes: 4 additions & 1 deletion python/taichi/_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from taichi.lang import impl, matrix, ops
from taichi.lang.impl import expr_init, get_runtime, grouped, static
from taichi.lang.kernel_impl import func, pyfunc
from taichi.lang.matrix import Matrix, Vector
from taichi.lang.matrix import Matrix, Vector, is_vector
from taichi.types import f32, f64
from taichi.types.annotations import template

Expand Down Expand Up @@ -59,6 +59,9 @@ def _matrix_transpose(mat):
Returns:
Transpose of the input matrix.
"""
if static(is_vector(mat)):
# Convert to row vector
return matrix.Matrix([[mat(i) for i in range(mat.n)]])
return matrix.Matrix([[mat(i, j) for i in range(mat.n)]
for j in range(mat.m)],
ndim=mat.ndim)
Expand Down
4 changes: 2 additions & 2 deletions tests/python/test_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,10 +544,10 @@ def foo():
def test_matrix_dtype():
@ti.kernel
def foo():
a = ti.Vector([[1, 2], [3, 4]], ti.f32)
a = ti.Matrix([[1, 2], [3, 4]], ti.f32)
a /= 2
assert all(abs(a - ((0.5, 1.), (1.5, 2.))) < 1e-6)
b = ti.Vector([[1.5, 2.5], [3.5, 4.5]], ti.i32)
b = ti.Matrix([[1.5, 2.5], [3.5, 4.5]], ti.i32)
assert all(b == ((1, 2), (3, 4)))

foo()
Expand Down