Skip to main content

cubecl_tile/layout/paging/
page_entry.rs

1//! [`PageEntry`]: a page table entry a kernel hands to the cuts that resolve its page.
2
3use cubecl::prelude::*;
4
5use crate::*;
6
7/// A page table entry and the cell it was read from: the page column `column` of sequence
8/// `sequence` lists. A cut naming that cell takes `page` from it instead of loading the table.
9#[derive(CubeType, CubeTypeMut, Clone)]
10#[expand(derive(Clone))]
11pub struct PageEntry {
12    pub(crate) sequence: u32,
13    pub(crate) column: u32,
14    pub(crate) page: u32,
15}
16
17#[cube]
18impl PageEntry {
19    /// The entry no table lists, what a buffer that is not a pool of pages has. A cut that names
20    /// it reads page 0, which is what the table gives outside itself.
21    pub fn unlisted() -> PageEntry {
22        PageEntry {
23            sequence: 0xFFFF_FFFFu32,
24            column: 0xFFFF_FFFFu32,
25            page: 0u32,
26        }
27    }
28}