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

Compile-batch-matmul-to-glenside #145

Open
wants to merge 191 commits into
base: 3la-pldi-push-main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
191 commits
Select commit Hold shift + click to select a range
04bbb57
[ add ] 3la test case
AD1024 Jul 6, 2021
6f765cc
[ add ] keep track of opaque operator calls
AD1024 Jul 25, 2021
0233198
[ save ] finished compilation; extraction wip
AD1024 Aug 6, 2021
e94142c
[ addd ] accelerator pattern representation
AD1024 Aug 8, 2021
991484d
save prototype of extraction
AD1024 Aug 8, 2021
492f0a9
[ fix ] shape calculation
AD1024 Aug 10, 2021
6553cba
[ add ] generalized linear rewrite
AD1024 Aug 23, 2021
f44ec2c
[ add ] resmlp model & conv1d support
AD1024 Aug 23, 2021
d8e9944
save
AD1024 Aug 27, 2021
629fc9a
[ add/fix ] relay type check via eclass analysis
AD1024 Aug 31, 2021
9d9f96d
add serde-json feature flag
AD1024 Sep 10, 2021
15ac5a4
[ add ] RecExpr dump
AD1024 Sep 10, 2021
9c04c63
added conv1d to from_relay.py
vcanumalla Sep 24, 2021
307235a
Added Conv1d Function to mod.rs
vcanumalla Sep 30, 2021
3a86a50
added call to function
vcanumalla Sep 30, 2021
bd95a62
wrote first version of test
vcanumalla Sep 30, 2021
f9fc4ee
conv1d relay code in conv1d test
vcanumalla Oct 1, 2021
9bf13cd
save
AD1024 Oct 1, 2021
19c001e
[ fix ] runtime error
AD1024 Oct 1, 2021
1b138ae
[ attemp ] fix conv1d
AD1024 Oct 1, 2021
0b67994
remove duplicates
AD1024 Oct 1, 2021
f7b5157
[ update ] api calls to eclass analysis Shape
AD1024 Oct 2, 2021
bd6a411
Use rev = ... instead of branch = ... for tvm dep
gussmith23 Oct 6, 2021
637032a
Update tvm: include maxpool attrs fix
gussmith23 Oct 6, 2021
59c0a9e
Merge commit 'ae9be010115bebee3e5a1bba46ba3574779a32eb' into 3la-pldi…
gussmith23 Oct 9, 2021
a7b1e21
[ fix ] some tests
AD1024 Oct 11, 2021
5ddfcdd
fix more tests
AD1024 Oct 12, 2021
b86064d
[ fix ] more tests
AD1024 Oct 12, 2021
5a0dcb5
Point to specific 3la-tvm revision
gussmith23 Oct 12, 2021
6c7c8cc
Changed filenaming to use epoch time
vcanumalla Oct 12, 2021
2c394e7
Fixed Conv1d operator
vcanumalla Oct 12, 2021
481195a
Finishes Conv1d; Adds Conv1d_im2col test
vcanumalla Oct 12, 2021
39a8bce
[ fix ] shape checking & propagation (tensorize-conv2d seems stuck)
AD1024 Oct 13, 2021
3d0f19a
Ignore test
gussmith23 Oct 13, 2021
4bb5b61
Fix doctest (final test fix????)
gussmith23 Oct 13, 2021
a2756ce
Ignore long-running tests
gussmith23 Oct 13, 2021
8aa2577
[ fix ] shape inference for Linear & Dense
AD1024 Oct 22, 2021
882c319
Attempt to make CI work for 3la main branch
gussmith23 Oct 24, 2021
6e0054f
Add packages; change command invocation a bit
gussmith23 Oct 24, 2021
38e56e3
cargo fmt
gussmith23 Oct 24, 2021
93472bc
Add flexasr maxpool operator and rewrite
gussmith23 Oct 15, 2021
cf96ff6
[WIP] Add rewrites
gussmith23 Oct 21, 2021
5da081f
[wip] Continue working on maxpool
gussmith23 Oct 26, 2021
ac9cb56
Add bubble reshape through compute reduce-max
gussmith23 Oct 27, 2021
cf3b8b2
Update flexasr maxpool test
gussmith23 Oct 27, 2021
a2b2c95
Simplify multiple accesses
gussmith23 Oct 27, 2021
3a512f0
Simplify multiple transposes
gussmith23 Oct 27, 2021
02599c8
Bubble access through transpose
gussmith23 Oct 27, 2021
5e495a9
Comment
gussmith23 Oct 27, 2021
1ff0901
Add check
gussmith23 Oct 27, 2021
7361d84
Simplify trivial reduce max
gussmith23 Oct 27, 2021
6ba358c
Add log message
gussmith23 Oct 27, 2021
b921886
Format
gussmith23 Oct 27, 2021
86619e2
Simplify multiple access reshapes
gussmith23 Oct 27, 2021
35873f4
Finish test
gussmith23 Oct 27, 2021
3ea0944
Reformat final expression to make it more readable
gussmith23 Oct 27, 2021
5dbcdb5
Add batch dim to make it a bit more interesting.
gussmith23 Oct 27, 2021
e21e7ed
Fmt
gussmith23 Oct 27, 2021
de9330a
Document test
gussmith23 Oct 27, 2021
2229ab4
[ add ] conv1d example and fix bugs
AD1024 Oct 22, 2021
ddf4115
[ add ] conv1d matching support
AD1024 Oct 26, 2021
4b58044
[ fix ] shape inference for accelerator calls
AD1024 Oct 26, 2021
f25cb3b
[ fmt ] code
AD1024 Oct 26, 2021
27f12a8
cargo fmt
gussmith23 Oct 24, 2021
a9f8009
remove assert false for debugging
AD1024 Oct 27, 2021
debe1b6
[ remove ] unnecessary files
AD1024 Oct 27, 2021
89ee181
[ add ] conv1d example and fix bugs
AD1024 Oct 22, 2021
0504f03
[ add ] conv1d matching support
AD1024 Oct 26, 2021
ee1a2a4
[ fmt ] code
AD1024 Oct 26, 2021
5d02426
[ remove ] unnecessary files
AD1024 Oct 27, 2021
87b9766
turn off simplification check
AD1024 Oct 27, 2021
9f546c6
revert
AD1024 Oct 27, 2021
19f9903
change extraction
AD1024 Oct 28, 2021
6f90e66
put in dot product
AD1024 Oct 28, 2021
b4ebe6f
[ add ] conv2d operator (grouped convolution remaining)
AD1024 Oct 28, 2021
ee4d247
cargo fmt
AD1024 Oct 28, 2021
6593c91
[ fix ] id binding
AD1024 Oct 28, 2021
edd9bae
[ add ] resnet example
AD1024 Oct 30, 2021
03094b6
[ add ] hlscnn operator support
AD1024 Nov 3, 2021
952efcd
[ add ] nn.pad compilation support
AD1024 Nov 3, 2021
10a9e1e
[ add ] accelerator call info
AD1024 Nov 4, 2021
1d393fa
[ add ] variable count for ilp solving
AD1024 Nov 4, 2021
53248f0
add debug prints
AD1024 Nov 4, 2021
04ee367
Revert "add debug prints"
AD1024 Nov 4, 2021
2083fd0
attemp to modify ilp constraint
AD1024 Nov 4, 2021
0036b4d
sort by id
AD1024 Nov 4, 2021
48806ed
Revert "sort by id"
AD1024 Nov 4, 2021
3bd90cf
Revert "attemp to modify ilp constraint"
AD1024 Nov 4, 2021
deded12
[ attempt fix ] canonicalize eclass ids
AD1024 Nov 7, 2021
19ec6ed
fix canonicalize during extraction
AD1024 Nov 7, 2021
07fbfc1
[ fix ] hlscnn rewrite + tune extraction
AD1024 Nov 7, 2021
06bba17
[ add ] debug message ... exteracting multiple variants
AD1024 Nov 7, 2021
265baaf
[ add ] constraint for choosing parents of a selected eclass
AD1024 Nov 8, 2021
98fa964
[ fix ] exclude roots
AD1024 Nov 8, 2021
b06e011
fix
AD1024 Nov 8, 2021
3693b61
restrict a enode per eclass
AD1024 Nov 8, 2021
4de2e5b
tweak naive extraction
AD1024 Nov 8, 2021
8a6066e
remove shape from ast
AD1024 Nov 8, 2021
0bc4830
attempt vta dense support
AD1024 Nov 8, 2021
81735c7
[ add ] dim restriction
AD1024 Nov 8, 2021
795b466
[ add ] uint8
AD1024 Nov 9, 2021
c654a10
[ add ] dtype info in shape data
AD1024 Nov 9, 2021
0d451ec
capture `shape` case in vta dense rewrite
AD1024 Nov 10, 2021
4af6080
update tvm rev
AD1024 Nov 10, 2021
ea8aa25
[ tweak ] flex-maxpool as an accelerator call
AD1024 Nov 10, 2021
a3c70f7
Fix bug when switching to stable rust
gussmith23 Nov 10, 2021
4d07343
Shape inference for depthwise conv
gussmith23 Nov 10, 2021
d4097fe
[ add ] depthwise conv2d
AD1024 Nov 11, 2021
7774111
fix compilation
AD1024 Nov 11, 2021
8e919dc
fix strides
AD1024 Nov 11, 2021
77329c1
try new extraction
AD1024 Nov 11, 2021
1c85a37
tweak extraction cost
AD1024 Nov 11, 2021
a9fb568
Revert "tweak extraction cost"
AD1024 Nov 11, 2021
dca6eed
Revert "try new extraction"
AD1024 Nov 11, 2021
97a5855
fix cost fn
AD1024 Nov 11, 2021
096cf0b
add relay cast
AD1024 Nov 11, 2021
0ca8426
[ update ] tvm rev and comment out grouped conv for flexmatch
AD1024 Nov 14, 2021
287cc76
fix conv2d relay op call for grouped convolutions
AD1024 Nov 15, 2021
21f0f6b
update dep
AD1024 Nov 15, 2021
b66fbcd
use relay operators as examples
AD1024 Nov 16, 2021
9fd271c
add clip shifts, need to add tests
AD1024 Nov 16, 2021
6b3a6ca
add round and operator compilation
AD1024 Nov 16, 2021
1f82830
add data type support
AD1024 Nov 16, 2021
1af161d
cargo fmt
AD1024 Nov 16, 2021
e3cfe6a
update tvm checksum
AD1024 Nov 17, 2021
1437c43
initial work adding LSTM
gussmith23 Nov 17, 2021
b3c74bb
Remove the tuple in the input args
gussmith23 Nov 17, 2021
65ab36c
Revert "initial work adding LSTM"
gussmith23 Nov 17, 2021
19b2eee
Update logging message
gussmith23 Nov 17, 2021
ae05b7c
Modify network to make it easier to ingest
gussmith23 Nov 17, 2021
54961d6
Add RelayTake
gussmith23 Nov 17, 2021
9642de6
Format
gussmith23 Nov 17, 2021
6d3d0d5
Clear warnings
gussmith23 Nov 17, 2021
7e93c32
Compile take Relay -> Glenside
gussmith23 Nov 17, 2021
a5b22e0
Format
gussmith23 Nov 17, 2021
6e09464
Add RelayDropout to language
gussmith23 Nov 17, 2021
b0546cc
Format
gussmith23 Nov 17, 2021
b586251
Compile dropout relay->glenside
gussmith23 Nov 17, 2021
6122ca5
Support tanh
gussmith23 Nov 17, 2021
c5065d7
Use opaque ops for tanh in lstm test
gussmith23 Nov 17, 2021
76dcb5f
Add RelayStack to language
gussmith23 Nov 17, 2021
614b91b
Stack relay -> glenside
gussmith23 Nov 17, 2021
23c86cd
Add LogSoftmax to language and compiler
gussmith23 Nov 17, 2021
e66d948
Add log message
gussmith23 Nov 17, 2021
ded3f15
Correct the output of dropout (returns a tuple)
gussmith23 Nov 17, 2021
7a9e522
Remove comment
gussmith23 Nov 17, 2021
fc034c3
Softmax can take int as axis
gussmith23 Nov 17, 2021
d745c61
Add shape check
gussmith23 Nov 17, 2021
455930d
Point to TVM with bindings modifications
gussmith23 Nov 17, 2021
70d45ce
Kill warnings
gussmith23 Nov 17, 2021
fbbc4fb
Whoops, fix Cargo.toml
gussmith23 Nov 17, 2021
7ae0d1f
Comment out test
gussmith23 Nov 17, 2021
bc07d1e
Fix flexasr maxpool rewrite tests
gussmith23 Nov 17, 2021
bc7a4c9
Add comments
gussmith23 Nov 17, 2021
b06cc36
Add rebuild call
gussmith23 Nov 17, 2021
5bd2c27
Move program to file
gussmith23 Nov 17, 2021
c1062a8
Initial work on matching LSTM via a big pattern
gussmith23 Nov 17, 2021
63beaa0
Format
gussmith23 Nov 17, 2021
6f65b60
Continue work
gussmith23 Nov 17, 2021
d8a3607
Update test
gussmith23 Nov 17, 2021
d06769c
Point to specific egg revision
gussmith23 Nov 17, 2021
a668a7a
Point to rebased TVM branch
gussmith23 Nov 17, 2021
1b53110
update egg to version w/o dependency conflict
gussmith23 Nov 17, 2021
16cdab9
Kill warning
gussmith23 Nov 17, 2021
7e93c30
Comment out broken parts of tests
gussmith23 Nov 17, 2021
faaa58a
Format
gussmith23 Nov 17, 2021
1998bee
ignore broken tests
gussmith23 Nov 17, 2021
f3186e1
Finish LSTM test
gussmith23 Nov 17, 2021
bfc5684
add to rewrite and update egg rev hash
AD1024 Nov 18, 2021
e3de31a
fix shape info
AD1024 Nov 18, 2021
ae50e95
add shape info on accelerator calls
AD1024 Nov 18, 2021
5b3c58d
fix hlscnn accelerator func
AD1024 Nov 18, 2021
61818c7
fix vta dense shape
AD1024 Nov 18, 2021
cdfb2c1
adaptive access pattern for relay operator calls
AD1024 Nov 18, 2021
65f2699
Update TVM pointer
gussmith23 Nov 18, 2021
dc780bb
Add strided_slice
gussmith23 Nov 19, 2021
501240e
Add TODO
gussmith23 Nov 19, 2021
33b9169
Whoops, add the rest of strided slice
gussmith23 Nov 19, 2021
a8f5135
Add transformer and test
gussmith23 Nov 19, 2021
7a1894e
Compile batch_matmul to glenside
gussmith23 Nov 19, 2021
c4dc54d
Warning
gussmith23 Nov 19, 2021
18891b0
Fix batch matmul, add layer norm, finish test
gussmith23 Nov 19, 2021
921eb3b
dense -> dense+biasadd rewrite
gussmith23 Nov 19, 2021
2800324
Add constraints
gussmith23 Nov 19, 2021
e491e5c
Whoops, bias-add -> relay-bias-add
gussmith23 Nov 19, 2021
f47bc53
Fix duplicate name
gussmith23 Nov 19, 2021
e5320b8
Format
gussmith23 Nov 19, 2021
76ab6b6
Fix bug
gussmith23 Nov 19, 2021
2734540
Compile batch matmul to glenside
gussmith23 Nov 19, 2021
b4b543b
Correctly compute contains_accel_calls for concat
gussmith23 Nov 19, 2021
0b61004
Add comments
gussmith23 Nov 19, 2021
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
16 changes: 12 additions & 4 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,25 @@ name: Build and test

