From 11d26ad16be8bf19e87b6f21c9a8737ea1773a8a Mon Sep 17 00:00:00 2001 From: Albin Chaboissier Date: Mon, 2 Nov 2026 12:06:56 +0100 Subject: [PATCH] memory profile --- src/gi_pipeline.rs | 49 +++++++ src/gi_pipeline/sparse_set.rs | 57 ++++++++ src/gpu.rs | 60 ++++++++ src/gpu_profiler.rs | 2 + src/gpu_profiler/memory_profiler.rs | 205 ++++++++++++++++++++++++++++ src/main.rs | 3 +- src/producers.rs | 9 -- src/voxel_cache.rs | 94 ++++--------- src/voxel_cache/attributes.rs | 15 +- src/voxel_cache/eviction.rs | 10 +- src/voxel_cache/layout.rs | 25 ++++ src/voxel_cache/requests.rs | 5 +- src/voxel_cache/structure.rs | 8 +- src/voxel_cache/tables.rs | 13 +- 14 files changed, 463 insertions(+), 92 deletions(-) create mode 100644 src/gi_pipeline/sparse_set.rs create mode 100644 src/gpu_profiler/memory_profiler.rs diff --git a/src/gi_pipeline.rs b/src/gi_pipeline.rs index e69de29..508b54c 100644 --- a/src/gi_pipeline.rs +++ b/src/gi_pipeline.rs @@ -0,0 +1,49 @@ +use crate::gi_pipeline::sparse_set::GpuSparseSet; +use crate::voxel_cache::VoxelCache; +use crate::voxel_cache::{self}; + +mod sparse_set; + +pub struct VoxelGiPipeline +where + [(); N * N * N]:, +{ + voxel_cache: VoxelCache, + + /// Keeps a set of the leaves present in the cache. + /// Kept in correspondancy with the leaf list attribute within the cache + leaf_list: GpuSparseSet, + leaf_list_attribute: usize, +} + +impl VoxelGiPipeline +where + [(); N * N * N]:, +{ + pub fn new( + device: &wgpu::Device, + cache_size: usize, + cache_layout: &mut voxel_cache::CacheLayout, + ) -> Self + { + let leaf_list_attribute = cache_layout.add_attribute(voxel_cache::CacheAttribute { + label: Some("VoxelGiPipeline::leaf_list_pointer"), + word_count: 1, + init: voxel_cache::CacheAttributeInit::External, + }); + + cache_layout.add_attribute(voxel_cache::CacheAttribute { + label: Some("VoxelGiPipeline::radiance"), + word_count: 3, + init: voxel_cache::CacheAttributeInit::DontTouch, + }); + + let voxel_cache = VoxelCache::new(device, cache_size, cache_layout); + + Self { + voxel_cache, + leaf_list: GpuSparseSet::new(device, cache_size), + leaf_list_attribute, + } + } +} diff --git a/src/gi_pipeline/sparse_set.rs b/src/gi_pipeline/sparse_set.rs new file mode 100644 index 0000000..cea84ae --- /dev/null +++ b/src/gi_pipeline/sparse_set.rs @@ -0,0 +1,57 @@ +use wgpu::util::DeviceExt; + +use crate::gpu::create_multi_buffers_bind_group; +use crate::gpu::create_multi_buffers_bind_group_layout; + +/// To keep a set of voxel nodes in the cache +pub struct GpuSparseSet +{ + /// Maximum size of the set + size: usize, + + /// Contains pointers to nodes in the cache + pointers_buffer: wgpu::Buffer, + + /// Amount of elements in the set + count_buffer: wgpu::Buffer, + + bind_group: wgpu::BindGroup, +} + +impl GpuSparseSet +{ + pub fn new(device: &wgpu::Device, size: usize) -> Self + { + let pointers_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { + label: Some("GpuSparseSet::pointers_buffer"), + usage: wgpu::BufferUsages::STORAGE, + contents: bytemuck::cast_slice(&vec![0u32; size]), + }); + + let count_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { + label: Some("GpuSparseSet::count_buffer"), + usage: wgpu::BufferUsages::STORAGE, + contents: bytemuck::bytes_of(&0u32), + }); + + let bind_group_layout = Self::create_bind_group_layout(device); + let bind_group = create_multi_buffers_bind_group( + device, + &bind_group_layout, + &[&pointers_buffer, &count_buffer], + Some("GpuSparseSet::bind_group"), + ); + + Self { + size, + pointers_buffer, + count_buffer, + bind_group, + } + } + + pub fn create_bind_group_layout(device: &wgpu::Device) -> wgpu::BindGroupLayout + { + create_multi_buffers_bind_group_layout(device, 2, Some("GpuSparseSet::bind_group_layout")) + } +} diff --git a/src/gpu.rs b/src/gpu.rs index b64f630..f2346ba 100644 --- a/src/gpu.rs +++ b/src/gpu.rs @@ -2,3 +2,63 @@ pub mod buffer_compactor; pub mod indirect_buffer; pub mod radix_sort; + +// Utilities +pub fn create_multi_buffers_bind_group_layout( + device: &wgpu::Device, + count: u32, + label: Option<&str>, +) -> wgpu::BindGroupLayout +{ + let entries = (0..count) + .map(|i| wgpu::BindGroupLayoutEntry { + binding: i, + visibility: wgpu::ShaderStages::COMPUTE, + ty: wgpu::BindingType::Buffer { + ty: wgpu::BufferBindingType::Storage { read_only: false }, + has_dynamic_offset: false, + min_binding_size: None, + }, + count: None, + }) + .collect::>(); + + device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { + label, + entries: &entries, + }) +} + +pub fn create_multi_buffers_bind_group( + device: &wgpu::Device, + layout: &wgpu::BindGroupLayout, + buffers: &[&wgpu::Buffer], + label: Option<&str>, +) -> wgpu::BindGroup +{ + let entries = buffers + .iter() + .enumerate() + .map(|(i, buffer)| wgpu::BindGroupEntry { + binding: i as u32, + resource: buffer.as_entire_binding(), + }) + .collect::>(); + + device.create_bind_group(&wgpu::BindGroupDescriptor { + label, + layout, + entries: &entries, + }) +} + +pub fn create_multi_buffers_bg_bg_layout( + device: &wgpu::Device, + buffers: &[&wgpu::Buffer], + label: Option<&str>, +) -> (wgpu::BindGroupLayout, wgpu::BindGroup) +{ + let layout = create_multi_buffers_bind_group_layout(device, buffers.len() as u32, label); + let bg = create_multi_buffers_bind_group(device, &layout, buffers, label); + (layout, bg) +} diff --git a/src/gpu_profiler.rs b/src/gpu_profiler.rs index e0cc084..0f26c8f 100644 --- a/src/gpu_profiler.rs +++ b/src/gpu_profiler.rs @@ -12,6 +12,8 @@ use wgpu::Device; use wgpu::QuerySet; use wgpu::Queue; +pub mod memory_profiler; + macro_rules! begin_frame { ($encoder:ident) => { let mut $encoder = $encoder.begin_frame(None); diff --git a/src/gpu_profiler/memory_profiler.rs b/src/gpu_profiler/memory_profiler.rs new file mode 100644 index 0000000..da346a3 --- /dev/null +++ b/src/gpu_profiler/memory_profiler.rs @@ -0,0 +1,205 @@ +use std::ops::Deref; +use wgpu::util::DeviceExt; + +pub struct Buffer +{ + pub label: String, + pub size: usize, +} + +pub struct Group +{ + pub label: &'static str, + size: Option, + pub buffers: Vec, + pub sub_groups: Vec, +} + +impl Group +{ + pub fn new(label: &'static str) -> Self + { + Self { + label, + size: None, + buffers: Vec::new(), + sub_groups: Vec::new(), + } + } + + pub fn size(&self) -> usize + { + self.size.unwrap_or_else(|| { + self.buffers.iter().map(|b| b.size).sum::() + + self.sub_groups.iter().map(Self::size).sum::() + }) + } + + pub fn size_mut(&mut self) -> usize + { + *self.size.get_or_insert_with(|| { + self.buffers.iter().map(|b| b.size).sum::() + + self + .sub_groups + .iter_mut() + .map(Self::size_mut) + .sum::() + }) + } +} + +pub struct MemoryProfile +{ + stack: Vec, +} + +pub struct Device<'a> +{ + device: wgpu::Device, + profile: &'a mut MemoryProfile, +} + +impl<'a> Device<'a> +{ + pub fn create_buffer(&mut self, desc: &wgpu::BufferDescriptor) -> wgpu::Buffer + { + let buffer = self.device.create_buffer(desc); + self.profile.add_buffer(Buffer { + label: desc.label.unwrap_or("Unnamed").into(), + size: desc.size as usize, + }); + buffer + } + + pub fn create_buffer_init(&mut self, desc: &wgpu::util::BufferInitDescriptor) -> wgpu::Buffer + { + let buffer = self.device.create_buffer_init(desc); + self.profile.add_buffer(Buffer { + label: desc.label.unwrap_or("Unnamed").into(), + size: desc.contents.len(), + }); + buffer + } + + pub fn group<'b>(&'b mut self, group_label: &'static str) -> Device<'b> + where + 'a: 'b, + { + self.profile.open_group(group_label); + Device { + device: self.device.clone(), + profile: self.profile, + } + } +} + +impl<'a> Drop for Device<'a> +{ + fn drop(&mut self) + { + self.profile.close_group(); + } +} + +impl Deref for Device<'_> +{ + type Target = wgpu::Device; + + fn deref(&self) -> &Self::Target + { + &self.device + } +} + +impl MemoryProfile +{ + pub fn new(label: &'static str) -> Self + { + Self { + stack: vec![Group::new(label)], + } + } + + pub fn begin(&mut self, device: &wgpu::Device) -> Device + { + Device { + device: device.clone(), + profile: self, + } + } + + pub fn terminate(mut self) -> Group + { + self.stack.pop().unwrap() + } + + fn open_group(&mut self, label: &'static str) + { + self.stack.push(Group::new(label)); + } + + fn close_group(&mut self) + { + let mut group = self.stack.pop().unwrap(); + let _ = group.size_mut(); + + // Add it to parent if it exists + if let Some(parent) = self.stack.last_mut() + { + parent.sub_groups.push(group); + } + else + { + self.stack.push(group); + } + } + + fn add_buffer(&mut self, buffer: Buffer) + { + self.stack.last_mut().unwrap().buffers.push(buffer); + } +} + +use std::fmt; + +impl fmt::Display for Group +{ + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result + { + self.fmt_with_indent(f, 0) + } +} + +impl Group +{ + fn fmt_with_indent(&self, f: &mut fmt::Formatter<'_>, indent: usize) -> fmt::Result + { + let prefix = " ".repeat(indent); + + writeln!( + f, + "{}{} ({} bytes)", + prefix, + self.label, + self.size.unwrap_or_else(|| self.size()) + )?; + + // Print buffers + for buffer in &self.buffers + { + writeln!( + f, + "{} ├── {} ({} bytes)", + prefix, buffer.label, buffer.size + )?; + } + + // Print subgroups + for (i, group) in self.sub_groups.iter().enumerate() + { + group.fmt_with_indent(f, indent + 1)?; + } + + Ok(()) + } +} diff --git a/src/main.rs b/src/main.rs index 3d88acf..82d2ae1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -204,6 +204,7 @@ impl State max_storage_buffers_per_shader_stage: 32, max_binding_array_elements_per_shader_stage: 16, max_bind_groups: 8, + max_storage_buffer_binding_size: 1_000_000_000, ..Default::default() }, ..Default::default() @@ -359,7 +360,7 @@ impl State init: voxel_cache::CacheAttributeInit::External, }); - let voxel_cache = VoxelCache::<4>::new(&device, 100_000, &layout); + let voxel_cache = VoxelCache::<4>::new(&device, 200_000, &layout); let request_buffer = CacheRequestBuffer::new(&device, 1024); let insertion_data = CacheInsertionData::new(&device, 1024, &layout); diff --git a/src/producers.rs b/src/producers.rs index 493e90f..c7329a8 100644 --- a/src/producers.rs +++ b/src/producers.rs @@ -1,19 +1,10 @@ -use std::f32::EPSILON; -use std::f32::INFINITY; use std::fs::File; use std::path::Path; use glam::Vec3; use itertools::Itertools; -use noise::Billow; -use noise::Cylinders; -use noise::Fbm; use noise::NoiseFn; -use noise::Perlin; -use noise::RidgedMulti; use noise::Simplex; -use noise::SuperSimplex; -use noise::Worley; use rand::random; use crate::sparse_tree::Color; diff --git a/src/voxel_cache.rs b/src/voxel_cache.rs index ff9edc3..8589e00 100644 --- a/src/voxel_cache.rs +++ b/src/voxel_cache.rs @@ -3,13 +3,16 @@ use std::num::NonZero; use wgpu::CommandEncoder; use wgpu::Device; +use crate::gpu::create_multi_buffers_bg_bg_layout; +use crate::gpu::create_multi_buffers_bind_group_layout; use crate::gpu::radix_sort::RadixSorter; use crate::gpu_profiler; use crate::gpu_profiler::ScopeEncoder; +use crate::gpu_profiler::memory_profiler; +use crate::gpu_profiler::memory_profiler::MemoryProfile; use crate::voxel_cache::attributes::CacheAttributes; use crate::voxel_cache::eviction::CacheEvictor; use crate::voxel_cache::insertion::CacheInsertionData; -use crate::voxel_cache::layout::CacheLayout; use crate::voxel_cache::pipelines::CacheInsertionPass; use crate::voxel_cache::pipelines::CacheInvalidationPass; use crate::voxel_cache::pipelines::WritePointersPass; @@ -28,7 +31,9 @@ pub mod schema; pub mod structure; pub mod tables; -pub use layout::*; +pub use layout::CacheAttribute; +pub use layout::CacheAttributeInit; +pub use layout::CacheLayout; /// Stores some ressources that can be reused throughout the modules of the cache struct CacheRessources @@ -40,7 +45,7 @@ struct CacheRessources impl CacheRessources { - pub fn new(device: &Device, page_count: usize) -> Self + pub fn new(device: &mut memory_profiler::Device, page_count: usize) -> Self { let scratch_buffer = device.create_buffer(&wgpu::BufferDescriptor { label: Some("CacheRessources::scratch_buffer"), @@ -127,11 +132,20 @@ where { pub fn new(device: &Device, page_count: usize, layout: &CacheLayout) -> Self { - let structure = CacheStructure::new(device, page_count); - let attributes = CacheAttributes::from_cache_layout(device, layout, page_count); - let request_handler = CacheRequestHandler::new(device, page_count); - let evictor = CacheEvictor::new(device, page_count, 0u32); - let common_ressources = CacheRessources::new(device, page_count); + let mut cache_memory_profile = MemoryProfile::new("VoxelCache"); + let mut mem_device = cache_memory_profile.begin(device); + + let structure = CacheStructure::new(&mut mem_device.group("CacheStructure"), page_count); + let attributes = CacheAttributes::from_cache_layout( + &mut mem_device.group("CacheAttributes"), + layout, + page_count, + ); + let request_handler = + CacheRequestHandler::new(&mut mem_device.group("CacheRequestHandler"), page_count); + let evictor = CacheEvictor::new(&mut mem_device.group("CacheEvictor"), page_count, 0u32); + let common_ressources = + CacheRessources::new(&mut mem_device.group("CacheRessources"), page_count); let write_requests_pass = WriteRequestsPass::new(device, page_count, layout); let cache_insertion_pass = CacheInsertionPass::new(device, page_count, layout); @@ -146,6 +160,10 @@ where &evictor, ); + drop(mem_device); + let mut root_group = cache_memory_profile.terminate(); + println!("{}", root_group); + Self { page_count, structure, @@ -383,63 +401,3 @@ where self.evictor.timestamp_pages_buffer() } } - -// Utilities -fn create_multi_buffers_bind_group_layout( - device: &Device, - count: u32, - label: Option<&str>, -) -> wgpu::BindGroupLayout -{ - let entries = (0..count) - .map(|i| wgpu::BindGroupLayoutEntry { - binding: i, - visibility: wgpu::ShaderStages::COMPUTE, - ty: wgpu::BindingType::Buffer { - ty: wgpu::BufferBindingType::Storage { read_only: false }, - has_dynamic_offset: false, - min_binding_size: None, - }, - count: None, - }) - .collect::>(); - - device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { - label, - entries: &entries, - }) -} - -fn create_multi_buffers_bind_group( - device: &Device, - layout: &wgpu::BindGroupLayout, - buffers: &[&wgpu::Buffer], - label: Option<&str>, -) -> wgpu::BindGroup -{ - let entries = buffers - .iter() - .enumerate() - .map(|(i, buffer)| wgpu::BindGroupEntry { - binding: i as u32, - resource: buffer.as_entire_binding(), - }) - .collect::>(); - - device.create_bind_group(&wgpu::BindGroupDescriptor { - label, - layout, - entries: &entries, - }) -} - -fn create_multi_buffers_bg_bg_layout( - device: &Device, - buffers: &[&wgpu::Buffer], - label: Option<&str>, -) -> (wgpu::BindGroupLayout, wgpu::BindGroup) -{ - let layout = create_multi_buffers_bind_group_layout(device, buffers.len() as u32, label); - let bg = create_multi_buffers_bind_group(device, &layout, buffers, label); - (layout, bg) -} diff --git a/src/voxel_cache/attributes.rs b/src/voxel_cache/attributes.rs index 1f9e6c0..250f149 100644 --- a/src/voxel_cache/attributes.rs +++ b/src/voxel_cache/attributes.rs @@ -2,6 +2,7 @@ use wgpu::BindGroupLayout; use wgpu::Buffer; use wgpu::BufferUsages; +use crate::gpu_profiler::memory_profiler; use crate::voxel_cache::layout::CacheLayout; /// Contains instanciated gpu buffers to hold data for cache attributes @@ -15,14 +16,22 @@ pub struct CacheAttributes impl CacheAttributes { - pub fn from_cache_layout(device: &wgpu::Device, layout: &CacheLayout, page_count: usize) - -> Self + pub fn from_cache_layout( + device: &mut memory_profiler::Device, + layout: &CacheLayout, + page_count: usize, + ) -> Self { let attribute_buffers = layout .attributes .iter() .map(|attribute| { - attribute.create_buffer(device, N * N * N, page_count, BufferUsages::STORAGE) + attribute.create_buffer_profiled( + device, + N * N * N, + page_count, + BufferUsages::STORAGE, + ) }) .collect::>(); diff --git a/src/voxel_cache/eviction.rs b/src/voxel_cache/eviction.rs index 699a188..0cf7b92 100644 --- a/src/voxel_cache/eviction.rs +++ b/src/voxel_cache/eviction.rs @@ -6,12 +6,12 @@ use wgpu::ComputePipeline; use wgpu::include_wgsl; use wgpu::util::DeviceExt; +use crate::gpu::create_multi_buffers_bind_group; use crate::gpu::radix_sort; use crate::gpu_profiler::ScopeEncoder; +use crate::gpu_profiler::memory_profiler; use crate::gpu_profiler::{self}; use crate::voxel_cache::CacheRessources; -use crate::voxel_cache::create_multi_buffers_bg_bg_layout; -use crate::voxel_cache::create_multi_buffers_bind_group; use crate::voxel_cache::create_multi_buffers_bind_group_layout; use crate::voxel_cache::structure::CacheStructure; @@ -44,7 +44,11 @@ pub struct CacheEvictor impl CacheEvictor { - pub fn new(device: &wgpu::Device, page_count: usize, initial_timestamp: u32) -> Self + pub fn new( + device: &mut memory_profiler::Device, + page_count: usize, + initial_timestamp: u32, + ) -> Self { let timestamp_pages = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { label: Some("CacheUsage::timestamp_pages"), diff --git a/src/voxel_cache/layout.rs b/src/voxel_cache/layout.rs index 491c544..ecd3759 100644 --- a/src/voxel_cache/layout.rs +++ b/src/voxel_cache/layout.rs @@ -1,5 +1,7 @@ use wgpu::BufferUsages; +use crate::gpu_profiler::memory_profiler; + /// Defines how a [`VoxelCache`]'s attribute is populated upon populating a page #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum CacheAttributeInit @@ -26,6 +28,29 @@ pub struct CacheAttribute impl CacheAttribute { + pub fn create_buffer_profiled( + &self, + device: &mut memory_profiler::Device, + child_count: usize, + page_count: usize, + usage: wgpu::BufferUsages, + ) -> wgpu::Buffer + { + device.create_buffer(&wgpu::BufferDescriptor { + label: Some( + format!( + "VoxelCacheAttribute ({}) {} word(s)", + self.label.unwrap_or("no-name"), + self.word_count + ) + .as_str(), + ), + size: (self.word_count as usize * page_count * child_count * size_of::()) as u64, + usage, + mapped_at_creation: false, + }) + } + /// Creates the wgpu buffer necessary to store this attribute in the cache pub fn create_buffer( &self, diff --git a/src/voxel_cache/requests.rs b/src/voxel_cache/requests.rs index 9b62a92..00af908 100644 --- a/src/voxel_cache/requests.rs +++ b/src/voxel_cache/requests.rs @@ -10,12 +10,13 @@ use wgpu::include_wgsl; use wgpu::util::DeviceExt; use crate::gpu::buffer_compactor::NonZeroBufferCompactor; +use crate::gpu::create_multi_buffers_bind_group; use crate::gpu::radix_sort::{self}; use crate::gpu_profiler::ScopeEncoder; +use crate::gpu_profiler::memory_profiler; use crate::gpu_profiler::{self}; use crate::voxel_cache::CacheRessources; use crate::voxel_cache::create_multi_buffers_bg_bg_layout; -use crate::voxel_cache::create_multi_buffers_bind_group; use crate::voxel_cache::create_multi_buffers_bind_group_layout; use crate::voxel_cache::schema::RequestInformation; use crate::voxel_cache::schema::RequestMeta; @@ -65,7 +66,7 @@ pub struct CacheRequestBuffer impl CacheRequestHandler { - pub fn new(device: &wgpu::Device, page_count: usize) -> Self + pub fn new(device: &mut memory_profiler::Device, page_count: usize) -> Self { let request_counts_pages = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { label: Some("CacheRequestHandler::request_counts_pages"), diff --git a/src/voxel_cache/structure.rs b/src/voxel_cache/structure.rs index a8bc2fa..d470747 100644 --- a/src/voxel_cache/structure.rs +++ b/src/voxel_cache/structure.rs @@ -2,10 +2,10 @@ use wgpu::BindGroup; use wgpu::BindGroupLayout; use wgpu::Buffer; use wgpu::BufferUsages; -use wgpu::util::DeviceExt; -use crate::voxel_cache::create_multi_buffers_bind_group; -use crate::voxel_cache::create_multi_buffers_bind_group_layout; +use crate::gpu::create_multi_buffers_bind_group; +use crate::gpu::create_multi_buffers_bind_group_layout; +use crate::gpu_profiler::memory_profiler; use crate::voxel_cache::schema::DepthPage; use crate::voxel_cache::schema::StructurePage; @@ -30,7 +30,7 @@ where pub const LOCATION_PAGES_BINDING: u32 = 1; pub const DEPTH_PAGES_BINDING: u32 = 2; - pub fn new(device: &wgpu::Device, page_count: usize) -> Self + pub fn new(device: &mut memory_profiler::Device, page_count: usize) -> Self { let pointer_pages = device.create_buffer(&wgpu::BufferDescriptor { label: Some("CacheStructure::pointer_pages"), diff --git a/src/voxel_cache/tables.rs b/src/voxel_cache/tables.rs index 69b13cb..d1ab43c 100644 --- a/src/voxel_cache/tables.rs +++ b/src/voxel_cache/tables.rs @@ -2,6 +2,7 @@ use wgpu::util::DeviceExt; use crate::gpu::indirect_buffer::IndirectBuffer1D; use crate::gpu_profiler::ScopeEncoder; +use crate::gpu_profiler::memory_profiler::MemoryProfile; use crate::voxel_cache::CacheInvalidable; use crate::voxel_cache::CacheRessources; use crate::voxel_cache::create_multi_buffers_bg_bg_layout; @@ -68,7 +69,15 @@ impl FixedStructureTable contents: bytemuck::cast_slice(&vec![pointer; size]), }); - let request_handler = CacheRequestHandler::<1>::new(device, size); + let mut memory_profile = MemoryProfile::new("FixedStructureTable"); + let mut mem_device = memory_profile.begin(device); + + let request_handler = + CacheRequestHandler::<1>::new(&mut mem_device.group("CacheRequestHandler"), size); + let common_ressources = + CacheRessources::new(&mut mem_device.group("CacheRessources"), size); + drop(mem_device); + drop(memory_profile); let (pointers_bind_group_layout, pointers_bind_group) = create_multi_buffers_bg_bg_layout( device, @@ -167,7 +176,7 @@ impl FixedStructureTable size, pointers, pointers_bind_group, - common_ressources: CacheRessources::new(device, size), + common_ressources, request_handler, indirect_buffer: IndirectBuffer1D::new(device), write_requests_pass,