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

Matrix dialect #180

Merged
merged 385 commits into from
Mar 29, 2023
Merged
Changes from 1 commit
Commits
Show all changes
385 commits
Select commit Hold shift + click to select a range
bb3e879
simple peephole optimization for 0+x=x
NeuralCoder3 Mar 8, 2022
65a3074
added partial eval optim to optim pass 3
NeuralCoder3 Mar 8, 2022
c00f797
tests with flat cn
NeuralCoder3 Mar 8, 2022
4f05015
temp fix for tuple coupling
NeuralCoder3 Mar 8, 2022
2ec0969
temp fix for sigma problems (conditional, return tuple)
NeuralCoder3 Mar 9, 2022
45a06d8
fixed ptr arg init
NeuralCoder3 Mar 9, 2022
fa3dbb1
merge
NeuralCoder3 Mar 10, 2022
e64e8a5
replaced lam->app
NeuralCoder3 Mar 10, 2022
08c190f
Merge https://github.com/AnyDSL/thorin2 into autodiff
NeuralCoder3 Mar 11, 2022
c54dd02
cleanup, fat pointer signature
NeuralCoder3 Mar 11, 2022
d0da3ec
alloc fat-ptr implementation
Mar 13, 2022
7ec5f04
fat_ptr alloc fix
Mar 14, 2022
f2fbea0
correct left & tangent type for ptr to arrays
Mar 15, 2022
18d453d
fixed unreachable
Mar 15, 2022
cf10485
forwarded correct A (instead left transformed one)
Mar 15, 2022
4826c15
array fat ptr input pb
Mar 15, 2022
724f68d
wip lea fat ptr
Mar 15, 2022
4aa790c
lea fat_ptr
NeuralCoder3 Mar 16, 2022
a06e48c
fix lea, alloc, bitcast
NeuralCoder3 Mar 16, 2022
185bd71
zero for arrays
NeuralCoder3 Mar 16, 2022
a78f65b
merge master
NeuralCoder3 Mar 17, 2022
63bc50c
fixed changes from merge
NeuralCoder3 Mar 17, 2022
c379aa4
correct zero arrays
NeuralCoder3 Mar 17, 2022
eb3647c
vec_add fat_ptr implementation
Mar 20, 2022
fde5754
vec add in call position
Mar 22, 2022
183c344
loop over fat ptr
Mar 22, 2022
5b1530b
vec add for pointer
Mar 22, 2022
9ce2e5e
added correct ptr sum & fixed mem
NeuralCoder3 Mar 22, 2022
68b95a7
fix non-flat one-hot
Mar 25, 2022
fe0b12e
temporary fix to preserve fat pointer in extract pb
Mar 26, 2022
232e47e
solved mut problems
Mar 29, 2022
5e997d0
Merge branch 'fat-ptr' of https://github.com/NeuralCoder3/thorin into…
Mar 29, 2022
60be685
slightly more general fix for one hot / pb extract / flat tuple
Mar 29, 2022
ad36256
tangent of full function type
Mar 29, 2022
b7993c9
structure map
Mar 29, 2022
d34f86e
corrected spelling
Mar 29, 2022
b7e1231
merge
Apr 4, 2022
cb666ef
removed workflow
Apr 4, 2022
a5f1733
removed workflow
Apr 4, 2022
fe26104
solved array projection issue
Apr 4, 2022
1538193
fix clang errors
christopherhjung Apr 4, 2022
8fbeda5
fix sub
christopherhjung Apr 5, 2022
12cf51d
fix div
christopherhjung Apr 5, 2022
584dcc1
refactoring j_wrap_rop
christopherhjung Apr 5, 2022
b270066
bugfix rop and implementation AutoDiff definition of isReturning
christopherhjung Apr 5, 2022
3187840
fix ret_var
christopherhjung Apr 5, 2022
b4f381c
cleanup
christopherhjung Apr 5, 2022
3df8201
substitute set_filter with nom_filter_lam for better overview
christopherhjung Apr 7, 2022
657b38a
remove debug logs
christopherhjung Apr 7, 2022
1dec8a9
split src_to_dst assignment
christopherhjung Apr 7, 2022
10dd7e5
refactoring DefArray's
christopherhjung Apr 7, 2022
17749b2
Merge pull request #1 from NeuralCoder3/refactoring
NeuralCoder3 Apr 8, 2022
88c3596
made arrref->skip more explicit
Apr 8, 2022
437a01b
merge
Apr 12, 2022
5b62eac
removed workflow
Apr 12, 2022
bdf21b4
remove size_t cast because size_t was replaces by nat_t so no cast re…
christopherhjung Apr 13, 2022
de64e48
Merge https://github.com/AnyDSL/thorin2 into t2
Apr 21, 2022
34aaecd
Merge branch 't2' of https://github.com/NeuralCoder3/thorin into t2
Apr 26, 2022
433e02b
fixed flat fat ptr app for extracts
Apr 26, 2022
8edf242
fix segmentation fault and add partial evaluation before auto diff
christopherhjung Apr 26, 2022
efaf8b6
replace φ py phi_
christopherhjung Apr 26, 2022
f0d5e7e
do not fully unfold addition
Apr 26, 2022
e3bea74
implement numeric diff multidim
christopherhjung Apr 12, 2022
7e49928
rebase and fix bug
christopherhjung May 4, 2022
d90d8d4
Merge pull request #2 from NeuralCoder3/multidim-numeric-new
NeuralCoder3 May 5, 2022
ace957b
refactoring AT, BT
May 5, 2022
35e4cd6
removed loop head filter
May 5, 2022
6c488b1
Merge branch 't2' of https://github.com/NeuralCoder3/thorin into t2
May 5, 2022
b48780b
linear control flow for num diff
May 5, 2022
5cbe54b
numeric diff result as tuple
May 5, 2022
1a2fc68
fix multi out ext diff
May 6, 2022
3bd8dec
Implement Ptr support for numeric diff
christopherhjung May 8, 2022
66b53e5
update comment
christopherhjung May 8, 2022
87bf900
Merge pull request #3 from NeuralCoder3/multidim-numeric-new
NeuralCoder3 May 11, 2022
43dad79
added todos
May 11, 2022
e0a7dda
fix vec_add bug
christopherhjung May 12, 2022
53df3d1
Merge branch 'master' of https://github.com/AnyDSL/thorin2 into t2
May 12, 2022
c05d56b
Merge branch 'master' of https://github.com/AnyDSL/thorin2 into t2
May 13, 2022
cc0a27f
removed peephole optim
May 13, 2022
d9e791e
created file for matrix
Jun 14, 2022
6cefa99
more types
Jun 14, 2022
90bddb4
map type
Jun 14, 2022
a080514
remaining operations
Jun 14, 2022
2f0c441
overlooked read, const
Jun 14, 2022
e967508
insertion
Jun 15, 2022
b6a9757
module cleanup
Jun 20, 2022
7cf8510
added matrix to cmake
Jun 20, 2022
678146c
hard reset to https://github.com/AnyDSL/thorin2 master
Jun 20, 2022
6156061
new dialect version
Jun 20, 2022
390f214
even more matrix operations
Jun 20, 2022
b871783
Merge branch 'master' of https://github.com/AnyDSL/thorin2 into matri…
Jun 23, 2022
999b9a8
matrix dialect file connection
Jun 23, 2022
aa42b31
read(const a) = a
Jun 23, 2022
ce7b8bb
matrix const read test
Jun 24, 2022
6e6ecdf
attempt to normalize
Jun 24, 2022
1c8819f
trivial normalizer
Jun 24, 2022
c3b9115
%mat -> %matrix
Jun 27, 2022
ef02436
correct read(const) normalizer
Jun 27, 2022
0211382
normalizer definitions
Jun 27, 2022
f18ffb2
passes for matrix
Jun 28, 2022
45baef5
Merge branch 'master' of https://github.com/AnyDSL/thorin2 into matri…
Jun 28, 2022
565b478
more normalizers
Jun 29, 2022
f443f89
new skeleton for lowering
Jun 29, 2022
c116a3e
Merge branch 'matrix-dialect' of https://github.com/NeuralCoder3/thor…
Jul 7, 2022
bc5e7eb
adapted matrix to new convention
Jul 7, 2022
544e8e6
let for better readability
Jul 7, 2022
281b644
matrix dialect extended
Jul 7, 2022
d0fc663
ideas for map
Jul 8, 2022
56a0bf1
fixed typos
Jul 19, 2022
d462ef3
generalized map, reduce, zip
Jul 19, 2022
935d1ea
mapReduce applications
Jul 19, 2022
96dc62b
removed old code in favor of mapReduce also known as einsum (jack of …
Jul 19, 2022
a89d1e3
attempt to use mapReduce
Jul 19, 2022
a3a66ce
matrix normalize begin
Jul 22, 2022
f6eb600
update
Jul 22, 2022
b170677
updated to mem monad matrix
Jul 26, 2022
6706ce2
more on lowering
Jul 26, 2022
3a66999
rewrote lower_mapReduce
Jul 27, 2022
c1d50e2
finished one version of mapReduce lowering
Jul 27, 2022
70d45d2
cleanup
Jul 27, 2022
c85c2be
Merge branch 'master' into matrix_dialect
Oct 10, 2022
2cf2642
fix compilation
Oct 10, 2022
808e515
Merge branch 'direct_dependent' into matrix-simple
Oct 10, 2022
bebb850
replaced Int -> Idx again
Oct 10, 2022
71e79e6
added simplified operations
Oct 10, 2022
80f14f7
updated test case
Oct 10, 2022
cdf109e
Merge branch 'master' into matrix_dialect
Oct 12, 2022
2e72687
fixed compilation issue
Oct 12, 2022
f50ae0e
Merge branch 'matrix-simple' into matrix_dialect + adaptation
Oct 14, 2022
0dc9960
update, generalization
Oct 17, 2022
ff87747
updates map reduce example
Oct 18, 2022
2b4a5ee
started rewrite of matrix lowering
Oct 18, 2022
bea56da
finally lowered generalized matrix map reduction
Oct 19, 2022
e96b4c5
typo
Oct 19, 2022
073c194
multiple lowering passes
Oct 20, 2022
b78c9ec
Merge branch 'master' into matrix_dialect
Oct 20, 2022
fb34a44
bug reproduction
Oct 20, 2022
621cabf
Merge branch 'master' into matrix_dialect
Oct 20, 2022
e26d52c
used correct operations
Oct 20, 2022
e284e84
nested matrices
Oct 20, 2022
91cec19
completed other operations lowering onto pointer level
Oct 20, 2022
6e0e01f
fixed hash problem
Oct 20, 2022
9dfd85b
fixed UB
leissa Oct 20, 2022
7ac0715
added newlines to make it more readable
Oct 21, 2022
abf6928
indentation
Oct 21, 2022
0718baf
Merge branch 'matrix_dialect' of https://github.com/NeuralCoder3/thor…
Oct 21, 2022
222c93e
added mem to high level operations
Oct 21, 2022
d7ded94
prod -> map reduce
Oct 21, 2022
66d018f
generalized handling
Oct 21, 2022
8b0a1e9
a bit of cleanup
Oct 21, 2022
c631bf7
moved internal function cleanup
Oct 21, 2022
a0c51c7
external product
Oct 21, 2022
d99c3ec
generalization approach
Oct 21, 2022
4c7de94
wrong projection
Oct 21, 2022
ea98aba
unary tuple extract fix
Oct 21, 2022
96ed8ca
Merge branch 'unary_tuple_fix' into matrix_dialect
Oct 21, 2022
08d32ee
example for extern function definition
Oct 21, 2022
f89bcc1
remaining mapReduce definitions
Oct 21, 2022
0acbf3f
Merge branch 'master' into matrix_dialect
Oct 24, 2022
3f6c82e
proj issue, internals handling
Oct 25, 2022
adc1a23
commented out unfold functions for easier debugging
Oct 25, 2022
b9df239
improved error output
Oct 28, 2022
4701987
Merge branch 'matrix_dialect' of https://github.com/NeuralCoder3/thor…
Oct 28, 2022
f6327f1
Merge branch 'master' into matrix_dialect
Oct 28, 2022
c922b63
tests to get pass to work
Nov 3, 2022
b42f76b
manual iteration attempt
Nov 3, 2022
e16871b
filter fix
Nov 4, 2022
44ef888
reworked rewrite
Nov 4, 2022
e3cf438
more tests to eliminate errors and find unprintable def
Nov 4, 2022
a182e0a
Merge branch 'master' into matrix_dialect
Nov 9, 2022
39e1f05
Merge branch 'matrix_dialect' of https://github.com/NeuralCoder3/thor…
Nov 9, 2022
a8affdb
real -> math.F
Nov 9, 2022
a24bb24
rewrite parts beforehand
Nov 9, 2022
aa327c4
fixed last matrix lowering
Nov 10, 2022
4bce7d1
fixed a few lit tests (only thorin generation)
Nov 10, 2022
308b431
fixed more test cases
Nov 10, 2022
6fdfe36
a bit of cleanup
Nov 10, 2022
50c64af
disabled transpose for now
Nov 10, 2022
0d109bc
added printer error demonstration
Nov 10, 2022
92de14b
fixed remaining (non transpose) tests
Nov 10, 2022
ab3d93a
more tranpose tests
Nov 10, 2022
f3a3def
Merge branch 'ho_codegen' into matrix_dialect
Nov 17, 2022
e409eee
updated test cases
Nov 17, 2022
24cfecd
fixed some test cases
Nov 17, 2022
55d0023
Merge remote-tracking branch 'origin/master' into matrix_dialect
Dec 2, 2022
9a7fb9a
fixed merge error
Dec 2, 2022
b5dbb13
Merge branch 'matrix_dialect' of https://github.com/NeuralCoder3/thor…
Dec 2, 2022
277d500
minimal rewrite phase
Dec 2, 2022
f59c230
Merge remote-tracking branch 'origin/master' into matrix_dialect
Dec 6, 2022
062be31
fix axiom rewrite
Dec 6, 2022
f6c7bd0
Merge remote-tracking branch 'origin/master' into matrix_dialect
Dec 14, 2022
ebac94e
fixed normalizers
Dec 15, 2022
f5bb4d1
more tests
Dec 15, 2022
248a9f6
handle internals/externals in RWPhase
Dec 16, 2022
1bbe9fb
Merge branch 'matrix_dialect' of https://github.com/NeuralCoder3/thor…
Dec 16, 2022
315f7f0
nested allocation
Dec 16, 2022
f7118fb
fix for #165
leissa Dec 16, 2022
3b22f21
simplify
leissa Dec 16, 2022
d3c0b84
Merge branch 'master' into matrix_dialect
Dec 19, 2022
7169584
added matrix passes, phases
Dec 19, 2022
095be62
Merge branch 'matrix_dialect' of https://github.com/NeuralCoder3/thor…
Dec 19, 2022
9e32eb5
Merge remote-tracking branch 'origin/master' into matrix_dialect
Dec 19, 2022
cbb799a
fixed tests
Dec 19, 2022
7d321f8
transpose test
Dec 19, 2022
3cf2838
remaining map reduce lowerings
Dec 19, 2022
05604bf
Merge remote-tracking branch 'origin/ho_codegen' into matrix_dialect
Dec 20, 2022
2810df7
resolved merge artifact
Dec 20, 2022
202d1a5
ho codegen
Dec 20, 2022
fe3283b
specialized internal cleanup
Dec 22, 2022
1f05ef0
matrix execution test
Dec 22, 2022
76bb125
ignore non-set functions
Jan 9, 2023
7ee94ce
additional tests
Jan 9, 2023
bc63865
more complex examples
Jan 11, 2023
a2977e5
edge case
Jan 11, 2023
6968dea
more tests
Jan 16, 2023
995beac
Merge remote-tracking branch 'origin/master' into matrix_dialect
Jan 20, 2023
d878112
more information about failure
Feb 1, 2023
93649bf
Merge remote-tracking branch 'origin/master' into matrix_dialect
Feb 1, 2023
c574d09
removed implicit arguments
Feb 1, 2023
a0f8327
reordering
Mar 13, 2023
4fdea5e
Merge remote-tracking branch 'origin/master' into matrix_dialect
Mar 13, 2023
75535ea
removed merge artifact
Mar 13, 2023
a880e8c
Merge remote-tracking branch 'upstream/refactor/sort' into matrix_dia…
Mar 14, 2023
fdf1a38
enable matrix dialect compilation
Mar 14, 2023
5de48c5
Merge remote-tracking branch 'origin/master' into matrix_dialect
Mar 15, 2023
f62f5b7
update code / fix merge errors
Mar 15, 2023
68fbe05
fixed normalizers
Mar 15, 2023
6fee15b
fix ad cleanup
Mar 15, 2023
350c340
fixed implicit arguments
Mar 15, 2023
e163d31
temporarily add fix from #187
Mar 15, 2023
f50d141
fixed test case
Mar 15, 2023
7c2a31a
revisited unresolved tests
Mar 16, 2023
465fdd7
attempt to fix register_pass not found
Mar 16, 2023
da8bc3d
removed old tag relict
Mar 16, 2023
680fb6c
explicitely include pipelinebuilder
Mar 16, 2023
e81096f
replaced casted initializer lists
Mar 17, 2023
fd73b1e
replaced span with array
Mar 20, 2023
ecefff0
disable timing for non-linux platforms
Mar 20, 2023
4e63757
fixed doxygen
Mar 20, 2023
13c3360
c++ code cleanup
Mar 20, 2023
a66d590
thorin code cleanup
Mar 20, 2023
fb5e7d8
removed comments in normalizers
Mar 20, 2023
9cce49a
Merge branch 'anydsl_master' into matrix_dialect
leissa Mar 28, 2023
b88cf04
compile fixes/fix warnings
leissa Mar 28, 2023
e34828d
Merge branch 'anydsl_master' into matrix_dialect
leissa Mar 28, 2023
78c4ec2
refactor
Mar 29, 2023
1532a18
Merge branch 'anydsl_master' into matrix_dialect
leissa Mar 29, 2023
e147add
sort indices to avoid non-deterministic map access
Mar 29, 2023
22a608c
fixed type error
leissa Mar 29, 2023
e70c5ce
updated lit commands
leissa Mar 29, 2023
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
sort indices to avoid non-deterministic map access
  • Loading branch information
Marcel Ullrich committed Mar 29, 2023
commit e147addc443994cb4f4a16b8d14a7701cc904cda
12 changes: 8 additions & 4 deletions dialects/matrix/passes/lower_matrix_mediumlevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const Def* LowerMatrixMediumLevel::rewrite_(const Def* def) {
world.DLOG("matrix {} has non-constant dimension count", i);
return def;
}
auto ni_nat = *ni_lit;
u64 ni_nat = *ni_lit;
world.DLOG(" dims({i}) = {}", i, ni_nat);
auto SI_i = SI->proj(m_nat, i);
std::vector<const Def*> input_dims_i;
Expand Down Expand Up @@ -154,8 +154,8 @@ const Def* LowerMatrixMediumLevel::rewrite_(const Def* def) {
world.DLOG(" index {} {} is not a literal", i, j);
return def;
}
auto idx_nat = *idx_lit;
auto dim = input_dims[i][j];
u64 idx_nat = *idx_lit;
auto dim = input_dims[i][j];
world.DLOG(" index {} = {}", j, idx);
world.DLOG(" dim {} = {}", idx, dim);
if (!dims.contains(idx_nat)) {
Expand All @@ -177,12 +177,15 @@ const Def* LowerMatrixMediumLevel::rewrite_(const Def* def) {
}

for (auto [idx, dim] : dims) {
world.DLOG("dim {} = {}", idx, dim);
world.ILOG("dim {} = {}", idx, dim);
if (idx < n_nat)
out_indices.push_back(idx);
else
in_indices.push_back(idx);
}
// sort indices to make checks easier later.
std::sort(out_indices.begin(), out_indices.end());
std::sort(in_indices.begin(), in_indices.end());

// create function `%mem.M -> [%mem.M, %matrix.Mat (n,S,T)]` to replace axiom call

Expand Down Expand Up @@ -272,6 +275,7 @@ const Def* LowerMatrixMediumLevel::rewrite_(const Def* def) {

DefArray output_iterators((size_t)n_nat, [&](u64 i) {
auto idx = out_indices[i];
if (idx != i) world.ELOG("output indices must be consecutive 0..n-1 but {} != {}", idx, i);
assert(idx == i && "output indices must be consecutive 0..n-1");
auto iter_idx_def = iterator[idx];
return iter_idx_def;
Expand Down