Skip to main content

LogicProgram

Struct LogicProgram 

Source
pub struct LogicProgram { /* private fields */ }
Expand description

A compiled Datalog program ready for GPU evaluation.

Implementations§

Source§

impl LogicProgram

Source

pub fn compile(source: &str) -> Result<Self>

Compile a Datalog source string into a GPU-executable program.

Source

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 program
  • resolver - A pre-loaded ModuleResolver with all dependencies resolved
§Returns

The compiled LogicProgram with all imports merged

Source

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.

Source

pub fn schema(&self, relation: &str) -> Option<&Schema>

Look up the schema for a named relation.

Source

pub fn schemas(&self) -> &HashMap<String, Schema>

Return the full schema map (relation name to schema).

Source

pub fn rule_provenance(&self) -> Vec<RuleProvenance>

Return stable rule provenance for source-visible rules.

Source

pub fn proof_traces(&self) -> Vec<QueryProofTrace>

Return direct proof traces for source queries.

Source

pub fn create_relation_store( &self, provider: Arc<CudaKernelProvider>, ) -> Result<RelationStore>

Create a persistent user-visible relation store initialized with inline facts.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn evaluate_cached_relation_store( &self, provider: Arc<CudaKernelProvider>, relation_store: &RelationStore, ) -> Result<LogicEvalResult>

Build query results from an already materialized runtime store.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn evaluate( &self, provider: Arc<CudaKernelProvider>, inputs: HashMap<String, CudaBuffer>, ) -> Result<LogicEvalResult>

Evaluate the program with the given input relations (no profiling).

Source

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 provider
  • inputs - Input relations
  • profiling - Whether to collect execution statistics
Source

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

Source§

fn clone(&self) -> LogicProgram

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,