Skip to content

Commit

Permalink
Merge branch 'mapping_to_cgra' into mapping_to_cgra_suitesparse_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kalhankoul96 committed Jan 9, 2024
2 parents 50cd072 + 9fc0993 commit 0dc4a47
Show file tree
Hide file tree
Showing 11 changed files with 276 additions and 50 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/python-package-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ jobs:
python -m virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
git clone https://github.com/cdonovick/peak.git
pip install -e peak
git clone https://github.com/StanfordAHA/lassen.git
pip install -e lassen
pip install -e .
echo $VIRTUAL_ENV/bin >> $GITHUB_PATH
- name: Test all (non SuiteSparse and Frostt) tests with pytest
Expand All @@ -44,12 +48,12 @@ jobs:
run: |
conda install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude venv
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude venv,peak,lassen
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude venv
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude venv,peak,lassen
- name: Python style checking flake8
run: |
flake8 . --count --select=E,W --statistics --ignore=W503,W504 --max-line-length=127 --exclude venv
flake8 . --count --select=E,W --statistics --ignore=W503,W504 --max-line-length=127 --exclude venv,peak,lassen
- name: Check SAM Simulator generating script
run: |
make tests
54 changes: 54 additions & 0 deletions compiler/sam-outputs/onyx-dot/mat_elemadd_leakyrelu_exp.gv
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
digraph SAM {
comment="X=ss01,B=ss01,C=ss01"
10 [comment="type=fiberlookup,index=i,tensor=B,mode=0,format=compressed,src=true,root=true" label="FiberLookup i: B0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="B" mode="0" format="compressed" src="true" root="true"]
9 [comment="type=union,index=i" label="union i" color=purple shape=box style=filled type="union" index="i"]
2 [comment="type=fiberwrite,index=i,tensor=X,mode=0,format=compressed,segsize=2,crdsize=B0_dim,sink=true" label="FiberWrite i: X0\ncompressed" color=green3 shape=box style=filled type="fiberwrite" index="i" tensor="X" mode="0" format="compressed" segsize="2" crdsize="B0_dim" sink="true"]
7 [comment="type=fiberlookup,index=j,tensor=B,mode=1,format=compressed,src=true,root=false" label="FiberLookup j: B1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="B" mode="1" format="compressed" src="true" root="false"]
6 [comment="type=union,index=j" label="union j" color=purple shape=box style=filled type="union" index="j"]
1 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=compressed,segsize=B0_dim+1,crdsize=B0_dim*B1_dim,sink=true" label="FiberWrite j: X1\ncompressed" color=green3 shape=box style=filled type="fiberwrite" index="j" tensor="X" mode="1" format="compressed" segsize="B0_dim+1" crdsize="B0_dim*B1_dim" sink="true"]
4 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"]
3 [comment="type=fp_add" label="FP_Add" color=brown shape=box style=filled type="fp_add"]
12 [comment="broadcast" shape=point style=invis type="broadcast"]
13 [comment="type=fp_mul,rb_const=0.2" label="FP_Mul * 0.2" color=brown shape=box style=filled type="fp_mul" rb_const="0.2"]
14 [comment="type=fp_max" label="FP_Max" color=brown shape=box style=filled type="fp_max"]
15 [comment="type=fp_mul,rb_const=1.44269504089" label="FP_Mul * 1.44269504089" color=brown shape=box style=filled type="fp_mul" rb_const="1.44269504089"]
16 [comment="type=broadcast" shape=point style=invis type="broadcast"]
17 [comment="type=fgetfint" label="Fgetfint" color=brown shape=box style=filled type="fgetfint"]
18 [comment="type=fgetffrac" label="Fgetffrac" color=brown shape=box style=filled type="fgetffrac"]
19 [comment="type=and,rb_const=255" label="And 0x00FF" color=brown shape=box style=filled type="and" rb_const="255"]
20 [comment="type=faddiexp" label="Faddiexp" color=brown shape=box style=filled type="faddiexp"]
21 [comment="type=arrayvals,tensor=exp" label="Array Vals: exp" color=green2 shape=box style=filled type="arrayvals" tensor="exp"]
0 [comment="type=fiberwrite,mode=vals,tensor=X,size=1*B0_dim*B1_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*B0_dim*B1_dim" sink="true"]
5 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"]
8 [comment="type=fiberlookup,index=j,tensor=C,mode=1,format=compressed,src=true,root=false" label="FiberLookup j: C1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="C" mode="1" format="compressed" src="true" root="false"]
11 [comment="type=fiberlookup,index=i,tensor=C,mode=0,format=compressed,src=true,root=true" label="FiberLookup i: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="C" mode="0" format="compressed" src="true" root="true"]
10 -> 9 [label="crd_in-B" style=dashed type="crd" comment="in-B"]
9 -> 2 [label="crd" style=dashed type="crd"]
9 -> 7 [label="ref_out-B" style=bold type="ref" comment="out-B"]
7 -> 6 [label="crd_in-B" style=dashed type="crd" comment="in-B"]
6 -> 1 [label="crd" style=dashed type="crd"]
6 -> 4 [label="ref_out-B" style=bold type="ref" comment="out-B"]
4 -> 3 [label="val" type="val"]
3 -> 12 [label="val" type="val"]
12 -> 13 [label="val" type="val"]
12 -> 14 [label="val" type="val"]
13 -> 14 [label="val" type="val"]
14 -> 15 [label="val" type="val"]
15 -> 16 [label="val" type="val"]
16 -> 17 [label="val" type="val"]
16 -> 18 [label="val" type="val"]
18 -> 19 [label="val" type="val"]
19 -> 21 [label="ref" style=bold type="ref"]
21 -> 20 [label="val" type="val" comment="fp"]
17 -> 20 [label="val" type="val" comment="exp"]
20 -> 0 [label="val" type="val"]
6 -> 5 [label="ref_out-C" style=bold type="ref" comment="out-C"]
5 -> 3 [label="val" type="val"]
7 -> 6 [label="ref_in-B" style=bold type="ref" comment="in-B"]
9 -> 8 [label="ref_out-C" style=bold type="ref" comment="out-C"]
8 -> 6 [label="crd_in-C" style=dashed type="crd" comment="in-C"]
8 -> 6 [label="ref_in-C" style=bold type="ref" comment="in-C"]
10 -> 9 [label="ref_in-B" style=bold type="ref" comment="in-B"]
11 -> 9 [label="crd_in-C" style=dashed type="crd" comment="in-C"]
11 -> 9 [label="ref_in-C" style=bold type="ref" comment="in-C"]
}
37 changes: 37 additions & 0 deletions compiler/sam-outputs/onyx-dot/spmv.gv
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
digraph SAM {
comment="x=s0,B=ss01,c=d0"
14 [comment="type=fiberlookup,index=i,tensor=B,mode=0,format=compressed,src=true,root=true" label="FiberLookup i: B0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="B" mode="0" format="compressed" src="true" root="true"]
13 [comment="type=broadcast" shape=point style=invis type="broadcast"]
7 [comment="type=crddrop,outer=i,inner=j" label="CrdDrop i,j" color=orange shape=box style=filled type="crddrop" outer="i" inner="j"]
1 [comment="type=fiberwrite,index=i,tensor=x,mode=0,format=compressed,segsize=2,crdsize=B0_dim,sink=true" label="FiberWrite i: x0\ncompressed" color=green3 shape=box style=filled type="fiberwrite" index="i" tensor="x" mode="0" format="compressed" segsize="2" crdsize="B0_dim" sink="true"]
12 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"]
11 [comment="type=repeat,index=i,tensor=c,root=true" label="Repeat i: c" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="c" root="true"]
10 [comment="type=fiberlookup,index=j,tensor=c,mode=0,format=dense,src=true,root=false" label="FiberLookup j: c0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="c" mode="0" format="dense" src="true" root="false"]
8 [comment="type=intersect,index=j" label="intersect j" color=purple shape=box style=filled type="intersect" index="j"]
5 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"]
4 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"]
3 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"]
0 [comment="type=fiberwrite,mode=vals,tensor=x,size=1*B0_dim,sink=true" label="FiberWrite Vals: x" color=green3 shape=box style=filled type="fiberwrite" tensor="x" mode="vals" size="1*B0_dim" sink="true"]
6 [comment="type=arrayvals,tensor=c" label="Array Vals: c" color=green2 shape=box style=filled type="arrayvals" tensor="c"]
9 [comment="type=fiberlookup,index=j,tensor=B,mode=1,format=compressed,src=true,root=false" label="FiberLookup j: B1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="B" mode="1" format="compressed" src="true" root="false"]
14 -> 13 [label="crd" style=dashed type="crd" comment=""]
13 -> 7 [label="crd_i" style=dashed type="crd" comment="i"]
7 -> 1 [label="crd_outer-i" style=dashed type="crd" comment="outer-i"]
13 -> 12 [label="crd" style=dashed type="crd" comment=""]
12 -> 11 [label="repsig" style=dotted type="repsig"]
11 -> 10 [label="ref" style=bold type="ref"]
10 -> 8 [label="crd_in-c" style=dashed type="crd" comment="in-c"]
8 -> 5 [label="ref_out-B" style=bold type="ref" comment="out-B"]
5 -> 4 [label="val" type="val"]
3 -> 0 [label="val" type="val"]
8 -> 6 [label="ref_out-c" style=bold type="ref" comment="out-c"]
6 -> 4 [label="val" type="val"]
10 -> 8 [label="ref_in-c" style=bold type="ref" comment="in-c"]
14 -> 9 [label="ref" style=bold type="ref" comment=""]
9 -> 8 [label="crd_in-B" style=dashed type="crd" comment="in-B"]
9 -> 8 [label="ref_in-B" style=bold type="ref" comment="in-B"]

8 -> 7 [label="crd_in-j" style=dashed type="crd" comment="in-j"]
4 -> 3 [label="val" type="val"]

}
47 changes: 47 additions & 0 deletions compiler/sam-outputs/onyx-dot/spmv_relu.gv
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
digraph SAM {
comment="x=s0,B=ss01,c=d0"
14 [comment="type=fiberlookup,index=i,tensor=B,mode=0,format=compressed,src=true,root=true" label="FiberLookup i: B0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="i" tensor="B" mode="0" format="compressed" src="true" root="true"]
13 [comment="type=broadcast" shape=point style=invis type="broadcast"]
12 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"]
11 [comment="type=repeat,index=i,tensor=c,root=true" label="Repeat i: c" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="c" root="true"]
10 [comment="type=fiberlookup,index=j,tensor=c,mode=0,format=dense,src=true,root=false" label="FiberLookup j: c0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="c" mode="0" format="dense" src="true" root="false"]
8 [comment="type=intersect,index=j" label="intersect j" color=purple shape=box style=filled type="intersect" index="j"]
5 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"]
4 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"]
3 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"]
6 [comment="type=arrayvals,tensor=c" label="Array Vals: c" color=green2 shape=box style=filled type="arrayvals" tensor="c"]
9 [comment="type=fiberlookup,index=j,tensor=B,mode=1,format=compressed,src=true,root=false" label="FiberLookup j: B1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="B" mode="1" format="compressed" src="true" root="false"]


20 [comment="type=max" label="Max 0" color=brown shape=box style=filled type="max"]
0 [comment="type=fiberwrite,mode=vals,tensor=x,size=1*B0_dim,sink=true" label="FiberWrite Vals: x" color=green3 shape=box style=filled type="fiberwrite" tensor="x" mode="vals" size="1*B0_dim" sink="true"]
21 [comment="type=crddrop,outer=i,inner=val,mode=0" label="CrdDrop Compression i, val" color=orange style=filled type="crddrop" outer="i" inner="val" mode="0"]
2 [comment="type=fiberwrite,index=i,tensor=x,mode=0,format=compressed,segsize=2,crdsize=B0_dim,sink=true" label="FiberWrite i: x0\ncompressed" color=green3 shape=box style=filled type="fiberwrite" index="i" tensor="x" mode="0" format="compressed" segsize="2" crdsize="B0_dim" sink="true"]



14 -> 13 [label="crd" style=dashed type="crd" comment=""]
13 -> 12 [label="crd" style=dashed type="crd" comment=""]
12 -> 11 [label="repsig" style=dotted type="repsig"]
11 -> 10 [label="ref" style=bold type="ref"]
10 -> 8 [label="crd_in-c" style=dashed type="crd" comment="in-c"]
8 -> 5 [label="ref_out-B" style=bold type="ref" comment="out-B"]
5 -> 4 [label="val" type="val"]
8 -> 6 [label="ref_out-c" style=bold type="ref" comment="out-c"]
6 -> 4 [label="val" type="val"]
10 -> 8 [label="ref_in-c" style=bold type="ref" comment="in-c"]
14 -> 9 [label="ref" style=bold type="ref" comment=""]
9 -> 8 [label="crd_in-B" style=dashed type="crd" comment="in-B"]
9 -> 8 [label="ref_in-B" style=bold type="ref" comment="in-B"]


4 -> 3 [label="val" type="val"]


3 -> 20 [label="val" type="val" comment="val"]
20 -> 21 [label="val" type="val" comment="inner-val"]
13 -> 21 [label="crd_i" style=dashed type="crd" comment="i"]
21 -> 0 [label="val" type="val", comment="val"]
21 -> 2 [label="crd_outer-i" style=dashed type="crd" comment="outer-i"]

}
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ scipy==1.10.0
six==1.16.0
sparse==0.13.0
tomli==2.0.1
tqdm==4.64.1
tqdm==4.64.1
1 change: 0 additions & 1 deletion sam/onyx/fiber_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def get_root(self):
return self.root_fiber

def populate_fiber(self, fiber, sub_tensor):

# Last level detection
if len(sub_tensor.shape) == 1:
# Finally have just a row, this is the base case...(could be a scalar)
Expand Down
Loading

0 comments on commit 0dc4a47

Please sign in to comment.