Skip to content

Slice (bulk) volatile write/read methods on VolBlock #28

@nicopap

Description

@nicopap

Currently, the only way to write a large amount of data into volatile memory is through iterating through individual VolAddress and writing a single T to memory one after another.

I've not inspected myself the generated code, but it seems reasonable to assume this results in slower than optimal code (it seems fast, so maybe it actually is optimizing it!) I've read your amazing writeup on how to hand optimize load/store ASM code, and it seems reasonable that a write_slice and read_slice methods could make use of better intrinsics such as volatile_copy_memory and volatile_set_memory (Using a pointer cast might just work??)

impl VolBlock {
  pub fn write_slice_at_offset(self, offset: usize, slice: &[T]) {
    //...
  }
  pub fn read_slice_at_offset<const L: usize>(self, offset: usize) -> [T; L] {
    //...
  }
  pub fn write_slice(self, slice: &[T]) {
    //...
  }
  pub fn read_slice<const L: usize>(self) -> [T; L] {
    //...
  }
}

I've written already such methods (though without optimizations, just the API) and I'd be happy to contribute it back if this is wanted.

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