-
Notifications
You must be signed in to change notification settings - Fork 155
[FEAT] Rust memset #849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEAT] Rust memset #849
Conversation
return Ok(()); | ||
} | ||
if !self.is_on_active_device() { | ||
panic!("not allocated on an inactive device"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the comment is wrong
@@ -241,6 +241,30 @@ impl<T> DeviceSlice<T> { | |||
.wrap() | |||
} | |||
} | |||
|
|||
pub fn memset(&mut self, value: u8) -> Result<(), eIcicleError> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why doesn't it take size too? Does it set the entire slice?
&mut self[..] | ||
} | ||
|
||
pub fn memset(&mut self, value: u8) -> Result<(), eIcicleError> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given we can memset a deviceSlice why do we need it also for DeviceVec?
And here also it's memset the entire vector but usually we want to to memset offset+:size.
Can we implement it on HostOrDeviceSlice instead? If yes then we can memset any memory with offest+size, regardless being host/device memory. We probably also would need to sub-slice HostOrDeviceSlice to be fully flexible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved impl to HostOrDeviceSlice
@@ -81,6 +84,32 @@ impl<T> HostOrDeviceSlice<T> for HostSlice<T> { | |||
fn is_empty(&self) -> bool { | |||
self.len() == 0 | |||
} | |||
|
|||
fn memset(&mut self, value: u8, size: usize) -> Result<(), eIcicleError> { | |||
if size == 0 || self.is_empty() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a strange case, why not panic? should be super rare but why would someone do it?
Describe the changes
This PR adds support for using icicle_memset in icicle rust wrapper
Linked Issues
Resolves #
(optional) CUDA backend branch
cuda-backend-branch: main # specify the branch here