on:
push:
branches: [ main ]
branches: [ main, 3la-pldi-push-main ]
pull_request:
branches: [ main ]
branches: [ main, 3la-pldi-push-main ]

jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- name: Start ssh-agent
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_KEY }}
- uses: actions/checkout@v2
- run: docker build --tag glenside .
- run: DOCKER_BUILDKIT=1 docker build --ssh default --tag glenside .
# TODO(@gussmith23) Keep the list of features up to date
# TODO(@gussmith23) Can't test CPLEX in Github Actions
# TODO(@gussmith23) Can we optionally build the Docker w/ access to CPLEX?
- run: docker run glenside cargo test --no-default-features --features "run-on-github-actions tvm"
# For 3la pldi push, we don't need GH actions flag, as we disabled the
# tests which use it.
# TODO(@gussmith23) The GH actions flag can be removed entirely; just
# count egg iterations, not time
- run: docker run glenside cargo test --no-default-features --features "tvm"
4 changes: 2 additions & 2 deletions .github/workflows/rustfmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Check formatting

on:
push:
branches: [ main ]
branches: [ main, 3la-pldi-push-main ]
pull_request:
branches: [ main ]
branches: [ main, 3la-pldi-push-main ]

jobs:
check-formatting:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ Cargo.lock
#Added by cargo

