pub struct McProgram { /* private fields */ }Implementations§
Source§impl McProgram
impl McProgram
pub fn compile_evidence_forcing(&self) -> Result<EvidenceForcing>
Source§impl McProgram
impl McProgram
Sourcepub fn evaluate_resident_with_provider(
&self,
cfg: McEvalConfig,
provider: Arc<CudaKernelProvider>,
) -> Result<McResidentResult>
pub fn evaluate_resident_with_provider( &self, cfg: McEvalConfig, provider: Arc<CudaKernelProvider>, ) -> Result<McResidentResult>
Evaluate this program with the GPU-resident engine. Returns device-resident
counts plus no-host instrumentation for the measured region. Fails closed
(typed ResidentRejection wrapped into [XlogError]) for programs
outside the supported fragment.
Sourcepub fn evaluate_resident(&self, cfg: McEvalConfig) -> Result<McResidentResult>
pub fn evaluate_resident(&self, cfg: McEvalConfig) -> Result<McResidentResult>
Convenience: evaluate with a fresh provider.
Source§impl McProgram
impl McProgram
pub fn compile_source(source: &str) -> Result<Self>
pub fn compile_source_with_gpu(source: &str, config: GpuConfig) -> Result<Self>
Sourcepub fn compile_from_program(
program: &Program,
config: GpuConfig,
) -> Result<Self>
pub fn compile_from_program( program: &Program, config: GpuConfig, ) -> Result<Self>
Compile an already parsed program with the requested GPU configuration.
Imports must already be resolved and merged. This method does not load
unresolved use declarations from the filesystem.
pub fn num_vars(&self) -> usize
Sourcepub fn evaluate(&self, cfg: McEvalConfig) -> Result<McResult>
pub fn evaluate(&self, cfg: McEvalConfig) -> Result<McResult>
Host-facing MC evaluation: runs the resident megakernel engine
(Self::evaluate_gpu_device_with_provider) and then materializes the
result on the host by downloading the final query/evidence counts
after the measured region. The download is a host-result
materialization, not part of the measured region — the no-host property
belongs to the resident engine, not to this convenience wrapper. Use
Self::evaluate_gpu_device when you want device-resident counts with no
host download at all.
Fail-closed contract: if the resident engine rejects the program
(negation, aggregates, unbounded terms, …), this returns the typed
rejection error. The CPU oracle is reachable only via the explicit
McEvalConfig::allow_cpu_oracle_fallback opt-in and its result is
labeled McEngine::CpuOracle.
Sourcepub fn evaluate_cpu(&self, cfg: McEvalConfig) -> Result<McResult>
pub fn evaluate_cpu(&self, cfg: McEvalConfig) -> Result<McResult>
CPU oracle / debug MC path. Downloads the full sampled-bit matrix to the host and evaluates every sampled world on a host relation store.
This is intentionally not GPU-native: it performs a large DtoH of the
sample matrix and runs the deterministic core on the CPU. It exists solely
as a deterministic, seed-matched oracle for validating the GPU-native
device counts (the GPU sampler is shared, so for the same program/seed the
two paths see identical samples). It must never be used as zero-host /
GPU-native release evidence, and the acceptance matrix excludes it and the
tests that call it (tests/gpu_mc_vs_cpu.rs, tests/mc.rs).
Sourcepub fn evaluate_gpu(&self, cfg: McEvalConfig) -> Result<McResult>
pub fn evaluate_gpu(&self, cfg: McEvalConfig) -> Result<McResult>
Alias for Self::evaluate: GPU device evaluation followed by host-result
materialization (final-count download after the measured region). The
_gpu suffix denotes that the compute runs on the GPU — it does not
imply a zero-host result, since it returns a host McResult. For the
device-resident, no-host-download API use Self::evaluate_gpu_device.
Sourcepub fn evaluate_gpu_device(&self, cfg: McEvalConfig) -> Result<McDeviceResult>
pub fn evaluate_gpu_device(&self, cfg: McEvalConfig) -> Result<McDeviceResult>
GPU-native device-resident MC evaluation via the resident megakernel
engine ([resident]). Returns McDeviceResult with counts left on the
device (no host download). The engine evaluates all worlds in a single
launch with no host interaction in the measured region (no host
sample loop, no per-sample/per-operator host launches or allocations, no
tracked transfers, and no untracked metadata reads); see
McResidentResult::no_host / McNoHostStats::is_no_host for the full
measured contract.
Sourcepub fn evaluate_gpu_device_with_provider(
&self,
cfg: McEvalConfig,
provider: Arc<CudaKernelProvider>,
) -> Result<McDeviceResult>
pub fn evaluate_gpu_device_with_provider( &self, cfg: McEvalConfig, provider: Arc<CudaKernelProvider>, ) -> Result<McDeviceResult>
GPU-native device-resident MC evaluation using a caller-supplied provider
(enables provider/buffer reuse across calls). Static setup (arena
allocation, plan upload, sampling) happens before the measured region;
the measured region is a single resident-engine launch with zero host
interaction — no host loop over samples or fixpoint iterations, no
per-sample/per-operator host launches or device allocations, no tracked
HtoD/DtoH transfers, and no untracked metadata reads. The full contract is
measured by McNoHostStats (McResidentResult::no_host) and gated by
tests/mc_resident.rs. Counts remain device-resident; the caller decides
whether/when to download them.