Skip to content

Commit

Permalink
adding dot files for fused sparse-dense multiplication kernels
Browse files Browse the repository at this point in the history
  • Loading branch information
samidhm committed Feb 17, 2024
1 parent ce5ba84 commit b924c54
Show file tree
Hide file tree
Showing 4 changed files with 237 additions and 0 deletions.
6 changes: 6 additions & 0 deletions compiler/sam-kernels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ GEN_KERNEL_NAMES=(
mat_vecmul_iter
mat_vecmul_iter_short
tensor3_website_expr
spm_dm_matmul
spm_spm_dm_matmul
spm_spm_spm_matmul
)

HAND_KERNEL_NAMES=(
Expand Down Expand Up @@ -95,6 +98,9 @@ TACO_ARGS=(
"x(i)=B(i,j)*C(j,k)*D(k,l)*E(l,m)*f(m) -f=x:s -f=B:ss -f=C:ss -f=D:ss -f=E:ss -f=f:s -s=reorder(i,j,k,l,m)"
"x(i)=B(i,j)*C(j,k)*d(k) -f=x:s -f=B:ss -f=C:ss -f=d:s -s=reorder(i,j,k)"
"x=B(i)*C(j)*D(i,j,k)*E(j,l)*F(l,m,n) -f=B:s -f=C:s -f=D:sss -f=E:ss -f=F:sss -s=reorder(i,j,k,l,m,n)"
"X(i,j)=B(i,k)*C(k,j) -f=X:ss -f=B:ss -f=C:dd:1,0 -s=reorder(i,j,k)"
"X(i,l)=B(i,k)*C(k,j)*D(j,l) -f=X:ss -f=B:ss -f=C:ss -f=D:dd:1,0 -s=reorder(i,j,k,l)"
"X(i,l)=B(i,k)*C(k,j)*D(j,l) -f=X:ss -f=B:ss -f=C:ss -f=D:ss:1,0 -s=reorder(i,j,k,l)"
)

mkdir -p $dir
Expand Down
49 changes: 49 additions & 0 deletions compiler/sam-outputs/onyx-dot/spm_dm_matmul.gv
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
digraph SAM {
comment="X=ss01,B=ss01,C=dd10"
20 [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"]
19 [comment="type=broadcast" shape=point style=invis type="broadcast"]
8 [comment="type=crddrop,outer=i,inner=j" label="CrdDrop i,j" color=orange shape=box style=filled type="crddrop" outer="i" inner="j"]
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"]
1 [comment="type=fiberwrite,index=j,tensor=X,mode=1,format=compressed,segsize=B0_dim+1,crdsize=B0_dim*C1_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*C1_dim" sink="true"]
18 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"]
17 [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"]
16 [comment="type=fiberlookup,index=j,tensor=C,mode=1,format=dense,src=true,root=false" label="FiberLookup j: C1\ndense" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="C" mode="1" format="dense" src="true" root="false"]
15 [comment="type=broadcast" shape=point style=invis type="broadcast"]
9 [comment="type=crddrop,outer=j,inner=k" label="CrdDrop j,k" color=orange shape=box style=filled type="crddrop" outer="j" inner="k"]
14 [comment="type=repsiggen,index=j" label="RepeatSignalGenerator j" color=cyan3 shape=box style=filled type="repsiggen" index="j"]
13 [comment="type=repeat,index=j,tensor=B,root=false" label="Repeat j: B" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="B" root="false"]
11 [comment="type=fiberlookup,index=k,tensor=B,mode=1,format=compressed,src=true,root=false" label="FiberLookup k: B1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="B" mode="1" format="compressed" src="true" root="false"]
10 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"]
6 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"]
5 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"]
4 [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*C1_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*B0_dim*C1_dim" sink="true"]
7 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"]
12 [comment="type=fiberlookup,index=k,tensor=C,mode=0,format=dense,src=true,root=false" label="FiberLookup k: C0\ndense" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="0" format="dense" src="true" root="false"]
20 -> 19 [label="crd" style=dashed type="crd" comment=""]
19 -> 8 [label="crd_i" style=dashed type="crd" comment="i"]
8 -> 2 [label="crd_outer-i" style=dashed type="crd" comment="outer-i"]
8 -> 1 [label="crd_inner-j" style=dashed type="crd" comment="inner-j"]
19 -> 18 [label="crd" style=dashed type="crd" comment=""]
18 -> 17 [label="repsig" style=dotted type="repsig"]
17 -> 16 [label="ref" style=bold type="ref"]
16 -> 15 [label="crd" style=dashed type="crd" comment=""]
15 -> 9 [label="crd_j" style=dashed type="crd" comment="j"]
9 -> 8 [label="crd_outer-j" style=dashed type="crd" comment="outer-j"]
15 -> 14 [label="crd" style=dashed type="crd" comment=""]
14 -> 13 [label="repsig" style=dotted type="repsig"]
13 -> 11 [label="ref" style=bold type="ref"]
11 -> 10 [label="crd_in-B" style=dashed type="crd" comment="in-B"]
10 -> 9 [label="crd_in-k" style=dashed type="crd" comment="in-k"]
10 -> 6 [label="ref_out-B" style=bold type="ref" comment="out-B"]
6 -> 5 [label="val" type="val"]
5 -> 4 [label="val" type="val"]
4 -> 0 [label="val" type="val"]
10 -> 7 [label="ref_out-C" style=bold type="ref" comment="out-C"]
7 -> 5 [label="val" type="val"]
11 -> 10 [label="ref_in-B" style=bold type="ref" comment="in-B"]
16 -> 12 [label="ref" style=bold type="ref" comment=""]
12 -> 10 [label="crd_in-C" style=dashed type="crd" comment="in-C"]
12 -> 10 [label="ref_in-C" style=bold type="ref" comment="in-C"]
20 -> 13 [label="ref" style=bold type="ref" comment=""]
}
91 changes: 91 additions & 0 deletions compiler/sam-outputs/onyx-dot/spm_spm_dm_matmul.gv
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
digraph SAM {
comment="X=ss01,B=ss01,C=ss01,D=dd10"
38 [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"]
37 [comment="type=broadcast" shape=point style=invis type="broadcast"]
12 [comment="type=crddrop,outer=i,inner=l" label="CrdDrop i,l" color=orange shape=box style=filled type="crddrop" outer="i" inner="l"]
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"]
1 [comment="type=fiberwrite,index=l,tensor=X,mode=1,format=compressed,segsize=B0_dim+1,crdsize=B0_dim*D1_dim,sink=true" label="FiberWrite l: X1\ncompressed" color=green3 shape=box style=filled type="fiberwrite" index="l" tensor="X" mode="1" format="compressed" segsize="B0_dim+1" crdsize="B0_dim*D1_dim" sink="true"]
36 [comment="type=repsiggen,index=i" label="RepeatSignalGenerator i" color=cyan3 shape=box style=filled type="repsiggen" index="i"]
35 [comment="type=broadcast" shape=point style=invis type="broadcast"]
33 [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"]
28 [comment="type=repeat,index=l,tensor=C,root=false" label="Repeat l: C" color=cyan2 shape=box style=filled type="repeat" index="l" tensor="C" root="false"]
26 [comment="type=fiberlookup,index=k,tensor=C,mode=0,format=compressed,src=true,root=false" label="FiberLookup k: C0\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="C" mode="0" format="compressed" src="true" root="false"]
24 [comment="type=intersect,index=k" label="intersect k" color=purple shape=box style=filled type="intersect" index="k"]
23 [comment="type=broadcast" shape=point style=invis type="broadcast"]
14 [comment="type=crddrop,outer=k,inner=j" label="CrdDrop k,j" color=orange shape=box style=filled type="crddrop" outer="k" inner="j"]
13 [comment="type=crddrop,outer=l,inner=k" label="CrdDrop l,k" color=orange shape=box style=filled type="crddrop" outer="l" inner="k"]
22 [comment="type=repsiggen,index=k" label="RepeatSignalGenerator k" color=cyan3 shape=box style=filled type="repsiggen" index="k"]
21 [comment="type=repeat,index=k,tensor=D,root=false" label="Repeat k: D" color=cyan2 shape=box style=filled type="repeat" index="k" tensor="D" root="false"]
20 [comment="type=fiberlookup,index=j,tensor=D,mode=0,format=dense,src=true,root=false" label="FiberLookup j: D0\ndense" color=green4 shape=box style=filled type="fiberlookup" index="j" tensor="D" mode="0" format="dense" src="true" root="false"]
18 [comment="type=intersect,index=j" label="intersect j" color=purple shape=box style=filled type="intersect" index="j"]
17 [comment="type=broadcast" shape=point style=invis type="broadcast"]
16 [comment="type=repsiggen,index=j" label="RepeatSignalGenerator j" color=cyan3 shape=box style=filled type="repsiggen" index="j"]
15 [comment="type=repeat,index=j,tensor=B,root=false" label="Repeat j: B" color=cyan2 shape=box style=filled type="repeat" index="j" tensor="B" root="false"]
9 [comment="type=arrayvals,tensor=B" label="Array Vals: B" color=green2 shape=box style=filled type="arrayvals" tensor="B"]
8 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"]
7 [comment="type=mul" label="Mul" color=brown shape=box style=filled type="mul"]
6 [comment="type=reduce" label="Reduce" color=brown shape=box style=filled type="reduce"]
5 [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*D1_dim,sink=true" label="FiberWrite Vals: X" color=green3 shape=box style=filled type="fiberwrite" tensor="X" mode="vals" size="1*B0_dim*D1_dim" sink="true"]
10 [comment="type=arrayvals,tensor=C" label="Array Vals: C" color=green2 shape=box style=filled type="arrayvals" tensor="C"]
11 [comment="type=arrayvals,tensor=D" label="Array Vals: D" color=green2 shape=box style=filled type="arrayvals" tensor="D"]
19 [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"]
34 [comment="type=repeat,index=i,tensor=D,root=true" label="Repeat i: D" color=cyan2 shape=box style=filled type="repeat" index="i" tensor="D" root="true"]
32 [comment="type=fiberlookup,index=l,tensor=D,mode=1,format=dense,src=true,root=false" label="FiberLookup l: D1\ndense" color=green4 shape=box style=filled type="fiberlookup" index="l" tensor="D" mode="1" format="dense" src="true" root="false"]
31 [comment="type=broadcast" shape=point style=invis type="broadcast"]
30 [comment="type=repsiggen,index=l" label="RepeatSignalGenerator l" color=cyan3 shape=box style=filled type="repsiggen" index="l"]
29 [comment="type=broadcast" shape=point style=invis type="broadcast"]
27 [comment="type=repeat,index=l,tensor=B,root=false" label="Repeat l: B" color=cyan2 shape=box style=filled type="repeat" index="l" tensor="B" root="false"]
25 [comment="type=fiberlookup,index=k,tensor=B,mode=1,format=compressed,src=true,root=false" label="FiberLookup k: B1\ncompressed" color=green4 shape=box style=filled type="fiberlookup" index="k" tensor="B" mode="1" format="compressed" src="true" root="false"]
38 -> 37 [label="crd" style=dashed type="crd" comment=""]
37 -> 12 [label="crd_i" style=dashed type="crd" comment="i"]
12 -> 2 [label="crd_outer-i" style=dashed type="crd" comment="outer-i"]
12 -> 1 [label="crd_inner-l" style=dashed type="crd" comment="inner-l"]
37 -> 36 [label="crd" style=dashed type="crd" comment=""]
36 -> 35 [label="repsig" style=dotted type="repsig"]
35 -> 33 [label="repsig" style=dotted type="repsig"]
33 -> 28 [label="ref" style=bold type="ref"]
28 -> 26 [label="ref" style=bold type="ref"]
26 -> 24 [label="crd_in-C" style=dashed type="crd" comment="in-C"]
24 -> 23 [label="crd_k" style=dashed type="crd" comment="k"]
23 -> 14 [label="crd_k" style=dashed type="crd" comment="k"]
14 -> 13 [label="crd_outer-k" style=dashed type="crd" comment="outer-k"]
13 -> 12 [label="crd_outer-l" style=dashed type="crd" comment="outer-l"]
23 -> 22 [label="crd" style=dashed type="crd" comment=""]
22 -> 21 [label="repsig" style=dotted type="repsig"]
21 -> 20 [label="ref" style=bold type="ref"]
20 -> 18 [label="crd_in-D" style=dashed type="crd" comment="in-D"]
18 -> 17 [label="crd_j" style=dashed type="crd" comment="j"]
17 -> 14 [label="crd_j" style=dashed type="crd" comment="j"]
17 -> 16 [label="crd" style=dashed type="crd" comment=""]
16 -> 15 [label="repsig" style=dotted type="repsig"]
15 -> 9 [label="ref" style=bold type="ref"]
9 -> 8 [label="val" type="val"]
8 -> 7 [label="val" type="val"]
7 -> 6 [label="val" type="val"]
6 -> 5 [label="val" type="val"]
5 -> 0 [label="val" type="val"]
18 -> 10 [label="ref_out-C" style=bold type="ref" comment="out-C"]
10 -> 8 [label="val" type="val"]
18 -> 11 [label="ref_out-D" style=bold type="ref" comment="out-D"]
11 -> 7 [label="val" type="val"]
20 -> 18 [label="ref_in-D" style=bold type="ref" comment="in-D"]
24 -> 15 [label="ref_out-B" style=bold type="ref" comment="out-B"]
24 -> 19 [label="ref_out-C" style=bold type="ref" comment="out-C"]
19 -> 18 [label="crd_in-C" style=dashed type="crd" comment="in-C"]
19 -> 18 [label="ref_in-C" style=bold type="ref" comment="in-C"]
26 -> 24 [label="ref_in-C" style=bold type="ref" comment="in-C"]
35 -> 34 [label="repsig" style=dotted type="repsig"]
34 -> 32 [label="ref" style=bold type="ref"]
32 -> 31 [label="crd" style=dashed type="crd" comment=""]
31 -> 13 [label="crd_l" style=dashed type="crd" comment="l"]
31 -> 30 [label="crd" style=dashed type="crd" comment=""]
30 -> 29 [label="repsig" style=dotted type="repsig"]
29 -> 27 [label="repsig" style=dotted type="repsig"]
27 -> 25 [label="ref" style=bold type="ref"]
25 -> 24 [label="crd_in-B" style=dashed type="crd" comment="in-B"]
25 -> 24 [label="ref_in-B" style=bold type="ref" comment="in-B"]
29 -> 28 [label="repsig" style=dotted type="repsig"]
32 -> 21 [label="ref" style=bold type="ref" comment=""]
38 -> 27 [label="ref" style=bold type="ref" comment=""]
}
Loading

0 comments on commit b924c54

Please sign in to comment.