Expand description
Hardware-accelerated lossless memory compression bookkeeping.
On Ampere (compute capability 8.0) and newer GPUs the virtual-memory
management API (cuMemCreate) accepts a
CU_MEM_ALLOCATION_COMPRESSION_TYPE_GENERIC allocation flag that enables
the memory controller’s lossless compression engine. Compressible
allocations transparently reduce the number of bytes that travel across the
L2 ↔ DRAM interface, raising effective bandwidth for compressible data
(e.g. activation tensors with large runs of zeros).
This module models the host-side bookkeeping required to drive that
feature: capability gating, compression-granularity alignment, an
effective-bandwidth model, and a CompressedDeviceBuffer descriptor that
tracks the logical / physical footprint of a compressed allocation. The
actual cuMemCreate call requires a GPU and lives behind the device-gated
path; everything here is deterministic and unit-testable on the host.
§Example
// Ampere supports generic compression; the granularity is 2 MiB.
let support = CompressionSupport::for_compute_capability(8, 0);
assert!(support.is_supported());
// A 5 MiB request is rounded up to a multiple of the granularity.
let plan = CompressionPlan::new(5 * 1024 * 1024, support)?;
assert_eq!(plan.physical_bytes() % support.granularity(), 0);Structs§
- Compressed
Device Buffer - Host-side descriptor for a compressed device allocation.
- Compression
Plan - A validated, granularity-aligned plan for a compressed allocation.
- Compression
Support - Describes whether and how a given device supports generic compression.
Enums§
- Compression
Type - The kind of memory compression requested for an allocation.
Constants§
- DEFAULT_
COMPRESSION_ GRANULARITY - The default compression page granularity on supported hardware (2 MiB).