/target

*.json
15 changes: 10 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,23 @@ git = "https://github.com/gussmith23/rplex"
# issue.
# NOTE Keep glenside-evaluation in sync with this
# If the versions get out of whack, we'll probably have some weird errors.
rev = "4ed759f6b6cafbab707f95b57762913a1f57c021"
git = "https://github.com/hypercubestart/incubator-tvm"
# rev = "4ed759f6b6cafbab707f95b57762913a1f57c021"
# git = "https://github.com/hypercubestart/incubator-tvm"
git = "ssh://[email protected]/uwsampl/3la-tvm.git"
# branch = "3la-pldi-push-main"
rev = "8185bdfe61ef3e5579867393eb52669bb8daebb2"
optional = true

[dependencies.egg]
rev = "39415f19acdacd6dde62f40cb2bb08f8669acc85"
git = "https://github.com/mwillsey/egg"
# rev = "39415f19acdacd6dde62f40cb2bb08f8669acc85"
git = "https://github.com/AD1024/egg"
rev = "b8f902f554cc476c397e4fd9c7bea229f946d2a9"
features = ["serde-json"]

[dependencies.ndarray]
version = "0.13.0"
features = ["approx"]

[dependencies.serde]
version = "1.0"
features = ["derive"]
features = ["derive"]
19 changes: 9 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ FROM ubuntu:18.04
# https://stackoverflow.com/questions/44331836/apt-get-install-tzdata-noninteractive
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update
RUN apt install -y git libgtest-dev cmake wget unzip libtinfo-dev libz-dev libcurl4-openssl-dev libopenblas-dev g++ sudo python3-dev libclang-dev curl lsb-release wget software-properties-common python3-pip
RUN apt install -y git libgtest-dev cmake wget unzip libtinfo-dev libz-dev libcurl4-openssl-dev libopenblas-dev g++ sudo python3-dev libclang-dev curl lsb-release wget software-properties-common python3-pip libssl-dev pkg-config

