Coder Social home page Coder Social logo

etch's Introduction

Etch

This repository implements indexed streams, a representation for fused contraction programs like those found in sparse tensor algebra and relational algebra.

Correctness proofs and compiler are written in the Lean 4 language.

Directory structure

Compiler and benchmarks

etch4
├── Etch                          # the compiler
│   ├── Basic.lean                # compiler core
│   ├── C.lean
│   ├── Compile.lean
│   ├── LVal.lean
│   ├── Op.lean
│   ├── ShapeInference.lean
│   ├── Stream.lean
│   ├── Add.lean                  # basic streams
│   ├── Mul.lean
│   ├── Benchmark.lean            # benchmark queries
│   ├── Benchmark
│   │   └── ...
│   ├── Verification              # stream model formalization
│   │   └── README.md
│   ├── KRelation.lean            # work in progress
│   ├── Omni.lean
│   └── InductiveStream…
├── Makefile                      # workflows
├── bench                         # benchmark auxiliary files (SQL files, data generators, etc.)
│   └── ...
├── bench-….cpp                   # benchmark drivers
├── common.h
├── operators.h
├── graphs                        # run benchmarks; plot graphs
│   └── ...
├── taco                          # TACO-compiled kernels as baseline
│   └── ...
└── taco_kernels.c

Build compiler and proofs

First install Lean 4. In the etch4 directory, run

lake update
lake exe cache get
lake build

Then, load Etch/Benchmark.lean in your editor.

Compile benchmarks

While loading the Etch/Benchmark.lean in your editor, Lean will automatically compile all the benchmarks and write them to etch4/gen_….c.

Alternatively, you can compile by running make gen_tpch_q5.c FORCE_REGEN=1.

Running benchmarks

Only Linux is supported right now.

Dependencies you need to have before running any benchmarks:

Other dependencies (e.g., baselines) are automatically downloaded by the Makefile.

Run individual benchmarks

You can run an individual benchmark by calling make. Here are some examples:

make run-tpch-x1-q5-duckdb
make run-tpch-x1-q5-duckdbforeign
make run-tpch-x1-q5-etch
make run-tpch-x1-q5-sqlite

make run-wcoj-x1000-etch

If any test data need to be (re-)generated, the above commands will automatically do so.

For a full list of supported targets, run make list-benchmarks.

Run all benchmarks

Run graphs/run.sh. This will run all the benchmarks shown in our PLDI 2023 paper, and save the results in bench-output/.

Note: this will take a long time (≥1.5 hours).

Generate graphs

Make sure all the benchmarks have been run with graphs/run.sh.

Make sure the benchmark results are stored in bench-output/.

Make sure you have Poetry (a Python package manager) installed.

Then run:

cd graphs
poetry install
poetry shell
cd ..
python graphs/graph.py

Graphs will be generated in PDF form in the root directory.

Running benchmarks in Docker

We also provide a Dockerfile to simplify the process of setting up an environment. This is primarily useful for artifact evaluation. See graphs/Dockerfile for details.

If you will be developing Etch locally, we recommend going through the previous steps instead.

Publications

This repository implements indexed streams as defined in the paper:

Scott Kovach, Praneeth Kolichala, Tiancheng Gu, and Fredrik Kjolstad. 2023. Indexed Streams: A Formal Intermediate Representation for Fused Contraction Programs. To appear in Proc. ACM Program. Lang. 7, PLDI, Article 154 (June 2023), 25 pages. https://doi.org/10.1145/3591268

Old Correctness proofs

These were written originally but recently automatically ported to Lean4.

.
└── src
    └── verification
        ├── code_generation           # WIP code generation proofs
        │   └── ...
        ├── semantics                 # correctness proofs
        │   ├── README.md
        │   └── ...
        └── test.lean

Build old proofs

First install Lean 3. In the root directory, run

leanproject get-mathlib-cache
leanproject build

etch's People

Contributors

kovach avatar prakol16 avatar kmill avatar timothygu avatar fredrikbk avatar david-broman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.