MCPcopy Create free account
hub / github.com/evilsocket/cake / alloc_output

Method alloc_output

cake-core/src/backends/vulkan/mod.rs:519–539  ·  view source on GitHub ↗
(&self, count: usize)

Source from the content-addressed store, hash-verified

517 }
518
519 fn alloc_output(&self, count: usize) -> MappedBuffer {
520 let bytes = (count * 4) as u64;
521 let key = BufferPool::bucket(bytes);
522 let mut pool = self.buffer_pool.lock().unwrap();
523 if let Some(bufs) = pool.free.get_mut(&key) {
524 if let Some(buf) = bufs.pop() {
525 return buf;
526 }
527 }
528 drop(pool);
529 let mut alloc_guard = self.allocator.lock().unwrap();
530 let alloc = alloc_guard.as_mut().unwrap();
531 Self::alloc_mapped_buffer(
532 &self.vk_device,
533 alloc,
534 key,
535 vk::BufferUsageFlags::STORAGE_BUFFER,
536 self.uma_memory_type,
537 )
538 .expect("failed to allocate output buffer")
539 }
540
541 fn release_output(&self, buf: MappedBuffer) {
542 let key = BufferPool::bucket(buf.size);

Callers 8

init_vulkanMethod · 0.80
dispatch_binary_vec4Method · 0.80
dispatch_ternary_vec4Method · 0.80
dispatch_unary_vec4Method · 0.80
dispatch_softmaxMethod · 0.80
gpu_gemvMethod · 0.80
gpu_gemmMethod · 0.80
tensor_matmulMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected