INNER CODE UNIT · Rust
assign_work_buffer
rustformers/llm · crates/ggml/src/lib.rs:359
fn assign_work_buffer(&mut self, buffer: &mut Tensor) {
assert!(
buffer.get_type() == Type::I8,
"Work buffer must be of type i8"
);
unsafe {
self.inner.work_data = buffer.data().cast();
}
}
/// Execute this [GraphExecutionPlan] in the given [Context].
pub fn execute(&mut self, context: &Context) {
let mut work_buffer = self.create_work_buffer(context);
self.assign_work_buffer(&mut work_buffer);
unsafe {
sys::ggml_graph_compute(self.inner_graph, &mut self.inner);
}