Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,40 @@ versions (0.x) may contain breaking changes; they are always listed under a
deferred and do not exist. An io_uring comment named a test file that does
not exist; it names the test that does.

- **NULL elements inside a vector column survive a GPU filter or join**
(#105). The device transfer format carries one validity bit per row, so a
NULL element inside a valid `FixedSizeList<Float32>` row came back from a
CUDA or Metal filter, or a CUDA join, as a valid `0.0`, where the CPU path
kept it NULL. Such a column now stays on the host, as a `Utf8` column
does, and is gathered at the rows the device selected; the rest of the
batch still runs on the device. `columns::extract` refuses one as
`Unsupported`, so a vector distance over it, whose kernel has to read the
column, runs on the CPU reference, counted in `fallback_batches`, with the
same distances. NULL elements under a NULL row, which a builder's
`append_null` leaves, do not count. New:
`columns::row_with_null_element`.

- **A `Float64` filter planned for a GPU returns the rows `--target cpu`
returns, over NaN and `-0.0` too** (#28). A `--target cuda` or
`--target metal` filter, or a cluster's GPU placement, could select other
rows than `--target cpu` for two kinds of value. A NaN: the CUDA kernel
compared with plain IEEE `>` and `=`, where a NaN matches nothing, but
DataFusion orders floats by IEEE totalOrder, so `v > 4.0` selects a NaN
(a NaN sorts above `+inf`; one with its sign bit set, x86's default NaN,
below `-inf`). And `-0.0`: DataFusion 55 reads it as `+0.0` in a
comparison (`-0.0 = 0.0` is true; under 0.2.0's DataFusion 54 it was
false on every target), but the CPU reference did not — and the
reference is what runs every `Float64` predicate on Metal, any
GPU-planned query on a machine without that GPU, and every per-batch
fallback — so there `v = 0.0` skipped the `-0.0` rows and `v < 0.0`
returned them. Both now compare as DataFusion 55 does; only rows holding
a NaN or a `-0.0` come back differently. New: `oxide gen-data
--special-floats`, which puts NaN, ±0.0 and ±inf into `v` on every 16th
row to compare targets on (the default table is unchanged), and behind it
`DemoOptions`, `write_demo_table_with`, `demo_batches_with`,
`demo_chunks_with`, `SPECIAL_FLOATS` and `SPECIAL_FLOAT_EVERY` in
`oxidelake-storage`.

### Security

- **thrift is out of the dependency graph** (#4, #54). parquet 59 decodes
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ error, never a silent fallback.
| `--seed` | `gen-data` | `42` | PRNG seed. The same seed always writes the same bytes. |
| `--row-group-rows` | `gen-data` | `65536` | Rows per Parquet row group. |
| `--compression` | `gen-data` | `zstd` | `none`, `lz4` or `zstd`. |
| `--special-floats` | `gen-data` | off | Puts IEEE special values into `v` on every 16th row — NaN, -0.0, +0.0, +inf, -inf and a negative NaN, in turn — to compare backends where float comparison is subtle. Every other value, and the default table, stay the same. |

### `oxide-scheduler`

Expand Down
6 changes: 4 additions & 2 deletions STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ Filled in as phases complete. Every component goes under exactly one column —
| `CudaBackend` (dynamic loading, NVRTC pipeline, transfers, upload/download) | driver probe + typed error on GPU-less box; **(T4)** `cargo test -p oxidelake-device --features cuda -- --include-ignored` — transfers, pinned memory round trip, NVRTC compile + launch all executed | | |
| `CudaPinnedProvider` / `PinnedBuf` | **(T4)** pinned allocation and H2D/D2H through it (`transfers_and_pinned_memory_round_trip_on_device`) | | |
| `MetalBackend`, `MetalSharedBuffer`, Metal kernel dispatch (filter+project, vector distance) | **(macOS)** conformance suite on the real device: `cargo test -p oxidelake-compute --features metal -- --ignored` — `HardwareDetector` selects Metal, MSL compiles via `newLibraryWithSource`, Int64 filter + vector distance dispatch on the GPU and equal stock DataFusion, **and the test asserts device execution through the operator's transfer counters (`bytes_h2d`/`bytes_d2h` > 0), so equal results cannot be mistaken for a silent CPU fallback**; join/aggregate are declared unsupported up front and take the CPU path without uploading; `oxidelake-device`/`oxidelake-memory`/`oxidelake-runtime` metal suites green. Correction (2026-09-02): until the operator layer learned to keep `Utf8` columns on the host, the suite's fixtures (which all carry a `Utf8` column) made every operator fall back to the CPU on Metal, so the earlier version of this row over-claimed — real Metal dispatch had only been exercised by the Int64-only queries in `oxidelake-runtime/tests/embedded.rs` | | |
| CUDA kernel sources (`crates/oxidelake-device/kernels/cuda/*.cu`) + launch orchestration (`cuda/ops.rs`) | embedded-source and scan-helper unit tests; **(T4)** every kernel NVRTC-compiled and launched (the hash join and `aggregation.cu` as they were in 0.2.0: see the next two rows): conformance suite `OXIDE_BACKEND=cuda cargo test -p oxidelake-compute --features cuda -- --ignored` equal to stock DataFusion (3 seeds × 5 sizes × filter/join/aggregate/vector L2+cosine) **with the transfer-counter witness (`bytes_h2d`/`bytes_d2h` > 0)**; the aggregation kernel's group-table publication bug (below) fixed and re-verified | | |
| CUDA kernel sources (`crates/oxidelake-device/kernels/cuda/*.cu`) + launch orchestration (`cuda/ops.rs`) | embedded-source and scan-helper unit tests; **(T4)** every kernel NVRTC-compiled and launched (the hash join and `aggregation.cu` as they were in 0.2.0: see the next two rows): conformance suite `OXIDE_BACKEND=cuda cargo test -p oxidelake-compute --features cuda -- --ignored` equal to stock DataFusion (3 seeds × 5 sizes × filter/join/aggregate/vector L2+cosine) **with the transfer-counter witness (`bytes_h2d`/`bytes_d2h` > 0)**; the aggregation kernel's group-table publication bug (below) fixed and re-verified | | `filter_project.cu`'s `Float64` comparison as changed for #28 (DataFusion's order: NaN above `+inf`, `-0.0` = `+0.0`): not NVRTC-compiled or run anywhere yet — `gpu_backend_filters_special_floats_like_datafusion_when_available` (`--ignored`) is for the next T4 run |
| `hash_join.cu` as rewritten for 0.3.0 (`oxide_hj_count`, `oxide_hj_expand` over a distinct-key index the host builds) and its launch orchestration (#45, #95, #108) | the host index (`join_slots`: placement, a replica of the device probe loop, the slot reads per probe row for #108's four build shapes) unit-tested in `oxidelake-device`; the operator's device path (prepare once, probe, gather in pieces, finish on the CPU from the same match) through a fake backend in `oxidelake-compute`. The kernel source itself only under **g++ with a shim of the CUDA builtins, thread by thread, against a nested-loop join** (2026-11-17, ASan + UBSan, a harness outside the repository; both kernels only read shared state, so a sequential run computes what the device does) — **not NVRTC, not a GPU** | `cuda/ops.rs` join section: `make check-cuda lint-cuda` | NVRTC compile + launch on the T4: `OXIDE_BACKEND=cuda cargo test -p oxidelake-compute --features cuda -- --ignored` (conformance join, including the chunked one) and `--test join_timing -- --ignored --nocapture` (timings; the file also runs unchanged on 08a9147 for the before) |
| `aggregation.cu` as changed for 0.3.0 (`oxide_agg_number_groups`, accumulators and read-back of one entry per group) and its launch orchestration (#45, the aggregate half) | the host half (`finish_groups`: groups numbered in any order come back sorted by key, `NULL` group last) unit-tested under `--features cuda`; a device result merged per batch through a fake backend in `oxidelake-compute` (#29). The kernel source itself only under **g++ with a shim of the CUDA builtins, thread by thread, against a host reference** (2026-11-18, ASan + UBSan, a harness outside the repository: no rows, only `NULL` keys, one key, a group per row, extreme keys, 100 keys in 65 536 rows; a sequential run cannot exercise the slot-claim race, whose protocol did not change), and compiled to PTX for sm_75 by clang 21 against stubbed SDK atomics — **not NVRTC, not a GPU** | `cuda/ops.rs` aggregate section: `make check-cuda lint-cuda`, `cargo clippy -p oxidelake-device --features cuda --all-targets` | NVRTC compile + launch on the T4: `cargo test -p oxidelake-device --features cuda -- --ignored` (`aggregate_numbers_groups_like_the_reference` and the three older aggregate tests), `OXIDE_BACKEND=cuda cargo test -p oxidelake-compute --features cuda --test conformance -- --ignored` (the aggregate checks, now also in 7-row batches) and `--test aggregate_timing -- --ignored --nocapture` (timings of a 10M-row `GROUP BY` with 100 keys; the file also runs unchanged on 08a9147 for the before) |
| Metal kernel sources (`crates/oxidelake-device/kernels/metal/*.metal`) | **(macOS)** MSL runtime compile + dispatch, exercised by the conformance suite above | | |
| `Gpu*Exec` operators (filter+project, hash join, aggregate, vector distance) on `CpuBackend` | conformance suite vs stock DataFusion; EXPLAIN tags; per-batch CPU fallback path; **(macOS)** same suite executed on `MetalBackend`; **(T4)** same suite executed on `CudaBackend` | | |
| `Gpu*Exec` operators (filter+project, hash join, aggregate, vector distance) on `CpuBackend` | conformance suite vs stock DataFusion; EXPLAIN tags; per-batch CPU fallback path; the device transfer format without a device (`TransferSim`, a CUDA-claiming backend whose uploads and downloads go through `columns`): vector columns with NULL elements through filter, join and vector distance, with the transfer counters as witness of which path ran (#105); `Float64` filters over NaN (both signs), ±0.0, ±inf and subnormals, against stock DataFusion and against its order written out by hand (#28); **(macOS)** same suite executed on `MetalBackend`; **(T4)** same suite executed on `CudaBackend` | | the same #105 checks on a device (`gpu_backend_keeps_null_vector_elements_when_available`, `--ignored`): not run on Metal or the T4 yet; nor the #28 special-float filters (`gpu_backend_filters_special_floats_like_datafusion_when_available`, `--ignored`) |
| `GpuOperator` fallback + telemetry, `local_backend()` selection | unit + conformance tests (CPU); **(T4)** CUDA streams and transfer accounting through the conformance witness; a 1M-row `oxide sql … --target cuda` with `RUST_LOG=oxidelake_compute=debug` logged **no** per-batch CPU fallback (since 0.2.0 the same claim is a counter, `fallback_batches`, in the Inspector panel and in every `OperatorSnapshot`, rather than something only a raised log level can see — #32) | | |
| Parquet writer options + `write_parquet` (row groups, dictionaries, Bloom filters on keys, page statistics) | unit test inspects row-group/Bloom metadata; a refused, failed or abandoned write leaves the file it would replace untouched (`parquet_io`/`datagen` unit tests, `oxide gen-data --row-group-rows 0` in `tests/cli.rs`, #119) | | |
| DataFusion pruning settings + `scan_pruning_metrics` proof (statistics, Bloom filter, page index) | `tests/pruning.rs` on a 200k-row / 100-row-group dataset | | |
Expand Down Expand Up @@ -78,6 +78,7 @@ Resolved 2026-11-11 for the Ballista 55 bump (`cargo tree`, 593 crates in `Cargo
- **Third correctness bug, found on the first CUDA machine (2026-09-06, Tesla T4):** `oxide_ag_slot` in `aggregation.cu` let a thread that lost the CAS for a group-table slot compare the slot's key through a plain load after spinning on the state word. That load could observe the pre-publication key, so the loser probed on and inserted the same key in a second slot; every pass-2 lookup resolved to the first slot, and the host emitted the phantom as a duplicate group with `COUNT` 0 and `NULL` aggregates (`3|NULL|0|NULL|NULL` next to the real `3|489.0|40|…`). Deterministic on the T4 for the demo table (100 keys, 4000 rows) — the compute conformance suite's 10-key fixtures never hit it. Fix: the state and key are read through `volatile` loads with a fence between them that pairs with the publisher's fence; lookups in later launches need neither. Regression test at the device layer: `aggregate_matches_host_on_the_demo_distribution` (`#[ignore]`, needs a GPU), red on the old kernel and green on the fix on the same machine. Lesson, same as the Metal one: "compiles with `--features cuda`" is not a verification status; the row above says what ran.
- **Second correctness bug, found running the README's 1M-row quickstart against a real cluster (2026-09-01):** the aggregate lowering replaced the Final/Partial pair *and the exchange between them*, leaving `GpuAggregateExec` directly over a multi-partition scan. Embedded mode is fine (the exec collects every input partition itself), but Ballista cuts shuffle stages exactly at exchange nodes (`CoalescePartitionsExec` / `RepartitionExec` / `SortPreservingMergeExec`), so the distributed plan lost every scan partition but one — `SUM(v)` came back ~16× too small. Every earlier cluster test used files under DataFusion's 10 MiB `repartition_file_min_size`, so scans were never byte-range-split and the shape never existed. Fix: the rule now keeps one `CoalescePartitionsExec` under `GpuAggregateExec` whenever the source is multi-partition; `cluster_sql_matches_embedded_sql` now generates an 11 MiB file so the multi-partition shape is pinned in CI; verified by hand that the 1M-row cluster output is byte-identical to embedded. Since 0.3.0 the rule no longer replaces the exchange at all: it lowers the two halves separately and keeps DataFusion's own exchange between them (#90), so the stage cut falls where DataFusion put it.
- Metal v1 compares `Int64` only (no `double` on most Apple GPUs); `Float64` predicates return `Unsupported` and take the CPU path.
- `Float64` filters compare in DataFusion's order, which is not Arrow's (#28): DataFusion 55 reads `-0.0` as `+0.0` on both sides before Arrow's totalOrder kernels compare them, so the CPU reference does the same, and the CUDA kernel compares sign-adjusted bit patterns with `-0.0` given `+0.0`'s. A NaN sorts above `+inf`, and one with its sign bit set (x86's default NaN) below `-inf`; NaNs are equal only bit for bit. The 55 bump moved this order without a failing test, since no fixture held a `-0.0`, so the conformance suite also writes the order out by hand and fails naming DataFusion if it moves again.

- Storage keeps no private format: `oxidelake-storage` owns Parquet writer properties, session pruning settings, Arrow IPC cache files and the object-store layer; pruning is *proven* by reading `row_groups_pruned_statistics` / `row_groups_pruned_bloom_filter` back from the executed plan rather than assumed.
- The io_uring store implements only the data path (`get_opts` ranged reads, `put_opts` overwrite writes) on its ring thread and delegates metadata operations to the wrapped `LocalFileSystem`, which is what makes the two stores behaviourally identical. An overwrite is written to a staged `<name>#<n>` file and renamed into place, as `LocalFileSystem` does, and returns the e_tag `LocalFileSystem` computes for the result (inode, mtime in microseconds, size): `head` answers through `LocalFileSystem`, so the two must agree (#111). A get is opened, and its preconditions and range checked, by `LocalFileSystem::get_opts`; the ring reads from the descriptor that check was made on (#113), at most 8 MiB per job, as the consumer pulls the stream (#112).
Expand All @@ -99,6 +100,7 @@ Resolved 2026-11-11 for the Ballista 55 bump (`cargo tree`, 593 crates in `Cargo
- Embedded sessions wire their `TelemetryHub` into the placement rule (`HardwarePlacementRule::with_telemetry`), so every `Gpu*Exec` a session plans reports per-batch counters; `oxide tui --query` renders the executed plan, each operator's own counters (read from the exec instance through `operator_stats()`: one hub entry per instance, shared by its partitions — merging them by operator name, as this did until 0.3.0, showed same-named operators each other's sums, #123) and per-column profiles (min/max/nulls/quantiles via one aggregation query per table).
- Security + performance audit (2026-09-02, see [docs/audit-2026-09-02.md](docs/audit-2026-09-02.md)) — decisions taken:
- The operator layer, not the backends, owns column plumbing: only the columns a kernel reads are uploaded; projected columns of device-ineligible types (`Utf8`, …) stay on the host and are gathered with Arrow `take` at the row ids the device compacted (a synthetic `__oxide_row` column travels with the sub-batch). A string column in the projection no longer sends the whole batch to the CPU path.
- The transfer format carries one validity bit per row, so a `FixedSizeList<Float32>` with a NULL element inside a valid row cannot travel (#105) — the element used to come back from a CUDA or Metal filter, or a CUDA join, as a valid `0.0`. `columns::extract` refuses such a column (`Unsupported`), and the operator layer keeps it on the host and gathers it at the device's row ids, as it does a `Utf8` column, so the filter or join still runs on the device. Vector distance, whose kernel has to read the column, runs such a batch on the CPU reference. NULL elements under a NULL row do not count (`append_null` leaves them), and are counted with a popcount per NULL row rather than by visiting every element, since every upload of a nullable vector column asks. A join's build side is checked once, when its `JoinBuild` is made, since its device copy serves every probe batch (#45); each probe batch is checked as it comes. Not done: carrying element validity through the device gathers, which would keep such a column on the device too, at the price of changing the CUDA gathers and the Metal kernels.
- Backends declare what they support before anything is uploaded (`GpuBackend::supports_predicate` / `supports_hash_join` / `supports_aggregate`, default `true`; Metal says `false` for joins, aggregates and non-`Int64` predicates).
- A hash join's build side is hashed once (`JoinBuild` → `kernels::JoinTable`, a flat row array grouped by key) and uploaded once per operator; probes gather only projected columns. Previously the table was rebuilt on the CPU and the build side re-uploaded for every probe batch.
- Column transfers are zero-copy where the transport allows: `ColumnBytes` holds Arrow `Buffer` slices, rebuilding moves the downloaded buffers, and Metal downloads alias the shared `MTLBuffer` through `Buffer::from_custom_allocation` (the `Arc<MetalSharedBuffer>` keeps it alive). One memcpy into shared memory per upload remains (Arrow allocations are not page-aligned).
Expand Down
Loading
Loading