jvm.chisel.db.schedule
The hardware workflow scheduler: turns a logical operator graph (data, produced by the host) into a physical placement on a fixed pool of reusable operator blocks, and executes a pure-Clojure reference of the plan.
This is deliberately decoupled from the datapath (jvm.chisel.db.pipeline):
host chip graph ──▶ logical plan ──▶ place ──▶ schedule ──▶ composed module (data only) (which units) (order, cost)
place/scheduleare pure functions over the plan and the resource inventory;scheduleaccepts a:cost-fn, the seam where a learned cost model (“AI inside the chip”) plugs in without touching the datapath.run-planis the golden reference: it runs a plan over concrete lane input by composing the existing*-refmodels, so both tests andjvm.chisel.db.pipeline/pipeline-refshare one source of truth.
The scheduling logic itself is pure data; requiring the operator namespaces is only to reuse their reference models (single source of truth, no drift).
estimate-cost
(estimate-cost plan)Default cycle estimate: one lanes pass per node. Overridable via schedule’s :cost-fn.
feasible?
(feasible? plan inventory)True iff every node op is known and, for every kind, demand <= inventory.
place
(place plan inventory)Assign a concrete physical unit id to each node, in plan order, drawing from inventory. Returns {:ok? bool :placement … :reason …}. Each placement entry is {:stage i :op op :kind kind :unit :i is the node’s index in the (normalized) node vector.
plan->nodes
(plan->nodes plan)Normalize a plan to a topological node vector. A plan with :nodes is used as-is; a linear :stages plan is lifted to a chain: node 0 reads source 0, node i reads node i-1.
plan->sources
(plan->sources plan)Number of input relations a plan consumes (:sources int or vector, default 1).
run-plan
(run-plan plan input)Execute plan over input by composing the operator reference models in topological order. Returns the behavior-preserving summary map {:values … :mask int :buckets … :result x :env {…}} where :env maps every node id to its value (relation / table / scalar).
schedule
(schedule plan inventory)(schedule plan inventory {:keys [cost-fn]})Place plan onto inventory and annotate with a :cost. opts may carry :cost-fn (fn plan -> number) to replace the default estimate — the injection point for a learned cost model. On infeasible plans the placement failure map is returned (no :cost).