pub struct PlanCache { /* private fields */ }Expand description
LRU plan cache. Default capacity is 64 entries — a single device
rarely keeps more than that many distinct CUTLASS template
instantiations live at once, and at ~64 KiB / cached .cu source
the cache stays well under a megabyte.
Implementations§
Source§impl PlanCache
impl PlanCache
pub fn new(capacity: usize) -> Self
pub fn capacity(&self) -> usize
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Examples found in repository?
examples/cutlass_gemm_fp8.rs (line 28)
10fn main() {
11 let actor = CutlassActor::new(16);
12 let req = GemmRequest::<F8E4m3>::new(GemmShape::new(4096, 4096, 4096), SmArch::Sm90a)
13 .with_epilogue(GemmEpilogue::LinearReLU {
14 alpha: 1.0,
15 beta: 0.0,
16 });
17
18 println!("plan key: {:?}", req.plan_key());
19 let (src, name) = req.render_cu();
20 println!("kernel: {name}");
21 println!("--- generated .cu ---");
22 println!("{src}");
23
24 actor.handle(CutlassMsg::Gemm(Box::new(req.clone())));
25 actor.handle(CutlassMsg::Gemm(Box::new(req)));
26
27 println!("dispatched: {}", actor.inner().dispatched());
28 println!("plan cache len: {}", actor.inner().plan_cache.len());
29}pub fn is_empty(&self) -> bool
pub fn get(&self, key: &PlanKey) -> Option<Arc<CachedPlan>>
pub fn insert(&self, plan: CachedPlan) -> Arc<CachedPlan> ⓘ
pub fn clear(&self)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PlanCache
impl !RefUnwindSafe for PlanCache
impl Send for PlanCache
impl Sync for PlanCache
impl Unpin for PlanCache
impl UnsafeUnpin for PlanCache
impl !UnwindSafe for PlanCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more