# Install Rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
Expand All @@ -26,12 +26,13 @@ RUN sudo ./llvm.sh 10
ENV LLVM_CONFIG_PATH=/usr/lib/llvm-10/bin/llvm-config

# Build TVM with Rust bindings
# TODO(@gussmith23) Switch this to TVM mainline
# once https://github.com/apache/incubator-tvm/pull/6563 is merged
RUN cd /root && git clone https://github.com/hypercubestart/incubator-tvm tvm --recursive
WORKDIR /root/.ssh
RUN ssh-keyscan github.com >> ~/.ssh/known_hosts
WORKDIR /root
RUN --mount=type=ssh git clone --recursive [email protected]:uwsampl/3la-tvm.git tvm
WORKDIR /root/tvm
RUN git fetch
RUN git checkout 4ed759f6b6cafbab707f95b57762913a1f57c021
RUN --mount=type=ssh git fetch
RUN git checkout bb6c378e5440899083af253c3466db087157acb6
RUN git submodule sync && git submodule update
RUN echo 'set(USE_LLVM $ENV{LLVM_CONFIG_PATH})' >> config.cmake
RUN echo 'set(USE_RPC ON)' >> config.cmake
Expand Down Expand Up @@ -59,9 +60,7 @@ RUN pip3 install --upgrade pip
COPY ./requirements.txt ./requirements.txt
RUN pip3 install -r requirements.txt

# Build Glenside with all features
# Build Glenside.
WORKDIR /root/glenside
COPY . .

# At this point, you should be able to build Glenside with whatever features you
# want!
RUN --mount=type=ssh cargo build --no-default-features --features "tvm"
2 changes: 2 additions & 0 deletions examples/glenside-cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ fn main() {

let mut egraph = EGraph::new(MyAnalysis {
name_to_shape: shapes_map.clone(),
name_to_dtype: HashMap::default(),
});
let id = egraph.add_expr(&glenside_expr);

Expand Down Expand Up @@ -604,6 +605,7 @@ fn main() {

let mut egraph = EGraph::new(MyAnalysis {
name_to_shape: shapes_map,
name_to_dtype: HashMap::default(),
});
let id = egraph.add_expr(&extracted_expr);
let (hw_id_map, hw_atoms) = if let Some(val) = matches.value_of("find-monolithic-designs") {
Expand Down
Loading