Skip to main content

Crate vyre_driver_cuda

Crate vyre_driver_cuda 

Source
Expand description

§vyre-driver-cuda - CUDA/PTX backend for vyre

Implements VyreBackend via the CUDA driver API through cudarc. Translates vyre Program IR into PTX kernels, loads them through the CUDA driver JIT, and dispatches on NVIDIA GPUs.

The backend registers itself as "cuda" in the vyre backend registry via inventory::submit! so vyre::registered_backends() enumerates it alongside wgpu, spirv, etc.

§Architecture

   Program ─► PTX emitter ─► cuModuleLoadData ─► cuLaunchKernel

Re-exports§

pub use backend::CudaBackend;
pub use backend::CudaPtxSourceCacheSnapshot;
pub use backend::CudaResidentBuffer;
pub use backend::CudaStreamOrderedPool;
pub use backend::CudaTelemetrySnapshot;
pub use device::CudaDeviceCaps;
pub use device::CudaDeviceHandle;
pub use egraph_device_image::plan_cuda_egraph_device_upload;
pub use egraph_device_image::plan_cuda_egraph_device_upload_from_image;
pub use egraph_device_image::plan_cuda_egraph_device_upload_from_image_ref;
pub use egraph_device_image::CudaEGraphDeviceBorrowedUploadPlan;
pub use egraph_device_image::CudaEGraphDeviceByteLayout;
pub use egraph_device_image::CudaEGraphDeviceByteSpan;
pub use egraph_device_image::CudaEGraphDeviceKernelView;
pub use egraph_device_image::CudaEGraphDeviceUploadError;
pub use egraph_device_image::CudaEGraphDeviceUploadPlan;
pub use egraph_device_image::CudaResidentEGraphDeviceImage;
pub use egraph_kernel_plan::collect_cuda_egraph_structural_equivalences;
pub use egraph_kernel_plan::cuda_egraph_canonical_rewrite_kernel_ptx;
pub use egraph_kernel_plan::cuda_egraph_signature_pair_rows;
pub use egraph_kernel_plan::cuda_egraph_signature_refresh_kernel_ptx;
pub use egraph_kernel_plan::cuda_egraph_structural_equivalence_kernel_ptx;
pub use egraph_kernel_plan::pack_cuda_egraph_canonical_rewrite_device_image;
pub use egraph_kernel_plan::pack_cuda_egraph_signature_bucket_device_image;
pub use egraph_kernel_plan::plan_cuda_egraph_kernel_work;
pub use egraph_kernel_plan::plan_cuda_egraph_signature_buckets;
pub use egraph_kernel_plan::plan_cuda_egraph_signature_buckets_from_resident_snapshot;
pub use egraph_kernel_plan::plan_cuda_egraph_signature_buckets_from_signature_snapshot;
pub use egraph_kernel_plan::plan_cuda_egraph_structural_equivalence_launch_artifact;
pub use egraph_kernel_plan::plan_cuda_egraph_structural_equivalence_output;
pub use egraph_kernel_plan::plan_cuda_egraph_structural_equivalences;
pub use egraph_kernel_plan::plan_cuda_egraph_union_compaction;
pub use egraph_kernel_plan::CudaEGraphCanonicalRewrite;
pub use egraph_kernel_plan::CudaEGraphCanonicalRewriteDeviceImage;
pub use egraph_kernel_plan::CudaEGraphCanonicalRewriteKernelPtx;
pub use egraph_kernel_plan::CudaEGraphCanonicalRewriteKernelResult;
pub use egraph_kernel_plan::CudaEGraphFixedPointReadback;
pub use egraph_kernel_plan::CudaEGraphKernelLaunchConfig;
pub use egraph_kernel_plan::CudaEGraphKernelPass;
pub use egraph_kernel_plan::CudaEGraphKernelPlanError;
pub use egraph_kernel_plan::CudaEGraphKernelWave;
pub use egraph_kernel_plan::CudaEGraphKernelWorkPlan;
pub use egraph_kernel_plan::CudaEGraphResidentColumnSnapshot;
pub use egraph_kernel_plan::CudaEGraphResidentSignatureSnapshot;
pub use egraph_kernel_plan::CudaEGraphSignatureBucket;
pub use egraph_kernel_plan::CudaEGraphSignatureBucketDeviceImage;
pub use egraph_kernel_plan::CudaEGraphSignatureBucketPlan;
pub use egraph_kernel_plan::CudaEGraphSignaturePairWave;
pub use egraph_kernel_plan::CudaEGraphSignatureRefreshKernelPtx;
pub use egraph_kernel_plan::CudaEGraphSignatureRefreshKernelResult;
pub use egraph_kernel_plan::CudaEGraphStructuralCanonicalizationFixedPointReport;
pub use egraph_kernel_plan::CudaEGraphStructuralCanonicalizationFixedPointResult;
pub use egraph_kernel_plan::CudaEGraphStructuralCanonicalizationRoundResult;
pub use egraph_kernel_plan::CudaEGraphStructuralEquivalenceKernelPtx;
pub use egraph_kernel_plan::CudaEGraphStructuralEquivalenceKernelResult;
pub use egraph_kernel_plan::CudaEGraphStructuralEquivalenceLaunchArtifact;
pub use egraph_kernel_plan::CudaEGraphStructuralEquivalenceOutputPlan;
pub use egraph_kernel_plan::CudaEGraphStructuralEquivalencePlan;
pub use egraph_kernel_plan::CudaEGraphUnionCompactionPass;
pub use egraph_kernel_plan::CudaEGraphUnionCompactionPlan;
pub use egraph_kernel_plan::CudaEGraphUnionCompactionWave;
pub use egraph_kernel_plan::CUDA_EGRAPH_CANONICAL_REWRITE_KERNEL_ENTRY;
pub use egraph_kernel_plan::CUDA_EGRAPH_CANONICAL_REWRITE_KERNEL_PARAM_COUNT;
pub use egraph_kernel_plan::CUDA_EGRAPH_CANONICAL_REWRITE_RECORD_WORDS;
pub use egraph_kernel_plan::CUDA_EGRAPH_SIGNATURE_BUCKET_RECORD_WORDS;
pub use egraph_kernel_plan::CUDA_EGRAPH_SIGNATURE_REFRESH_KERNEL_ENTRY;
pub use egraph_kernel_plan::CUDA_EGRAPH_SIGNATURE_REFRESH_KERNEL_PARAM_COUNT;
pub use egraph_kernel_plan::CUDA_EGRAPH_STRUCTURAL_EQUIVALENCE_KERNEL_ENTRY;
pub use egraph_kernel_plan::CUDA_EGRAPH_STRUCTURAL_EQUIVALENCE_KERNEL_PARAM_COUNT;
pub use frontier_typed_ir_adapter::adapt_frontier_typed_ir_to_cuda;
pub use frontier_typed_ir_adapter::CudaFrontierTypedIrAdapterError;
pub use frontier_typed_ir_adapter::CudaFrontierTypedIrInput;
pub use kernel_failure_diagnostics::diagnose_cuda_kernel_launch;
pub use kernel_failure_diagnostics::diagnose_cuda_kernel_launch_shape;
pub use kernel_failure_diagnostics::diagnose_cuda_kernel_launch_with_scratch;
pub use kernel_failure_diagnostics::CudaKernelCapabilityFailure;
pub use kernel_failure_diagnostics::CudaKernelDeviceEnvelope;
pub use kernel_failure_diagnostics::CudaKernelLaunchDiagnostic;
pub use kernel_failure_diagnostics::CudaKernelLaunchDiagnosticRef;
pub use kernel_failure_diagnostics::CudaKernelLaunchDiagnosticScratch;
pub use kernel_failure_diagnostics::CudaKernelLaunchEnvelope;
pub use kernel_failure_diagnostics::CudaKernelLaunchEnvelopeError;
pub use kernel_failure_diagnostics::CudaKernelLaunchShape;
pub use kernel_failure_diagnostics::CudaKernelRequirement;
pub use megakernel_barrier_planner::plan_cuda_frontier_megakernel_execution;
pub use megakernel_barrier_planner::plan_cuda_frontier_megakernel_execution_with_scratch;
pub use megakernel_barrier_planner::CudaMegakernelFrontierExecutionPlan;
pub use megakernel_barrier_planner::CudaMegakernelFrontierExecutionPlanError;
pub use megakernel_plan_cache::CudaMegakernelAnalysisKind;
pub use megakernel_plan_cache::CudaMegakernelCachedPlan;
pub use megakernel_plan_cache::CudaMegakernelDeviceKey;
pub use megakernel_plan_cache::CudaMegakernelPlanCache;
pub use megakernel_plan_cache::CudaMegakernelPlanCacheKey;
pub use megakernel_plan_cache::CudaMegakernelPlanCacheStats;
pub use megakernel_scheduler::schedule_megakernel_from_cuda_samples;
pub use megakernel_scheduler::schedule_megakernel_from_cuda_samples_into;
pub use megakernel_scheduler::select_cuda_megakernel_topology;
pub use megakernel_scheduler::CudaMegakernelScheduleSample;
pub use megakernel_speedup_gate::format_validated_cuda_megakernel_speedup_evidence_csv;
pub use megakernel_speedup_gate::validate_cuda_megakernel_speedup_evidence_csv;
pub use megakernel_speedup_gate::validate_cuda_megakernel_speedup_gate;
pub use megakernel_speedup_gate::CudaMegakernelSpeedupGateError;
pub use megakernel_speedup_gate::CudaMegakernelSpeedupProof;
pub use megakernel_speedup_gate::CudaMegakernelSpeedupSample;
pub use megakernel_speedup_gate::MEGAKERNEL_SPEEDUP_EVIDENCE_CSV_HEADER;
pub use optimizer::CudaOptimizerDispatcher;
pub use regex_hardware_comparison::cuda_regex_hardware_comparison_evidence;
pub use regex_hardware_comparison::cuda_regex_software_fallback_comparison_evidence;
pub use regex_hardware_comparison::CudaRegexHardwareComparisonEvidence;
pub use regex_hardware_comparison::CUDA_REGEX_HARDWARE_COMPARISON_SCHEMA_VERSION;
pub use resident_graph_session::format_validated_cuda_resident_graph_session_evidence_csv;
pub use resident_graph_session::plan_cuda_resident_graph_session;
pub use resident_graph_session::resident_graph_session_speedup_sample;
pub use resident_graph_session::CudaResidentGraphReadback;
pub use resident_graph_session::CudaResidentGraphSessionError;
pub use resident_graph_session::CudaResidentGraphSessionEvidence;
pub use resident_graph_session::CudaResidentGraphSessionEvidenceError;
pub use resident_graph_session::CudaResidentGraphSessionPlan;
pub use resident_graph_session::CudaResidentGraphSessionProfile;
pub use token_fact_frontier_execution::plan_cuda_token_fact_frontier_execution;
pub use token_fact_frontier_execution::plan_cuda_token_fact_frontier_execution_with_scratch;
pub use token_fact_frontier_execution::CudaTokenFactFrontierExecutionError;
pub use token_fact_frontier_execution::CudaTokenFactFrontierExecutionPlan;
pub use token_fact_graph_cuda_adapter::adapt_token_fact_graph_to_cuda_layout;
pub use token_fact_graph_cuda_adapter::CudaTokenFactGraphLayout;
pub use token_fact_graph_cuda_adapter::CudaTokenFactGraphLayoutError;
pub use token_fact_graph_cuda_adapter::CUDA_TOKEN_FACT_DEGREE_PROFILE_BUCKETS;
pub use token_fact_graph_cuda_adapter::CUDA_TOKEN_FACT_DEGREE_PROFILE_RANKS;
pub use warp_word_automata::plan_cuda_warp_word_automata_layout;
pub use warp_word_automata::CudaWarpWordAutomataLayoutError;
pub use warp_word_automata::CudaWarpWordAutomataLayoutEvidence;
pub use warp_word_automata::CudaWarpWordAutomataLayoutRequest;
pub use warp_word_automata::CudaWarpWordInstructionClass;
pub use warp_word_automata::CUDA_WARP_WORD_AUTOMATA_LAYOUT_SCHEMA_VERSION;

