Skip to content

Make Latency usable with kernel const generics #246

Description

@Heltion

cutile::core::Latency currently uses a u32 const parameter:

pub struct Latency<const CYCLES: u32>;

However, kernel entry points currently support only i32 and bool const generics. As a result, latency cannot be exposed as a tunable kernel generic:

#[cutile::entry]
unsafe fn kernel<const LATENCY: u32>(...) {
    load_ptr_tko(..., Latency::<LATENCY>);
}

This fails with:

const generic LATENCY must be i32 or bool, got u32

Changing the kernel generic to i32 also fails because Latency expects u32.

Would it make sense to make Latency use i32, or alternatively support u32 kernel const generics? Either approach would provide a supported way to write:

Latency::<LATENCY>

without branching over hard-coded values such as Latency::<1>, Latency::<2>, etc.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions