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

New Registers Constructs #125

Open
wants to merge 148 commits into
base: llvm
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
05e663f
Merge pull request #103 from cucapra/llvm
jasperxfliang Jul 26, 2021
8c60760
Bump path-parse from 1.0.6 to 1.0.7 in /web-demo/frontend/custom-js
dependabot[bot] Aug 13, 2021
f307939
Merge pull request #110 from cucapra/dependabot/npm_and_yarn/web-demo…
avanhatt Sep 29, 2021
7460dd4
add new load reuse test
JonathanDLTran Dec 13, 2021
54da95e
remove ll
JonathanDLTran Dec 13, 2021
d6d335b
add conv assertions
JonathanDLTran Dec 13, 2021
fa7d916
remove ll
JonathanDLTran Dec 13, 2021
1df35e5
add asserts to all tests except qr-decomp
JonathanDLTran Dec 13, 2021
56a3961
random matrix multiply tests
JonathanDLTran Dec 14, 2021
4cf5c56
fix random tests error bounds, 25 by 25 works
JonathanDLTran Dec 14, 2021
6f40ce5
begin working on flag for no-optimization
JonathanDLTran Dec 14, 2021
8e981bf
add no opt and no print flags to llvm, makefile commands updated
JonathanDLTran Dec 14, 2021
43e4326
clean lib.rs no vec, add 2d-2d-conv random tests at 5 and 10:
JonathanDLTran Dec 15, 2021
c98b00c
add new 1d-conv random 5 and 10 tests
JonathanDLTran Dec 15, 2021
4de1270
add random stencil tests at 15, 21, 50
JonathanDLTran Dec 15, 2021
cefbf5f
move all building to build directory
JonathanDLTran Dec 15, 2021
a5dfebf
restructure with random tests directory
JonathanDLTran Dec 15, 2021
c8ae4d0
remove all 'new' tests
JonathanDLTran Dec 15, 2021
87951be
add failed test directoryy
JonathanDLTran Dec 15, 2021
0f1bdcc
fix run all
JonathanDLTran Dec 15, 2021
2f273b6
add 1d matrix multiply, add random q-prod and point-product; random t…
JonathanDLTran Dec 17, 2021
2480505
change bounds for point-product-random and q-prod-random
JonathanDLTran Jan 19, 2022
68ad7c4
move non failing tests
JonathanDLTran Jan 20, 2022
1d85649
malloc and calloc simple tests work
JonathanDLTran Jan 21, 2022
eb7404a
checkpoint for debugging qr-decomp fixed size
JonathanDLTran Jan 28, 2022
4e79e07
fix up no-opt annotated functions
JonathanDLTran Jan 29, 2022
c0fea25
revert all runt failures with FAIL marker
JonathanDLTran Jan 29, 2022
0fae9b8
revert runt.toml
JonathanDLTran Jan 29, 2022
5977c0d
add regression test
JonathanDLTran Feb 4, 2022
0043d42
add regression test for type error
JonathanDLTran Feb 9, 2022
0cda76c
test 1 works, but have to manually insert type conversions in code
JonathanDLTran Feb 10, 2022
8243d87
dynamically sized arrays in test2 work
JonathanDLTran Feb 10, 2022
cdd3441
add test1/test2 asserts
JonathanDLTran Feb 10, 2022
fa81f93
add test 3
JonathanDLTran Feb 10, 2022
cf2154e
add naive-norm and sgn inlining passes
JonathanDLTran Feb 11, 2022
626fd1b
sgn and naive norm inlining tests both pass
JonathanDLTran Feb 11, 2022
72a83f8
simple loop sgn/naive norm inline
JonathanDLTran Feb 11, 2022
296167f
fix sgn to be inlined
JonathanDLTran Feb 11, 2022
5562254
fix no-opt flag
JonathanDLTran Feb 12, 2022
8b33845
fix call issue, test1 pass
JonathanDLTran Feb 15, 2022
fec0a52
test1, 2 and 3 work
JonathanDLTran Feb 17, 2022
f27679c
random and feature tests
JonathanDLTran Feb 25, 2022
a107463
add random inlining tests for 10by10, 20by20
JonathanDLTran Feb 25, 2022
99931fb
ignore polybench tests
JonathanDLTran Feb 25, 2022
6890293
polybench tests commands added in makefile, change to float type
JonathanDLTran Feb 25, 2022
9e9c149
bitcasting works
JonathanDLTran Feb 27, 2022
97c7f80
test4-1-linear, 4-2-linear, test4-3-linear all asserted and pass unde…
JonathanDLTran Feb 27, 2022
a1bb5cc
move linear tests into llvm-tests
JonathanDLTran Feb 27, 2022
5ba80da
remove prints in lib.rs, tests1, 2, 3, 4-1, 4-2, 4-2-2, 4-3 all pass …
JonathanDLTran Feb 27, 2022
a198a96
rename tests to be more descriptive, move tests to llvm-tests
JonathanDLTran Feb 27, 2022
5fc1a45
qr decomp works
JonathanDLTran Feb 27, 2022
023067d
move directories
JonathanDLTran Feb 27, 2022
9c6b13d
checkpoint before phi operration
JonathanDLTran Mar 3, 2022
46dfeea
comment changes to rollback
JonathanDLTran Mar 3, 2022
7287821
collecting instrs, select fix works, 10 by 10 passes random
JonathanDLTran Mar 4, 2022
70b96a1
starting to deal with memsets
JonathanDLTran Mar 4, 2022
e597368
test 2 with local arrrays works
JonathanDLTran Mar 4, 2022
5cf4a4a
checkpoint 3/8 with alloc copy problems
JonathanDLTran Mar 9, 2022
3365d23
alloca issue resolved
JonathanDLTran Mar 9, 2022
134bfc8
start creating llvm-tests
JonathanDLTran Mar 9, 2022
1025e5a
change llvm_to_egg load case
JonathanDLTran Mar 9, 2022
ec9e7c5
works for n = 2, fails for n = 3
JonathanDLTran Mar 9, 2022
b15a0bb
checkpoint before replacing with hashmap for llvm arg pairs
JonathanDLTran Mar 10, 2022
b9016f7
3 by 3 works, with a hash map
JonathanDLTran Mar 10, 2022
76180f2
with assertions on, passses random 3's
JonathanDLTran Mar 10, 2022
0b27995
fix flaky test
JonathanDLTran Mar 14, 2022
717c541
Merge branch 'master' into llvm-qrd-fix
JonathanDLTran Mar 14, 2022
177ca4d
Merge branch 'master' into llvm-qrd-fix
JonathanDLTran Mar 14, 2022
1dd209b
Merge branch 'llvm-qrd-fix' of https://github.com/cucapra/diospyros i…
JonathanDLTran Mar 14, 2022
93074a9
delete dead commented out code
JonathanDLTran Mar 18, 2022
1635421
more dead code removal
JonathanDLTran Mar 18, 2022
08daedb
set up testing infrastructure
JonathanDLTran Mar 23, 2022
0c21228
no-opt tests turnt added, llvm output tests for c-tests added
JonathanDLTran Mar 23, 2022
058ab1b
checkpoint before changing llvm-to-egg
JonathanDLTran Apr 22, 2022
6d2f4d6
rewrite mutually recursive framework
JonathanDLTran Apr 26, 2022
c07f799
new translation llvm to egg functions
JonathanDLTran Apr 26, 2022
5f0701d
add restricted instructions
JonathanDLTran Apr 27, 2022
7c59f22
remove old unusued code
JonathanDLTran Apr 27, 2022
e4a133f
fix a bunch of egg to llvm translations
JonathanDLTran Apr 27, 2022
40d5bab
rewrote entire egg to llvm recursive func
JonathanDLTran Apr 27, 2022
e43fb5d
fix up arg and reg cases
JonathanDLTran Apr 27, 2022
f3eadd7
rust compiles
JonathanDLTran May 1, 2022
841318b
fix up diospyros.cpp
JonathanDLTran May 1, 2022
760769e
change some var names to be chunk based
JonathanDLTran May 1, 2022
8c0fda6
remove a lot of dead programs
JonathanDLTran May 1, 2022
158ae2c
remove flaky test outputs
JonathanDLTran May 1, 2022
5209c36
debugging
JonathanDLTran May 2, 2022
f1bc377
add works, mult works
JonathanDLTran May 4, 2022
4258a85
add no optimization shortcut
JonathanDLTran May 4, 2022
1e0b9bc
fix issue with argument being caught not in current chunk
JonathanDLTran May 4, 2022
5856101
fix up some more cases for five-binops
JonathanDLTran May 4, 2022
f25c257
if else fix issue with no cloning in prior basic block
JonathanDLTran May 4, 2022
53ddaa7
12 tests fail
JonathanDLTran May 4, 2022
b23f8d5
loop inline fixed
JonathanDLTran May 4, 2022
a869f69
all c-tests pass, but load store movement had issue
JonathanDLTran May 5, 2022
09fc974
remove prints in c++
JonathanDLTran May 5, 2022
6038826
start fixing load store movement
JonathanDLTran May 6, 2022
ee70097
remove std namesapace
JonathanDLTran May 6, 2022
0dfb1c3
add in final steps of store movement
JonathanDLTran May 6, 2022
e96442c
new version of veclang variant added
JonathanDLTran May 6, 2022
ab98a31
delete old instructions works now
JonathanDLTran May 6, 2022
991aea9
move fail tests to c-tests
JonathanDLTran May 8, 2022
fba449d
calloc test change
JonathanDLTran May 10, 2022
27a044e
stores push back fails on many tests
JonathanDLTran May 10, 2022
4a98f7d
start report
JonathanDLTran May 25, 2022
6ec12b1
store movement works
JonathanDLTran May 26, 2022
e444222
fix load movement
JonathanDLTran May 27, 2022
a223959
remove old ld st movement file
JonathanDLTran May 27, 2022
f2a28c0
update makefile, update tests, delete any cruft files
JonathanDLTran May 27, 2022
8987f99
move store documentation added
JonathanDLTran May 27, 2022
bf5a41c
add diospyros.cpp
JonathanDLTran May 27, 2022
3c4c8a8
add llvm2egg docs
JonathanDLTran May 27, 2022
7141454
egg2llvm docs added
JonathanDLTran May 27, 2022
ef7fd6a
pre vec load working
JonathanDLTran Mar 11, 2023
7bd80fb
add changes to veclang in src folder
JonathanDLTran Mar 12, 2023
25c03d1
get vecload to work
JonathanDLTran Mar 18, 2023
f887137
vectorization occurs succesfully on all test cases
JonathanDLTran Mar 23, 2023
bcb4528
change mat-mul benchmark to 10000 multiplications of matricies
JonathanDLTran Mar 24, 2023
e67827e
add functions only 1 in rust llvm
JonathanDLTran Mar 25, 2023
a6e4b1e
get aligned and consec stores to work
JonathanDLTran May 7, 2023
ca683bf
gather load information like offset and base of array
JonathanDLTran May 8, 2023
24584f8
get aligned generation to start working qr decomp and simple tests'
JonathanDLTran May 9, 2023
59bb456
add and test load permute
JonathanDLTran May 9, 2023
730aa01
add in llvm shuffle op
JonathanDLTran May 9, 2023
fe0893f
add more benchmarks
JonathanDLTran Jun 13, 2023
44c75b7
all tests pass for the memory checks on geps and for optimization of …
JonathanDLTran Jul 6, 2023
1c5d84a
add new constructs in veclang, though permutestore and alignedconsecs…
JonathanDLTran Jul 6, 2023
277f63e
revert fft back to while loops, remove some dead code for the gep_to_…
JonathanDLTran Jul 6, 2023
2c843fa
add the other template test
JonathanDLTran Jul 6, 2023
042f364
add 12 more basic tests
JonathanDLTran Jul 6, 2023
2a99cce
add 13 more tests with some having small randomly populated matrices
JonathanDLTran Jul 6, 2023
a269f35
refactor large matching functions with more generic function, delete …
JonathanDLTran Jul 7, 2023
0c41dc6
bring tests to 120 total, all pass
JonathanDLTran Jul 7, 2023
5dbd34b
address rewriting was not optimal
JonathanDLTran Jul 24, 2023
11c5800
add all plots
JonathanDLTran Jul 24, 2023
d4c7b78
add all data plot
JonathanDLTran Jul 24, 2023
87c8c3a
add diagrams
JonathanDLTran Jul 24, 2023
56bdff0
remove unused llvm and no opt tests
JonathanDLTran Jul 24, 2023
4b17025
move diagrams into thesis folder, add initial docs
JonathanDLTran Jul 24, 2023
c11f7af
change qr decomp
JonathanDLTran Jul 24, 2023
bdc18a5
remove data txt
JonathanDLTran Jul 24, 2023
aa284b9
new images
JonathanDLTran Jul 25, 2023
8cda4cb
modified images
JonathanDLTran Jul 25, 2023
2f54256
add llvm diagram
JonathanDLTran Jul 25, 2023
1320388
fix table
JonathanDLTran Jul 25, 2023
b07ab67
remove data file'
JonathanDLTran Jul 26, 2023
f53acde
add v1 draft thesis
JonathanDLTran Jul 30, 2023
f67cd87
move thesis into gitignored notes
JonathanDLTran Jul 30, 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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ Cargo.lock
*.out
.clang-format*
.cargo
.vscode
.vscode
polybench-tests/
notes/
531 changes: 531 additions & 0 deletions src/dios-egraphs/Diospyros/AddressRewriting.cpp

Large diffs are not rendered by default.

1,412 changes: 1,241 additions & 171 deletions src/dios-egraphs/Diospyros/LoadStoreMovement.cpp

Large diffs are not rendered by default.

76 changes: 32 additions & 44 deletions src/dios-egraphs/Diospyros/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,50 @@ ifeq ($(shell uname),Darwin)
EXT := dylib
CLANG := /usr/local/opt/llvm/bin/clang
SETUP := bash set_up_mac.sh
LIB := src/lib.rs Cargo.toml .cargo/config
LIB := src/lib.rs Cargo.toml .cargo/config
else
EXT := so
CLANG = clang
SETUP := :
LIB := src/lib.rs Cargo.toml
LIB := src/lib.rs Cargo.toml
endif

.PHONY: target/debug/libllvmlib.$(EXT)

run: set-up-mac target/debug/libllvmlib.$(EXT) diospyros.cpp
$(CLANG) -Xclang -load -Xclang target/debug/libllvmlib.$(EXT) $(test)

run-o2: set-up-mac target/debug/libllvmlib.$(EXT) diospyros.cpp
$(CLANG) -O2 -Xclang -load -Xclang target/debug/libllvmlib.$(EXT) $(test)

run-out: set-up-mac target/debug/libllvmlib.$(EXT) diospyros.cpp
$(CLANG) -Xclang -load -Xclang target/debug/libllvmlib.$(EXT) $(test)
./a.out

run-out-o2: set-up-mac target/debug/libllvmlib.$(EXT) diospyros.cpp
$(CLANG) -O2 -Xclang -load -Xclang target/debug/libllvmlib.$(EXT) $(test)
./a.out

run-all: set-up-mac target/debug/libllvmlib.$(EXT) diospyros.cpp
bash run_all.sh

emit: set-up-mac target/debug/libllvmlib.$(EXT) diospyros.cpp
$(CLANG) -Xclang -load -Xclang target/debug/libllvmlib.$(EXT) -emit-llvm -S -o - $(test)

emit-o2: set-up-mac target/debug/libllvmlib.$(EXT) diospyros.cpp
$(CLANG) -O2 -Xclang -load -Xclang target/debug/libllvmlib.$(EXT) -emit-llvm -S -o - $(test)

test-opt: set-up-mac target/debug/libllvmlib.$(EXT) diospyros.cpp
$(CLANG) -emit-llvm -S -Xclang -disable-O0-optnone -o clang.ll $(test)
opt -S --inline --mem2reg --indvars --loop-simplify --loop-instsimplify --licm --loop-unroll --simplifycfg clang.ll -o opt.ll
$(CLANG) -emit-llvm -S -Xclang -load -Xclang target/debug/libllvmlib.$(EXT) opt.ll -o finish.ll
opt -S --adce finish.ll -o final.ll

run-opt: set-up-mac target/debug/libllvmlib.$(EXT) diospyros.cpp
$(CLANG) -emit-llvm -S -Xclang -disable-O0-optnone -o clang.ll $(test)
opt -S -always-inline --inline --mem2reg --scev-aa -simplifycfg --flattencfg --indvars -loops -loop-rotate --loop-simplify --loop-idiom --loop-instsimplify --licm --unroll-threshold=1000000 --loop-unroll --simplifycfg --instcombine --gvn --mem2reg --dse --adce clang.ll -o opt.ll
opt -S --cfl-steens-aa opt.ll -o aa.ll
$(CLANG) -emit-llvm -S -Xclang -load -Xclang target/debug/libllvmlib.$(EXT) aa.ll -o diospyros.ll
opt -S --adce --dse diospyros.ll -o dce.ll
$(CLANG) dce.ll
./a.out

test: set-up-mac runt.sh runt.toml target/debug/libllvmlib.$(EXT)
runt
@$(CLANG) -target arm64-apple-macos11 -mmacosx-version-min=11.0 -emit-llvm -S -Xclang -disable-O0-optnone -o build/clang.ll $(test)
@opt -S -always-inline --inline --mem2reg --scev-aa -simplifycfg --flattencfg --indvars -loops -loop-rotate --loop-simplify --loop-idiom --loop-instsimplify --licm --unroll-threshold=1000000 --loop-unroll --simplifycfg --instcombine --gvn --mem2reg --dse --adce build/clang.ll -o build/opt.ll
@opt -S -load=target/debug/libllvmlib.$(EXT) --basic-aa --lsmovement --dse --adce build/opt.ll -o build/aa.ll
@opt -S -load=target/debug/libllvmlib.$(EXT) --diospyros -opt -print=true build/aa.ll -o build/diospyros.ll
@opt -S --adce --dse --gvn build/diospyros.ll -o build/dce.ll
@$(CLANG) -target arm64-apple-macos11 -mmacosx-version-min=11.0 build/dce.ll -o build/final
@build/final

run-slp:
@$(CLANG) -target arm64-apple-macos11 -mmacosx-version-min=11.0 -emit-llvm -S -Xclang -disable-O0-optnone -o build/clang.ll $(test)
@opt -S -always-inline --inline --mem2reg --scev-aa -simplifycfg --flattencfg --indvars -loops -loop-rotate --loop-simplify --loop-idiom --loop-instsimplify --licm --unroll-threshold=1000000 --loop-unroll --simplifycfg --instcombine --gvn --mem2reg --dse --adce build/clang.ll -o build/opt.ll
@opt -S --slp-vectorizer build/opt.ll -o build/slp.ll
@opt -S --adce --dse build/slp.ll -o build/dce.ll
@$(CLANG) -target arm64-apple-macos11 -mmacosx-version-min=11.0 -o0 build/dce.ll -o build/final
@build/final

run-baseline:
@$(CLANG) -target arm64-apple-macos11 -mmacosx-version-min=11.0 -emit-llvm -S -Xclang -disable-O0-optnone -o build/clang.ll $(test)
@$(CLANG) -target arm64-apple-macos11 -mmacosx-version-min=11.0 -O3 -fno-vectorize -fno-tree-vectorize -fno-slp-vectorize -o build/final build/clang.ll
@build/final

test: set-up-mac target/debug/libllvmlib.$(EXT) diospyros.cpp
turnt c-tests/*.c

target/debug/libllvmlib.$(EXT): $(LIB)
cargo build
@cargo build

set-up-mac:
$(SETUP)
@$(SETUP)

clean:
rm -r build/*

clean-all:
rm -rf target
rm -r build/*
52 changes: 25 additions & 27 deletions src/dios-egraphs/Diospyros/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ This directory contains an experimental [LLVM][] pass that optimizes programs us
To get started, you will need **LLVM 11.x.x**.
Using [Homebrew][] on macOS, for example, try `brew install llvm@11` to get the right version.

You will also need Rust, for the main Diospyros library, and a version of Python3, for testing using [turnt][].

Because our Rust library relies on [the `llvm-sys` crate][llvm-sys], you will need an existing installation of `llvm-config` on your `$PATH`.
To use a Homebrew-installed LLVM, for example, you may need something like this:

Expand All @@ -21,47 +23,43 @@ Add a file `.cargo/config` here, in this directory, with these [contents](https:
"-C", "link-arg=dynamic_lookup",
]

Then, build the pass library with:

$ cargo build
Further, add a build directory in your current directory with the command:

## Run the Pass
$ mkdir build

To build and run the [Clang][] pass on a test file, use this Makefile command:
If you would like, you can build the pass library with:

$ make run test=llvm-tests/a.c
$ cargo build

where `llvm-tests/a.c` is the path to any test file.
Otherwise, running with any of the commands in the next section should also work.

To build and run the Clang pass, with optimization, use the Makefile command:
Finally, note that the code for the Diospyros pass, in directory, `dios-egraphs`, must be in the directory immediately above the current one you are in, for the LLVM pass to build properly.

$ make run-opt test=llvm-tests/a.c

where `llvm-tests/a.c` is the path to any test file.
## Run the Pass

To build and see emitted LLVM IR code, , with optimization, use the Makefile command:
To build and run the [Clang][] pass, with Diospyros, use the Makefile command:

$ make run-opt test=llvm-tests/a.c
$ make run-opt test=llvm-tests/a.c

where, again, `llvm-tests/a.c` is the path to any test file.
where `llvm-tests/a.c` is the path to any test file, for insstance `c-tests/add.c`.

To emit the generated LLVM IR code, either unoptimized or optimized:
To build and run the [Clang][] pass, with Diospyros printing out the vectorization choices, use the Makefile command:

$ make emit test=llvm-tests/a.c
$ make emit-o2 test=llvm-tests/a.c
$ make print-opt test=llvm-tests/a.c

To build and run the [Clang][] pass, with no usage of Diospyros, use the Makefile command:

To build, run the [Clang][] pass, and the run the associated program `./a.out`, run:
$ make no-opt test=llvm-tests/a.c

$ make run-out test=llvm-tests/a.c
To build and see emitted LLVM IR code, run any of the above build commands for the file you are interested in, then look in the `build` directory and open the `dce.ll` file, which is the final pre-executable IR code file.

To run all the tests, run:

$ make test
$ turnt c-tests/*.c

To run all tests and get output, run:
Or alternately:

$ make run-all
$ make test

To set up macOS settings, run:

Expand All @@ -73,19 +71,19 @@ To clean the repository of build files, run:

## Testing

Test files provided in the llvm-tests/ folder can be run with [Runt][]. To install or update Runt:
Test files provided in the `c-tests/` folder can be run with [turnt][]. To install or update Turnt, run the command:

$ cargo install runt
$ pip3 install --user turnt

Then, ensure that the test files produce the right output with:

$ runt
$ turnt c-tests/*.c

You can also pass the `--diff` flag to compare your output with the `.expect` files.
You can also pass the `--diff` flag to compare your output with the `.expect` files, and use the `--save` flag to save new `.expect` files.


[llvm]: https://llvm.org
[clang]: https://clang.llvm.org
[llvm-sys]: https://crates.io/crates/llvm-sys
[homebrew]: https://brew.sh
[runt]: https://github.com/rachitnigam/runt
[turnt]: https://github.com/cucapra/turnt
Loading