← All projects
Project record1 mention
Originally shared on Hacker News

xarray-sql

A demo that automatically deduces a FlashAttention kernel from ~25 lines of SQL expressing vanilla attention, built on three portable SQL extensions the submitter is building: xarray-sql (represents petabyte-scale array datasets in the cloud as relational tables), ddx (adds JAX-style automatic differentiation to standard SQL), and einfold (a modular query planner for fast tensor contractions in vanilla SQL).

Last shared
01 / The problem

What it addresses

The submitter's thesis is that separating the logical layers in a tensor program from the physical layers is both more correct and more scalable, using the relational model and algebra as a fresh perspective on accelerator programming.

02 / Source history

Shared over time

Each entry reflects what was shared on that date. Details may have changed since then.

  1. xarray-sql

    A demo that automatically deduces a FlashAttention kernel from ~25 lines of SQL expressing vanilla attention, built on three portable SQL extensions the submitter is building: xarray-sql (represents petabyte-scale array datasets in the cloud as relational tables), ddx (adds JAX-style automatic differentiation to standard SQL), and einfold (a modular query planner for fast tensor contractions in vanilla SQL).

    Problem: The submitter's thesis is that separating the logical layers in a tensor program from the physical layers is both more correct and more scalable, using the relational model and algebra as a fresh perspective on accelerator programming.

    Posted by @alxmrs · Original source ↗

    Story title · @alxmrs · · Source ↗

    Show HN: Automatic deduction of FlashAttention kernel from ~25 lines of SQL

    Source text · @alxmrs · · Source ↗

    In this demo, we automatically deduce a FlashAttention kernel with ~25 lines of SQL, which just expresses vanilla attention.

    Source text · @alxmrs · · Source ↗

    xarray-sql: a library that efficiently represents petabyte scale array datasets in the cloud as tables (relations).

    Source text · @alxmrs · · Source ↗

    ddx: a database extension that adds automatic differentiation in the style of JAX to standard SQL, assuming the above array data model.

    Source text · @alxmrs · · Source ↗

    einfold: a modular query planner for fast tensor contractions in vanilla SQL, again, assuming the above array data model.

    Submitted URL · @alxmrs · · Source ↗

    https://github.com/xqlsystems/xarray-sql/blob/6debe2495dcb4e8fac20ab97df5b89baae2a31a6/benchmarks/ml/01_attention.py

    Source text · @alxmrs · · Source ↗

    join us on Discord at https://xql.systems

    Source text · @alxmrs · · Source ↗

    Here, our thesis is that separating the logical layers in a tensor program from the physical layers is both more correct and more scalable.