pub struct LogicProgram { /* private fields */ }Expand description
A compiled Datalog program ready for GPU evaluation.
Implementations§
Source§impl LogicProgram
impl LogicProgram
Sourcepub fn compile(source: &str) -> Result<Self>
pub fn compile(source: &str) -> Result<Self>
Compile a Datalog source string into a GPU-executable program.
Sourcepub fn compile_with_resolver(
source: &str,
resolver: &ModuleResolver,
) -> Result<Self>
pub fn compile_with_resolver( source: &str, resolver: &ModuleResolver, ) -> Result<Self>
Compile a program with module resolution.
This method resolves all imports using the provided resolver and merges imported predicates, functions, and rules into the main program.
§Arguments
source- The source code of the main programresolver- A pre-loaded ModuleResolver with all dependencies resolved
§Returns
The compiled LogicProgram with all imports merged
Sourcepub fn epistemic_plan_json(&self) -> Option<String>
pub fn epistemic_plan_json(&self) -> Option<String>
Serialize the compiled epistemic execution plan to a JSON summary.
Returns None for ordinary (non-epistemic) programs. For epistemic
programs this dumps the EIR-derived GPU plan(s): selected mode, the
epistemic know/possible literals (with negation), required GPU hot-path
phases/kernels, world-view integrity constraints, reduced-program head
summaries, the forbidden CPU-fallback counters (which must all be zero on
the accepted GPU hot path), and a deterministic plan id (a stable hash of
the canonical summary). This is the epistemic-plan/EIR dump surface:
it lets an external caller (pyxlog or CLI consumer) read the accepted
world-view structure and assert cpu_fallback == 0 off a real run.
Sourcepub fn schema(&self, relation: &str) -> Option<&Schema>
pub fn schema(&self, relation: &str) -> Option<&Schema>
Look up the schema for a named relation.
Sourcepub fn schemas(&self) -> &HashMap<String, Schema>
pub fn schemas(&self) -> &HashMap<String, Schema>
Return the full schema map (relation name to schema).
Sourcepub fn rule_provenance(&self) -> Vec<RuleProvenance>
pub fn rule_provenance(&self) -> Vec<RuleProvenance>
Return stable rule provenance for source-visible rules.
Sourcepub fn proof_traces(&self) -> Vec<QueryProofTrace>
pub fn proof_traces(&self) -> Vec<QueryProofTrace>
Return direct proof traces for source queries.
Sourcepub fn create_relation_store(
&self,
provider: Arc<CudaKernelProvider>,
) -> Result<RelationStore>
pub fn create_relation_store( &self, provider: Arc<CudaKernelProvider>, ) -> Result<RelationStore>
Create a persistent user-visible relation store initialized with inline facts.
Sourcepub fn evaluate_with_relation_store(
&self,
provider: Arc<CudaKernelProvider>,
relation_store: &RelationStore,
profiling: bool,
) -> Result<LogicEvalResult>
pub fn evaluate_with_relation_store( &self, provider: Arc<CudaKernelProvider>, relation_store: &RelationStore, profiling: bool, ) -> Result<LogicEvalResult>
Evaluate using a persistent base relation store.
The provided store is treated as immutable seed state. Buffers are cloned into a fresh executor for each evaluation so repeated evaluations reuse stored relations without mutating the persistent store itself.
Sourcepub fn evaluate_with_relation_store_and_cache(
&self,
provider: Arc<CudaKernelProvider>,
relation_store: &RelationStore,
profiling: bool,
) -> Result<(LogicEvalResult, RelationStore)>
pub fn evaluate_with_relation_store_and_cache( &self, provider: Arc<CudaKernelProvider>, relation_store: &RelationStore, profiling: bool, ) -> Result<(LogicEvalResult, RelationStore)>
Evaluate using a persistent relation store and return the complete runtime store.
Sourcepub fn create_session_runtime(
&self,
provider: Arc<CudaKernelProvider>,
relation_store: &RelationStore,
profiling: bool,
) -> Result<LogicSessionRuntime>
pub fn create_session_runtime( &self, provider: Arc<CudaKernelProvider>, relation_store: &RelationStore, profiling: bool, ) -> Result<LogicSessionRuntime>
Create retained runtime state for a persistent relation session.
Sourcepub fn evaluate_with_session_runtime(
&self,
provider: Arc<CudaKernelProvider>,
runtime: &mut LogicSessionRuntime,
) -> Result<(LogicEvalResult, RelationStore)>
pub fn evaluate_with_session_runtime( &self, provider: Arc<CudaKernelProvider>, runtime: &mut LogicSessionRuntime, ) -> Result<(LogicEvalResult, RelationStore)>
Evaluate with retained session runtime state and return a materialized store snapshot.
Sourcepub fn evaluate_cached_relation_store(
&self,
provider: Arc<CudaKernelProvider>,
relation_store: &RelationStore,
) -> Result<LogicEvalResult>
pub fn evaluate_cached_relation_store( &self, provider: Arc<CudaKernelProvider>, relation_store: &RelationStore, ) -> Result<LogicEvalResult>
Build query results from an already materialized runtime store.
Sourcepub fn apply_relation_deltas(
&self,
provider: Arc<CudaKernelProvider>,
relation_store: &mut RelationStore,
cached_store: &mut Option<RelationStore>,
deltas: HashMap<String, RelationDelta>,
) -> Result<LogicDeltaReport>
pub fn apply_relation_deltas( &self, provider: Arc<CudaKernelProvider>, relation_store: &mut RelationStore, cached_store: &mut Option<RelationStore>, deltas: HashMap<String, RelationDelta>, ) -> Result<LogicDeltaReport>
Apply relation deltas to a persistent session store through the runtime delta path.
Sourcepub fn apply_relation_deltas_with_session_runtime(
&self,
provider: Arc<CudaKernelProvider>,
relation_store: &mut RelationStore,
cached_store: &mut Option<RelationStore>,
session_runtime: &mut Option<LogicSessionRuntime>,
deltas: HashMap<String, RelationDelta>,
) -> Result<LogicDeltaReport>
pub fn apply_relation_deltas_with_session_runtime( &self, provider: Arc<CudaKernelProvider>, relation_store: &mut RelationStore, cached_store: &mut Option<RelationStore>, session_runtime: &mut Option<LogicSessionRuntime>, deltas: HashMap<String, RelationDelta>, ) -> Result<LogicDeltaReport>
Apply relation deltas while preserving retained session runtime state.
Sourcepub fn apply_relation_delta_batch(
&self,
provider: Arc<CudaKernelProvider>,
relation_store: &mut RelationStore,
cached_store: &mut Option<RelationStore>,
delta_batch: Vec<(String, RelationDelta)>,
) -> Result<LogicDeltaReport>
pub fn apply_relation_delta_batch( &self, provider: Arc<CudaKernelProvider>, relation_store: &mut RelationStore, cached_store: &mut Option<RelationStore>, delta_batch: Vec<(String, RelationDelta)>, ) -> Result<LogicDeltaReport>
Apply an ordered batch of relation deltas after device-side coalescing.
Sourcepub fn apply_relation_delta_batch_with_session_runtime(
&self,
provider: Arc<CudaKernelProvider>,
relation_store: &mut RelationStore,
cached_store: &mut Option<RelationStore>,
session_runtime: &mut Option<LogicSessionRuntime>,
delta_batch: Vec<(String, RelationDelta)>,
) -> Result<LogicDeltaReport>
pub fn apply_relation_delta_batch_with_session_runtime( &self, provider: Arc<CudaKernelProvider>, relation_store: &mut RelationStore, cached_store: &mut Option<RelationStore>, session_runtime: &mut Option<LogicSessionRuntime>, delta_batch: Vec<(String, RelationDelta)>, ) -> Result<LogicDeltaReport>
Apply an ordered batch of relation deltas while preserving session runtime state.
Sourcepub fn evaluate(
&self,
provider: Arc<CudaKernelProvider>,
inputs: HashMap<String, CudaBuffer>,
) -> Result<LogicEvalResult>
pub fn evaluate( &self, provider: Arc<CudaKernelProvider>, inputs: HashMap<String, CudaBuffer>, ) -> Result<LogicEvalResult>
Evaluate the program with the given input relations (no profiling).
Sourcepub fn evaluate_with_options(
&self,
provider: Arc<CudaKernelProvider>,
inputs: HashMap<String, CudaBuffer>,
profiling: bool,
) -> Result<LogicEvalResult>
pub fn evaluate_with_options( &self, provider: Arc<CudaKernelProvider>, inputs: HashMap<String, CudaBuffer>, profiling: bool, ) -> Result<LogicEvalResult>
Evaluate the program with optional profiling
§Arguments
provider- The CUDA kernel providerinputs- Input relationsprofiling- Whether to collect execution statistics
Sourcepub fn relation_stores_query_equivalent(
&self,
provider: &CudaKernelProvider,
left: &RelationStore,
right: &RelationStore,
) -> Result<bool>
pub fn relation_stores_query_equivalent( &self, provider: &CudaKernelProvider, left: &RelationStore, right: &RelationStore, ) -> Result<bool>
Compare query result relations between two stores using GPU set difference.
Trait Implementations§
Source§impl Clone for LogicProgram
impl Clone for LogicProgram
Source§fn clone(&self) -> LogicProgram
fn clone(&self) -> LogicProgram
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more