GPU-accelerated DataFrame engine: Python ergonomics + Mojo AOT kernels, cross-vendor (NVIDIA/AMD/Apple).
Project description
๐ MXFrame
GPU-accelerated DataFrames โ Python ergonomics, Mojo speed, every GPU.
MXFrame is a DataFrame query engine that pairs a Polars-style Python API with pre-compiled Mojo AOT kernels. The same code runs on NVIDIA, AMD, and Apple Silicon โ no CUDA required, no JIT compilation at query time.
โจ Why MXFrame?
| pandas | Polars | cuDF (Rapids) | MXFrame | |
|---|---|---|---|---|
| GPU support | โ | โ | โ NVIDIA only | โ Any GPU |
| Compiled kernels | โ | โ Rust | โ CUDA | โ Mojo AOT |
| Install complexity | pip | pip | CUDA + Rapids stack | pixi install |
| TPC-H competitive | โ | โ | โ | โ |
| Cross-vendor | โ | โ | โ | โ NVIDIA/AMD/Apple |
MXFrame is the cuDF architecture without the CUDA lock-in.
The kernels are compiled once to a .so at build time โ loaded in ~1 ms at process start,
then pure dispatch on every query. No per-query JIT tax.
๐ฅ See how it works:
visualize/mxframe_pipeline.htmlโ interactive step-through of how a Python query becomes a plan tree and dispatches to GPU kernels. Open in any browser, no server needed.
โก Quick Start
Install (Development)### Install (Development)
โก Quick Start
# 1. Install pixi (Modular's package manager)
curl -fsSL https://pixi.sh/install.sh | bash
# 2. Clone and set up
git clone https://github.com/abhisheksreesaila/mxframe
cd mxframe
pixi install
# 3. Verify GPU is working
pixi run python3 scripts/_check_gpu.py
Your First Query
import pyarrow as pa
from mxframe import LazyFrame, Scan, col, lit
# Create an Arrow table (or load from Parquet/CSV)
data = pa.table({
"dept": pa.array(["eng", "eng", "mkt", "mkt", "eng"]),
"salary": pa.array([120.0, 95.0, 80.0, 110.0, 130.0], pa.float32()),
"age": pa.array([32, 28, 35, 29, 40], pa.int32()),
})
# Build a lazy query plan โ nothing executes yet
result = (
LazyFrame(Scan(data))
.filter(col("age") > lit(28))
.groupby("dept")
.agg(
col("salary").sum().alias("total_salary"),
col("salary").mean().alias("avg_salary"),
col("age").count().alias("headcount"),
)
.sort(col("total_salary"), descending=True)
.compute(device="gpu") # or "cpu"
)
print(result.to_pandas())
Output:
dept total_salary avg_salary headcount
0 eng 345.0 115.0 3
1 mkt 110.0 110.0 1
๐ TPC-H Benchmark โ all 22 queries
Hardware: NVIDIA RTX 3090 (sm_86) ยท AMD 12-core CPU ยท Mojo 0.26.2 AOT kernels Baselines: Polars 1.29+ ยท Pandas 3.0 ยท MXFrame CPU path ยท MXFrame GPU path Data: TPC-H schema synthetic data (numpy RNG, fixed seed) Methodology: 1 warmup run + median of 3 timed runs, per engine. Warmup primes every cache an app would have primed on query #2 in production โ so these numbers reflect steady-state dispatch, not first-call JIT cost. Source of truth:
scripts/bench_results_1M.csvandscripts/bench_results_10M.csvโ committed in repo, reproducible viascripts/benchmark_all_22.py
How the kernels dispatch
| Device | Path | Coverage |
|---|---|---|
| CPU | 100% ctypes into pre-compiled libmxkernels_aot.so |
All 22 queries โ group aggs, masked aggs, inner + left joins, gather, filter, sort, unique |
| GPU | ctypes into pre-compiled libmxkernels_aot_gpu.so |
All grouped aggs (sum/min/max/count) + masked global aggs |
| GPU | MAX Graph, shape-cached model | Hash joins only โ compiled once per (n_left, n_right) shape, cached for the session |
No per-query JIT on CPU. GPU aggregations skip MAX Graph entirely. GPU joins compile a model once per shape and reuse it โ the warmup run primes that cache.
๐ฅ Mojo Kernel Catalogue
Every operator that matters has a hand-written Mojo kernel โ there is no NumPy or PyArrow fallback in the hot path.
Source lives in kernels/, compiled once to kernels.mojopkg (MAX Graph ops) and libmxkernels_aot.so / libmxkernels_aot_gpu.so (AOT ctypes, zero session overhead).
Interactive explainer:
visualize/mxframe_pipeline.htmlโ open in any browser to step through how a Python query becomes a plan tree and dispatches to these kernels.
Grouped aggregation kernels (kernels/)
| Kernel | What it does |
|---|---|
group_sum.mojo |
Per-group sum โ shared-memory privatisation up to 8 192 groups, global-atomic fallback beyond |
group_min.mojo |
Per-group minimum โ same shared-mem / atomic-fallback design |
group_max.mojo |
Per-group maximum |
group_count.mojo |
Per-group row count (output is float32 for consistent tensor shapes) |
group_composite.mojo |
Fused multi-key composite ID: out[i] = k0[i]ยทs0 + k1[i]ยทs1 + โฆ in one memory pass |
Global (ungrouped) aggregation kernels
| Kernel | What it does |
|---|---|
masked_global_agg.mojo |
Fused masked reductions: sum, sum(aรb), min, max โ a single GPU pass computes the scalar result using only rows where mask[i]=1. No intermediate filtered-table allocation. |
Join kernels
| Kernel | What it does |
|---|---|
join_count.mojo |
Phase 1 of inner hash join โ for each left key, count matching right rows |
join_scatter.mojo |
Phase 2 of inner hash join โ emit (left_idx, right_idx) index pairs |
join_count_left.mojo |
Phase 1 of left-outer hash join โ count matches, record 1 for unmatched left rows |
join_scatter_left.mojo |
Phase 2 of left-outer hash join โ emit pairs; unmatched left rows get right_idx = -1 |
Sort, gather, and utility kernels
| Kernel | What it does |
|---|---|
sort_indices.mojo |
Bitonic sort โ returns a permutation array; used as post-op for ORDER BY on GPU |
unique_mask.mojo |
Mark out[i]=1 at the first row of each run in a sorted array; used by DISTINCT |
filter_gather.mojo |
Prefix-sum + scatter โ compact a column by a boolean mask in two passes |
AOT-only kernels (kernels_aot/)
These live in the AOT shared libraries (libmxkernels_aot.so / libmxkernels_aot_gpu.so) and are called via ctypes โ no MAX Graph session needed, cold start โ 0 ms.
| Function | What it does |
|---|---|
group_encode_i32_gpu |
GPU open-addressing hash table: assigns dense int32 group IDs to an integer key column, replacing PyArrow dictionary_encode |
masked_global_{min,max}_f32_gpu |
GPU block-reduction min/max for masked global aggregations (added Phase 1) |
gather_{f32,i32,i64}_gpu |
Coalesced GPU gather โ used after join and sort to reorder columns on-device |
1 M rows โ warm median of 3 runs (as of July 7 2026)
All times in milliseconds ยท lower is better. ๐ข = faster than Polars baseline; bold = MXFrame wins. Q1โQ7 and Q10 measured July 7 2026; remaining rows measured April 20 2026 โ same hardware, same methodology.
| Query | Description | MX CPU | MX GPU | Polars | Pandas | CPU vs Polars | GPU vs Polars |
|---|---|---|---|---|---|---|---|
| Q1 | Filter + 8 aggregations | ๐ข 11.2 | 87.2 | 36.0 | 109.1 | 3.2ร | 0.4ร |
| Q2 | Min-cost supplier | ๐ข 6.6 | ๐ข 15.6 | 16.3 | 9.5 | 2.5ร | 1.0ร |
| Q3 | 3-table join + agg | ๐ข 5.6 | ๐ข 23.3 | 26.4 | 20.4 | 4.7ร | 1.1ร |
| Q4 | Order priority | 15.0 | 192.5 | 15.0 | 29.9 | 1.0ร | 0.1ร |
| Q5 | Multi-join + groupby | ๐ข 0.6 | ๐ข 4.6 | 26.8 | 21.0 | 44.7ร | 5.8ร |
| Q6 | Masked global agg | ๐ข 6.6 | 11.4 | 10.6 | 7.6 | 1.6ร | 0.9ร |
| Q7 | Shipping volume | ๐ข 0.7 | ๐ข 10.1 | 40.1 | 21.5 | 57.3ร | 4.0ร |
| Q8 | Market share | ๐ข 0.9 | ๐ข 4.7 | 20.2 | 10.3 | 22.4ร | 4.3ร |
| Q9 | Product profit (6-table join) | ๐ข 0.6 | ๐ข 6.6 | 39.9 | 17.8 | 66.5ร | 6.0ร |
| Q10 | Customer revenue | ๐ข 3.6 | ๐ข 16.5 | 37.5 | 22.4 | 10.4ร | 2.3ร |
| Q11 | Important stock | ๐ข 0.5 | ๐ข 2.7 | 7.4 | 3.0 | 14.8ร | 2.7ร |
| Q12 | 2-table join + agg | ๐ข 1.0 | ๐ข 4.4 | 25.0 | 788.6 | 25.0ร | 5.7ร |
| Q13 | Customer distribution | ๐ข 16.2 | 30.2 | 27.5 | 33.5 | 1.7ร | 0.9ร |
| Q14 | Promo revenue | ๐ข 3.7 | ๐ข 6.3 | 8.6 | 288.6 | 2.3ร | 1.4ร |
| Q15 | Top-supplier revenue | ๐ข 1.3 | 11.8 | 9.9 | 6.4 | 7.6ร | 0.8ร |
| Q16 | Part/supplier relationships | ๐ข 2.1 | ๐ข 6.3 | 16.9 | 6.8 | 8.0ร | 2.7ร |
| Q17 | Small-qty order | ๐ข 0.3 | ๐ข 2.7 | 7.9 | 4.7 | 26.3ร | 2.9ร |
| Q18 | Large-volume customers | ๐ข 4.2 | ๐ข 22.3 | 33.4 | 16.8 | 7.9ร | 1.5ร |
| Q19 | Discounted revenue | ๐ข 10.9 | ๐ข 11.2 | 19.6 | 22.4 | 1.8ร | 1.8ร |
| Q20 | Potential part promo | ๐ข 4.3 | ๐ข 5.6 | 30.0 | 9.6 | 7.0ร | 5.4ร |
| Q21 | Suppliers who kept (EXISTS) | ๐ข 26.0 | 64.1 | 31.3 | 28.6 | 1.2ร | 0.5ร |
| Q22 | Global sales opportunity | ๐ข 7.6 | ๐ข 16.5 | 25.4 | 56.7 | 3.3ร | 1.5ร |
1 M summary: MX CPU beats Polars on 21/22 queries (Q4 tied); MX GPU beats Polars on 16/22 queries. Headline CPU wins: Q9 66ร, Q7 57ร, Q5 45ร, Q12 25ร, Q17 26ร. Headline GPU wins: Q9 6.0ร, Q5 5.8ร, Q12 5.7ร, Q20 5.4ร, Q8 4.3ร.
10 M rows โ warm median of 3 runs (as of April 20 2026)
All times in milliseconds ยท lower is better. ๐ข = faster than Polars baseline; bold = MXFrame wins. At 10M rows the join-heavy queries show the biggest wins โ the GPU kernel advantage compounds with data size.
| Query | Description | MX CPU | MX GPU | Polars | Pandas | CPU vs Polars | GPU vs Polars |
|---|---|---|---|---|---|---|---|
| Q1 | Filter + 8 aggregations | ๐ข 361.0 | 1190.7 | 946.5 | 1771.7 | 2.6ร | 0.8ร |
| Q2 | Min-cost supplier | ๐ข 5.7 | ๐ข 11.9 | 15.4 | 7.6 | 2.7ร | 1.3ร |
| Q3 | 3-table join + agg | ๐ข 57.7 | ๐ข 67.2 | 72.2 | 581.8 | 1.3ร | 1.1ร |
| Q4 | Order priority | 301.5 | 492.2 | 113.8 | 807.6 | 0.4ร | 0.2ร |
| Q5 | Multi-join + groupby | ๐ข 2.8 | ๐ข 13.8 | 60.7 | 332.9 | 21.7ร | 4.4ร |
| Q6 | Masked global agg | 399.6 | 523.2 | 92.0 | 246.4 | 0.2ร | 0.2ร |
| Q7 | Shipping volume | ๐ข 1.8 | ๐ข 16.4 | 76.4 | 392.5 | 42.4ร | 4.7ร |
| Q8 | Market share | ๐ข 1.3 | ๐ข 3.8 | 40.9 | 55.1 | 31.5ร | 10.8ร |
| Q9 | Product profit | ๐ข 0.7 | ๐ข 7.4 | 89.7 | 431.3 | 128.1ร | 12.1ร |
| Q10 | Customer revenue | ๐ข 39.2 | ๐ข 45.0 | 131.1 | 216.2 | 3.3ร | 2.9ร |
| Q11 | Important stock | ๐ข 0.4 | ๐ข 3.1 | 6.6 | 2.5 | 16.5ร | 2.1ร |
| Q12 | 2-table join + agg | ๐ข 1.3 | ๐ข 4.4 | 116.4 | 6853.6 | 89.5ร | 26.5ร |
| Q13 | Customer distribution | 385.1 | 396.1 | 285.8 | 463.9 | 0.7ร | 0.7ร |
| Q14 | Promo revenue | ๐ข 14.4 | ๐ข 16.9 | 29.7 | 2719.2 | 2.1ร | 1.8ร |
| Q15 | Top-supplier revenue | ๐ข 2.7 | 57.4 | 16.1 | 30.0 | 6.0ร | 0.3ร |
| Q16 | Part/supplier relationships | ๐ข 2.7 | ๐ข 6.5 | 16.3 | 6.8 | 6.0ร | 2.5ร |
| Q17 | Small-qty order | ๐ข 0.6 | ๐ข 1.5 | 14.6 | 17.0 | 24.3ร | 9.7ร |
| Q18 | Large-volume customers | ๐ข 46.8 | 69.4 | 63.4 | 242.8 | 1.4ร | 0.9ร |
| Q19 | Discounted revenue | ๐ข 100.4 | ๐ข 97.9 | 112.9 | 234.8 | 1.1ร | 1.2ร |
| Q20 | Potential part promo | ๐ข 32.3 | ๐ข 37.1 | 39.9 | 52.9 | 1.2ร | 1.1ร |
| Q21 | Suppliers who kept | 756.0 | 705.3 | 85.9 | 216.6 | 0.1ร | 0.1ร |
| Q22 | Global sales opportunity | ๐ข 54.1 | ๐ข 59.2 | 132.8 | 1292.1 | 2.5ร | 2.2ร |
10 M summary: MX CPU beats Polars on 18/22 queries; MX GPU beats Polars on 15/22. ๐ข Join-heavy queries scale dramatically: Q9 128ร, Q12 89ร, Q7 42ร, Q8 31ร, Q17 24ร, Q5 22ร CPU vs Polars. GPU join wins: Q12 26.5ร, Q9 12ร, Q8 10.8ร, Q17 9.7ร. At 10M, Q4/Q6/Q13/Q21 show Polars' strength on pure CPU-vectorised operations โ these are Phase 6 targets (GPU string encoding + device-resident joins).
Where MXFrame loses (same at both scales)
- Q4, Q6, Q13, Q21 โ operations where our kernel path falls back to PyArrow compute or does extra passes. These are the focus of the next milestone (see
roadmap.md).
What the numbers mean
- Correctness โ โ all 22 queries return results that round-trip through Pandas and match Polars output.
- Coverage โ โ every TPC-H query has a CPU AOT path; all group aggs/masked aggs have GPU AOT paths; GPU joins use shape-cached MAX Graph models.
- No JIT tax in steady state โ after the first query of each shape warms the GPU join model cache, every subsequent call is pure dispatch. The CPU path has no JIT at all.
- Why GPU doesn't always win โ GPU wins scale with workload size and kernel coverage. At 10 M, GPU crushes Polars on the join-heavy queries (Q8/Q9/Q12) where Mojo's shape-cached kernels pay off. Where GPU loses, it's either PCIe overhead on tiny outputs (Q1, Q6) or ops that still route through PyArrow fallback (Q4, Q13, Q21).
โ ๏ธ Current Limitations: Where PyArrow and NumPy Still Run
MXFrame is not 100% Mojo end-to-end โ and that is a deliberate, documented trade-off, not a hack. The computational hot path (aggregation, joins, sort, gather) is fully Mojo-compiled. Certain orchestration steps still use PyArrow or NumPy for specific technical reasons explained below.
What still runs in PyArrow / NumPy
| Operation | Library used | Technical reason |
|---|---|---|
String predicate masks โ isin, startswith, contains, == on string cols |
PyArrow compute (SIMD C++) | GPU string kernels require UTF-8 variable-length storage. The mask itself is cheap (microseconds at 1M rows); the expensive aggregation or join that follows still runs on GPU. |
String group-key encoding โ e.g. l_returnflag, n_name |
PyArrow dictionary_encode |
Phase 3 added GPU hash-table encoding for integer keys. String hashing on GPU requires a variable-length string type not yet in the kernel set. Result is cached after the first call โ zero cost on hot runs. |
| Table assembly after joins โ string and date columns | pa.Table.take() |
Numeric columns (float32, int32) are already gathered on GPU via gather_f32/i32_gpu. String and date columns have no GPU column representation yet, so they are gathered on CPU via Arrow's optimised .take(). |
| Intermediate table materialisation between join and aggregation | pa.Table.from_arrays |
After a join, the result is stored as a CPU Arrow table before the next plan step. Phase 4 removes this round-trip โ see Roadmap below. |
Window functions โ rank, dense_rank, lag, lead, cum_sum |
NumPy | These are not required by any of the 22 TPC-H queries. They exist in the API for completeness; GPU ports are Phase 7+. |
| DISTINCT | pa.Table.group_by().aggregate([]) |
Always applied as a post-op on an already-aggregated result (typically < 1 000 rows). The cost is negligible; porting it is not a priority. |
| Plan-level orchestration โ predicate push-down, join reorder, filter merge | Pure Python | This is metadata, not data movement. No rows are touched here. |
Why the benchmarks are still honest
The benchmark methodology uses 1 warmup run + median of 3 timed runs. The warmup run primes three caches:
_GROUP_ENCODE_CACHEโ group-key dictionary encoding result (PyArrow SIMD, runs once per unique(table, keys)pair)_INPUT_PREP_CACHEโ column array preparation and filter masking_JOIN_RESULT_CACHEโ join outputpa.Table(same input tables โ same result)
After warmup, the 3 timed runs do zero PyArrow encoding and zero re-upload of stable column data. They measure pure kernel dispatch + GPU execution โ which is the steady-state production cost.
Cold-run numbers (first query after clear_cache()) are higher because encoding and upload happen once.
That is a real cost and Phase 4 reduces it for join-heavy queries.
๐บ๏ธ Roadmap: Remaining Mojo Work
The table below lists what remains to make MXFrame fully GPU-native. Items are ordered by performance impact, not difficulty.
| Phase | What | Queries affected | Status |
|---|---|---|---|
| Phase 4 | Device-resident join pipeline โ after gather_f32/i32_gpu produces gathered columns keep them as device buffers; feed directly into group_sum_f32_gpu without pa.Table.from_arrays round-trip |
Q3, Q5, Q7, Q8, Q9, Q10, Q18, Q21 | ๐ฒ Planned |
| Phase 5 | GPU top-k kernel โ ORDER BY โฆ LIMIT n via per-block heap; avoids full bitonic sort of large intermediates before the final slice |
Q3, Q5, Q8, Q9, Q20, Q21 | ๐ฒ Planned |
| Phase 6 | GPU string/category encoding โ open-addressing hash table for variable-length keys, replaces PyArrow dictionary_encode for string group-by columns |
Q1, Q4, Q5, Q7, Q8, Q9, Q12 | ๐ญ Future |
| Phase 7 | GPU string predicate evaluation โ isin, startswith, contains on GPU; eliminates PyArrow boolean mask for string filters |
Q4, Q12, Q16, Q19 | ๐ญ Future |
| Phase 8 | GPU window functions โ rank, dense_rank, lag, lead, cum_sum |
Non-TPC-H workloads | ๐ญ Future |
Why Phases 4โ5 are the highest ROI
Phases 4 and 5 target the cold-run round-trip: the CPU pa.Table that currently sits between a join and its downstream aggregation.
On hot runs this round-trip is already eliminated by the join-result cache โ so steady-state benchmark numbers are unaffected.
On cold runs (fresh process, first query of a new shape), removing pa.Table.from_arrays + re-upload can save 20โ80 ms for 1M-row join intermediates.
Phases 6 and 7 target operations that are already SIMD-fast in PyArrow C++ and already cached after the first call. They matter most for workloads that constantly see new table instances (streaming, per-request analytics) where the cache cannot absorb the encoding cost.
Current GPU coverage:
python scripts/audit_gpu_paths.py --device gpu --min-gpu-coverage 0.8exits 0 with 22/22 queries GPU-CLEAN (100%) โ every computationally heavy operator reaches a Mojo GPU kernel. The remaining PyArrow code is orchestration and string handling, not the reduction or join bottleneck.
๐ Reproducing the Benchmark
To run the benchmark with official TPC-H data (generated by DuckDB's
faithful port of the TPC-H dbgen tool):
# Step 1 โ generate TPC-H data (requires: pip install duckdb)
# SF=1 โ ~6M lineitem rows, ~200 MB Parquet
# SF=0.1 โ ~600K rows, quick sanity check
pixi run python3 scripts/gen_tpch_parquet.py --sf 1
# Step 2 โ run the 22-query benchmark against real data
pixi run python3 scripts/bench_real_tpch.py --data-dir data/tpch_sf1 --runs 3
The generated data/tpch_sf1/ directory contains 8 Parquet files (one per
TPC-H table) that you can inspect, share, or version-control.
Scale factor guide
--sf |
lineitem rows | approx size | use case |
|---|---|---|---|
| 0.01 | ~60K | 2 MB | smoke test / CI |
| 0.1 | ~600K | 20 MB | local dev |
| 1 | ~6M | 200 MB | standard published benchmark |
| 10 | ~60M | 2 GB | stress test |
Data lineage & legal note
- Data is generated by DuckDB's TPC-H extension โ a faithful port of the
official TPC-H
dbgenv3.0.1 with the same value distributions (uniform, Zipfian, pseudo-random vocab). - TPC-Hยฎ is a trademark of the Transaction Processing Performance Council. These results are an independent, non-certified benchmark. They may not be reported as "TPC-H results" without formal TPC certification.
- Reference: https://www.tpc.org/tpch/
๐ค API Reference
LazyFrame
from mxframe import LazyFrame, Scan, col, lit, when
lf = LazyFrame(Scan(arrow_table))
| Method | Description | Example |
|---|---|---|
.filter(expr) |
Row filter | .filter(col("x") > lit(10)) |
.select(*cols) |
Column projection | .select("a", "b", col("c").alias("d")) |
.with_columns(*exprs) |
Add/replace columns | .with_columns((col("a") * lit(2)).alias("a2")) |
.groupby(*keys) |
Start grouped agg | .groupby("dept", "region") |
.join(other, left_on, right_on, how) |
Hash join | .join(lf2, "id", "fk_id", how="inner") |
.sort(expr, descending) |
Sort rows | .sort(col("revenue"), descending=True) |
.limit(n) |
Take first N rows | .limit(100) |
.distinct() |
Deduplicate rows | .distinct() |
.compute(device) |
Execute the plan | .compute(device="gpu") |
Expressions (col, lit, when)
# Arithmetic
col("price") * (lit(1.0) - col("discount"))
# Comparison
col("date") >= lit(19940101)
# Boolean combine
(col("x") > lit(0)) & (col("y") < lit(100))
# Conditional
when(col("nation") == lit("BRAZIL"), col("revenue"), lit(0.0))
# String
col("phone").startswith("13")
# Date parts
col("orderdate").year() # extract year as int32
# Aggregations (inside .agg())
col("salary").sum()
col("salary").mean()
col("salary").min()
col("salary").max()
col("id").count()
SQL Frontend
from mxframe.sql_frontend import sql
result = sql("""
SELECT dept, SUM(salary) AS total, COUNT(*) AS n
FROM employees
WHERE age > 30
GROUP BY dept
ORDER BY total DESC
""", employees=arrow_table)
๐ง Supported Operations
| Category | Operations |
|---|---|
| Filter | >, >=, <, <=, ==, !=, &, |, ~, isin, startswith, contains |
| Aggregation | sum, mean, min, max, count |
| Groupby | Single key, multi-key, composite key |
| Join | Inner, Left outer |
| Sort | Single/multi column, ascending/descending |
| Window | year() date part extraction |
| Projection | select, with_columns, alias, arithmetic expressions |
| Semi-join | Via unique-key inner join |
| Anti-join | Via pc.is_in + pc.invert |
| Distinct | Full row deduplication |
| SQL | SELECT, FROM, WHERE, GROUP BY, ORDER BY, LIMIT, JOIN |
๐ Project Structure
mxframe/
โโโ __init__.py โ Public API (LazyFrame, Scan, col, lit, when, sql)
โโโ lazy_frame.py โ LazyFrame, LazyGroupBy, Scan
โโโ lazy_expr.py โ Expr, col(), lit(), when()
โโโ compiler.py โ LogicalPlan โ MAX Graph compiler
โโโ custom_ops.py โ Dispatch: AOT kernels / MAX Graph / PyArrow fallback
โโโ optimizer.py โ Plan rewrites (filter pushdown, join reordering)
โโโ plan_validation.py โ Pre-execution plan checks
โโโ sql_frontend.py โ SQL โ LogicalPlan via sqlglot
โ
โโโ kernels_aot/ โ Pre-compiled AOT shared libraries
โ โโโ libmxkernels_aot.so โ CPU kernels (ctypes-callable)
โ โโโ libmxkernels_aot_gpu.so โ GPU kernels (CUDA/ROCm/Metal)
โ
โโโ kernels/ โ Mojo kernel source (build time only)
โ โโโ group_sum.mojo, group_min.mojo, group_max.mojo ...
โ โโโ join_scatter.mojo, join_count.mojo
โ โโโ join_scatter_left.mojo, join_count_left.mojo
โ โโโ filter_gather.mojo, gather_rows.mojo, unique_mask.mojo ...
โ
โโโ kernels_aot/
โ โโโ kernels_aot.mojo โ CPU AOT entry points
โ โโโ kernels_aot_gpu.mojo โ GPU AOT entry points
โ
โโโ scripts/
โ โโโ bench_simple.py โ Clean 4-col benchmark (Pandas|Polars|MX CPU|MX GPU)
โ โโโ benchmark_tpch.py โ All 22 TPC-H query implementations
โ โโโ _test_aot_smoke.py โ AOT kernel smoke tests
โ โโโ quickstart.py โ Minimal hello-world example
โ
โโโ docs/
โโโ vision-and-architecture.md
โโโ CONTRIBUTING.md โ Developer guide
โโโ PUBLISHING.md โ pip release steps
๐ฅ๏ธ Device Selection
# CPU (default, works everywhere)
result = lf.compute(device="cpu")
# GPU (requires NVIDIA/AMD/Apple Silicon with MAX runtime)
result = lf.compute(device="gpu")
The GPU path uses Mojo's DeviceContext โ the same source compiles to:
- PTX on NVIDIA (CUDA-compatible)
- HSA/ROCm on AMD
- Metal on Apple Silicon
๐งช Running Tests
# Smoke tests โ AOT kernels
pixi run python3 scripts/_test_aot_smoke.py
# All TPC-H correctness checks
pixi run python3 scripts/_test_phase6_tpch_tier2.py
# GPU check
pixi run python3 scripts/_check_gpu.py
# Full 22-query benchmark
pixi run python3 scripts/bench_simple.py --rows 1000000 --runs 3
๐ฆ Dependencies
| Package | Required | Purpose |
|---|---|---|
pyarrow >= 14 |
โ | Column storage, zero-copy NumPy bridge |
numpy >= 1.24 |
โ | Vectorized pre/post processing |
pandas >= 2.0 |
โ | Reference implementations, Pandas bridge |
modular >= 26.2 |
GPU only | MAX Engine runtime, Mojo GPU dispatch |
polars >= 0.20 |
optional | Polars bridge + benchmark comparison |
sqlglot >= 25 |
optional | SQL frontend parsing |
๐ค Contributing
See CONTRIBUTING.md for the developer guide, kernel writing guidelines, and how to add new TPC-H queries.
๐ License
Apache 2.0 โ see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mxframe-0.2.1.tar.gz.
File metadata
- Download URL: mxframe-0.2.1.tar.gz
- Upload date:
- Size: 2.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
256991870a950ef70abaea4a656becda88de5cb82b28c0d0f9bbbd97cdf30b42
|
|
| MD5 |
5587a8a52004e06033b8917b3aad523f
|
|
| BLAKE2b-256 |
cdcd3a11c10ba83e999e7efb89d15b390429db9f63b2e4bc28e42969ad0085d9
|
Provenance
The following attestation bundles were made for mxframe-0.2.1.tar.gz:
Publisher:
publish.yml on abhisheksreesaila/mxframe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mxframe-0.2.1.tar.gz -
Subject digest:
256991870a950ef70abaea4a656becda88de5cb82b28c0d0f9bbbd97cdf30b42 - Sigstore transparency entry: 2110512924
- Sigstore integration time:
-
Permalink:
abhisheksreesaila/mxframe@bfc8c36897ad7c6b9a2173bcc37f79a0c4a62afa -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/abhisheksreesaila
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bfc8c36897ad7c6b9a2173bcc37f79a0c4a62afa -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file mxframe-0.2.1-py3-none-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: mxframe-0.2.1-py3-none-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 2.1 MB
- Tags: Python 3, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1158b470de02a17995235639b39ebf150f0acf5722799e73c0d7bce5c1a50e4
|
|
| MD5 |
a2b1aded17c1a884798fc30d9c27f935
|
|
| BLAKE2b-256 |
4a50a84dec947f002533e5aa7a4dc2ce86c3ca79bec8491c9ae455f8c5207b8c
|
Provenance
The following attestation bundles were made for mxframe-0.2.1-py3-none-manylinux_2_34_x86_64.whl:
Publisher:
publish.yml on abhisheksreesaila/mxframe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mxframe-0.2.1-py3-none-manylinux_2_34_x86_64.whl -
Subject digest:
b1158b470de02a17995235639b39ebf150f0acf5722799e73c0d7bce5c1a50e4 - Sigstore transparency entry: 2110513312
- Sigstore integration time:
-
Permalink:
abhisheksreesaila/mxframe@bfc8c36897ad7c6b9a2173bcc37f79a0c4a62afa -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/abhisheksreesaila
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bfc8c36897ad7c6b9a2173bcc37f79a0c4a62afa -
Trigger Event:
workflow_dispatch
-
Statement type: