Skip to main content

Design

Algeon adds native GPU execution to DataFusion sessions. DataFusion provides SQL parsing, catalog management, and physical planning; Algeon lowers supported physical subtrees into GPU operations and emits Arrow record batches. These pages refer to that GPU path as native execution.

A query through the system​

Query flow and module boundariesQuery flow and module boundaries. DataFusion plans SQL on the CPU. algeon-datafusion lowers the physical plan and invokes query-engine. Query-planning owns IR, capability proof and the compiled schedule. Query-runtime owns the attempt, device grant and cache. Query-engine submits GPU operations through RAPIDS, reading Parquet from local NVMe or S3 and returning host Arrow batches through the adapter and DataFusion. Dashed arrows show direct imports: the adapter imports DataFusion and all three query crates; the engine imports planning and runtime; runtime imports planning.DataFusion-free query crates · CPU orchestrationphysical planexecuteGPU submissionsread pagesdevice → hostDataFusionSQL / DataFramePhysical plan on CPUalgeon-datafusionLower the physical planWrap execution and Arrow resultsquery-planningIR and capability proofCompiled GPU execution schedulequery-engineExecute the scheduleUse planning + runtime contractsquery-runtimeOne device + grantAttempt lifetime and cacheParquet storageLocal NVMe or S3Selected column pagesGPU operationscuDF · cuGraph · cuVS · cuMLDecode → filter / join / aggregateArrow resultVia adapter → DataFusion → callerExecution / data flowImports from
Follow the solid arrows from SQL to the result. Dashed arrows point to imported crates. The native query crates orchestrate GPU work from the CPU; RAPIDS operations run on the device.

A native query executes filter, join, and aggregation kernels on GPU columns while the CPU handles planning, metadata reads, and task submission. The host application's Tokio runtime drives CPU coordination, while GPU kernels run on dedicated per-device runtimes (Runtimes and threads). Each query attempt executes on one GPU. Embedded applications and the Flight SQL server share this execution stack.

Priorities​

The engine architecture follows three core constraints:

  • The engine owns physical plan selection. The optimizer rule decides which candidates lower to native execution and which fragments remain on DataFusion CPU execution.
  • Failed attempts return structured errors. Native failures retain typed codes across DataFusion and Flight boundaries with evidence for retry decisions. GPU execution does not fall back to CPU replay once started.
  • Admission bounds device memory. Each attempt receives an immutable grant committed against the per-device ledger. Allocations exceeding the grant fail without reclaiming memory from concurrent attempts.

Module boundaries​

The intermediate representation (IR) describes sources, operations and their dependencies. Ownership across the query crates is:

CrateContracts it ownsSource directory
algeon-datafusionDataFusion-dependent lowering, execution wrappers and integrationcrates/algeon-datafusion
query-planningIR, optimizer, capability, proof, admission contracts and compiled pipelinecrates/algeon-query-planning
query-runtimeAttempt lifecycle, query service, device ledger, immutable grants, cache, observation and metricscrates/algeon-query-runtime
query-engineNative execution compositioncrates/algeon-query-engine
algeon-icebergIceberg REST and Glue catalogs as DataFusion catalogs, and each table as a Parquet scan of its current snapshot with the unsupported_table_feature rejectionscrates/algeon-iceberg

The adapter imports each query crate directly. The engine imports planning and runtime. Runtime imports planning. These three query crates have no DataFusion dependency. Imports come from the crate that owns the item. algeon-iceberg imports the adapter and iceberg-rust; only algeon-server imports it, behind its iceberg feature.

Below them, the GPU component crates provide Rust APIs over NVIDIA's RAPIDS libraries:

ComponentWork performed on the GPU
cudfParquet decoding and column operations, including joins and aggregation.
cugraphGraph construction and algorithms such as PageRank.
cuvsVector search, clustering and dimensionality reduction.
cumlMachine learning operations and forest inference.

The adapter, runtime and engine call the components they need directly. Component APIs bind operations to a CUDA stream and memory resource. Native RAPIDS libraries perform the work. Shared interop contracts preserve buffer ownership across library boundaries. The cuDF binding design shows how one binding meets these rules: its layers, handle ownership, stream provenance and memory domains.

API documentation​

algeon-datafusion is the application-facing Rust crate; the query and GPU component crates, interop and build support are implementation dependencies published with it. Visible adapter APIs, and the workspace-owned types they expose, carry rustdoc at the defining item. The API documentation boundary defines that scope, and the documentation checks enforce it.

Runtimes and threads​

Three Tokio runtimes serve a query.

RuntimeCreated byThreadsWork
HostThe application (#[tokio::main] in algeon_server)The host's choicePlanning, admission waits, result streams
GPU pool, one per deviceGpuExecutionPool at backend buildworker_count workers plus blocking-lane threads, named algeon-gpu-{d}cuDF, cuGraph, cuVS and cuML calls
Object-store controlFirst query service in the processTokio default, named algeon-object-store-controlFooter and cache-fill fetches

The library builds no host runtime. The host's runtime needs the time driver for admission waits and deadlines. The pool uses Tokio as a fixed-width thread pool that keeps synchronous GPU calls off the host runtime. A job is an async block with a synchronous GPU body and holds its worker until the body returns. Query execution jobs take at most worker_count - 1 workers, which leaves one for context setup and release cleanup. Chunk lane jobs and source reads use the blocking lane of the same runtime.

A submission acquires a job-class permit immediately. When a class is saturated, the service returns service_overloaded. Bounded waiting occurs only within the admission queue. A pool worker waiting on asynchronous completion parks in block_until without blocking the host runtime. A job submitted from inside the same pool executes inline. Host-side spawn_blocking covers backend close, server shutdown drains, the query-stats lease and password verification.

Threads Algeon creates
ThreadCountWork
algeon-gpu-{d}-supervisorOne per deviceBuilds and drops the pool runtime
algeon-stream-cleanup-d{d}-p{p}One per stream poolSynchronizes returned streams
algeon-gpu-closeOne per backendBackend close cleanup
algeon-observation-completion-observation, algeon-observation-completion-activity-tailOne each per backendObservation delivery
KvikIO thread pool64 per process, started at backend buildCompatibility-mode pread tasks and s3:// range reads

An atexit hook joins registered CUDA-capable workers before libcudart tears down.