Modules§

backend
CUDA backend core: device management and dispatch. CUDA backend module: device lifecycle, allocation pools, and kernel dispatch.
codegen
PTX code generation from vyre IR. PTX code generation from vyre Program IR.
device
CUDA device capability probing. CUDA device probing and capability snapshots.
egraph_device_image
CUDA upload planning for GPU e-graph device images. CUDA upload planning for GPU e-graph device images.
egraph_kernel_plan
CUDA launch-wave planning for resident e-graph device images. CUDA launch-wave planning for resident e-graph device images.
frontier_typed_ir_adapter
Adapter from frontier-typed IR plans to CUDA frontier wave envelopes. Adapter from substrate frontier-typed IR plans to CUDA frontier waves.
jit_cache
Cross-process persistent CUDA JIT cache wiring (E4 + E5): configures the NVIDIA driver’s built-in disk cache at backend bring-up so the JIT-compiled cuBINs persist across runs and are shared across every vyre process on the host. E4 + E5 substrate: cross-process persistent CUDA JIT cache wiring.
kernel_failure_diagnostics
Actionable CUDA kernel capability diagnostics. Actionable CUDA kernel capability diagnostics.
megakernel_barrier_planner
CUDA megakernel global-barrier minimization for dependency-typed waves. CUDA telemetry adapter over the neutral megakernel frontier execution policy.
megakernel_plan_cache
Bounded CUDA megakernel plan cache keyed by graph, analysis, device, and runtime pressure buckets. Bounded CUDA megakernel plan cache.
megakernel_scheduler
CUDA telemetry adapter for the scale-aware megakernel scheduler.
megakernel_speedup_gate
Release gate for steady-state CUDA megakernel speedup claims. CUDA megakernel steady-state speedup release gate.
occupancy
Occupancy-aware empirical autotuning (I4): pure estimator that picks the workgroup size with the highest predicted hardware occupancy from (CudaDeviceCaps, KernelResourceUsage). The runtime feeds the result into AutotuneStore (I3) so subsequent dispatches reuse the choice. I4 substrate: occupancy-aware empirical autotuning.
optimizer
Self-hosted optimizer GPU dispatcher - runs the vyre-self-substrate::optimizer passes (DCE, CSE, const-fold, validator) on CUDA. External parity tests reach in via the CudaOptimizerDispatcher re-export below. CUDA-resident OptimizerDispatcher - the fast path for the self-hosted optimizer.
profiler
CUDA profiler range integration for Nsight/NVTX without mandatory NVTX linkage. Optional CUDA profiler range integration for Nsight Systems.
regex_hardware_comparison
CUDA regex hardware-comparison evidence. CUDA regex hardware-comparison evidence.
resident_graph_session
Repeated execution over persistent CUDA-resident graph state. CUDA resident graph session planning.
synthetic_device_caps
A fixed synthetic device envelope for context-free estimator tests. Not a probe, and not this machine’s values: never derive a hardware decision from it. A FIXED synthetic device envelope for context-free estimator tests.
token_fact_frontier_execution
CUDA execution planning for unified token/fact graph frontier waves. CUDA execution planner for unified token/fact graph frontier waves.
token_fact_graph_cuda_adapter
Adapter from unified token/fact graph layouts to CUDA resident bytes. CUDA adapter for the unified resident token/fact graph.
warp_word_automata
CUDA warp-word bit-parallel automata layout evidence. CUDA warp-word bit-parallel automata layout evidence.

Structs§

CudaBackendRegistration
Factory wrapper for the inventory registration path.
CudaDeviceBuffer
CUDA implementation of vyre_driver::DeviceBuffer. Wraps a backend::CudaResidentBuffer handle so consumers can hold a Box<dyn DeviceBuffer> against the CUDA backend without naming CudaResidentBuffer directly.
CudaLaunchResourceCounts
Cached CUDA launch-resource counts retained for dispatch reuse.

Constants§

CUDA_BACKEND_ID
Stable backend identifier for registration and conform certificates.
CUDA_TARGET_ID
Validated target identity owned by the CUDA driver.

Functions§

cuda_factory
Factory function for inventory registration.
cuda_supported_ops
Op-support set - CUDA supports every op the foundation IR defines plus hardware intrinsics. Populated at runtime by the conform runner.