From cc89d0e285b893964385ffba04e924d8f31c44e4 Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Wed, 13 May 2020 15:35:19 -0700 Subject: [PATCH] Starting coarse rasterizer Working down the pipeline. WIP --- piet-gpu/bin/cli.rs | 7 +- piet-gpu/shader/binning.comp | 23 +------ piet-gpu/shader/binning.spv | Bin 17052 -> 16812 bytes piet-gpu/shader/build.ninja | 4 +- piet-gpu/shader/coarse.comp | 129 +++++++++++++++++++++++++++++++++++ piet-gpu/shader/coarse.spv | Bin 0 -> 9136 bytes piet-gpu/shader/setup.h | 19 +++++- piet-gpu/src/lib.rs | 38 +++++++++++ 8 files changed, 196 insertions(+), 24 deletions(-) create mode 100644 piet-gpu/shader/coarse.comp create mode 100644 piet-gpu/shader/coarse.spv diff --git a/piet-gpu/bin/cli.rs b/piet-gpu/bin/cli.rs index 4a4fed3..73f33ee 100644 --- a/piet-gpu/bin/cli.rs +++ b/piet-gpu/bin/cli.rs @@ -41,7 +41,7 @@ fn main() -> Result<(), Error> { let fence = device.create_fence(false)?; let mut cmd_buf = device.create_cmd_buf()?; - let query_pool = device.create_query_pool(3)?; + let query_pool = device.create_query_pool(4)?; let mut ctx = PietGpuRenderContext::new(); render_scene(&mut ctx); @@ -61,11 +61,16 @@ fn main() -> Result<(), Error> { let ts = device.reap_query_pool(&query_pool).unwrap(); println!("Element kernel time: {:.3}ms", ts[0] * 1e3); println!("Binning kernel time: {:.3}ms", (ts[1] - ts[0]) * 1e3); + println!("Coarse kernel time: {:.3}ms", (ts[2] - ts[1]) * 1e3); /* let mut data: Vec = Default::default(); device.read_buffer(&renderer.bin_buf, &mut data).unwrap(); piet_gpu::dump_k1_data(&data); + + let mut data: Vec = Default::default(); + device.read_buffer(&renderer.ptcl_buf, &mut data).unwrap(); + piet_gpu::dump_k1_data(&data); */ let mut img_data: Vec = Default::default(); diff --git a/piet-gpu/shader/binning.comp b/piet-gpu/shader/binning.comp index 6e252c0..c3067e7 100644 --- a/piet-gpu/shader/binning.comp +++ b/piet-gpu/shader/binning.comp @@ -3,20 +3,7 @@ #version 450 #extension GL_GOOGLE_include_directive : enable -#define N_ROWS 4 -#define WG_SIZE 32 -#define LG_WG_SIZE 5 -#define TILE_SIZE (WG_SIZE * N_ROWS) - -// TODO: move these to setup file -#define N_TILE_X 16 -#define N_TILE_Y 16 -#define N_TILE (N_TILE_X * N_TILE_Y) -#define N_SLICE (N_TILE / 32) -#define N_WG 16 // Number of workgroups, should be 1 per SM - -#define BIN_INITIAL_ALLOC 64 -#define BIN_ALLOC 256 +#include "setup.h" layout(local_size_x = N_TILE, local_size_y = 1) in; @@ -37,7 +24,6 @@ layout(set = 0, binding = 2) buffer BinsBuf { #include "annotated.h" #include "bins.h" -#include "setup.h" // scale factors useful for converting coordinates to bins #define SX (1.0 / float(N_TILE_X * TILE_WIDTH_PX)) @@ -135,9 +121,7 @@ void main() { uint next_chunk = chunk_ref.offset + BinChunk_size + chunk_n * 4; if (next_chunk + BinChunk_size + min(24, element_count * 4) > wr_limit) { uint alloc_amount = max(BIN_ALLOC, BinChunk_size + element_count * 4); - if (alloc_amount - BIN_ALLOC < 64) { - alloc_amount = BIN_ALLOC; - } + // could try to reduce fragmentation if BIN_ALLOC is only a bit above needed next_chunk = atomicAdd(alloc, alloc_amount); wr_limit = next_chunk + alloc_amount; } @@ -149,9 +133,6 @@ void main() { chunk_end = wr_limit; chunk_n = (wr_limit - instance_ref.offset) / 4; uint alloc_amount = max(BIN_ALLOC, BinChunk_size + (element_count - chunk_n) * 4); - if (alloc_amount - BIN_ALLOC < 64) { - alloc_amount = BIN_ALLOC; - } chunk_new_start = atomicAdd(alloc, alloc_amount); wr_limit = chunk_new_start + alloc_amount; BinChunk_write(chunk_ref, BinChunk(chunk_n, BinChunkRef(chunk_new_start))); diff --git a/piet-gpu/shader/binning.spv b/piet-gpu/shader/binning.spv index fa33483768f6342f2191a639082cbad3b311ff96..76148c2c44d71cb55a0d2ef55715d2d6f77ee77c 100644 GIT binary patch delta 3928 z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ance_read(BinInstanceRef(start_chunk + BinChunk_size)).element_ix : ~0; + } + uint probe = 0; // for debugging + do { + for (uint i = 0; i < N_SLICE; i++) { + sh_bitmaps[i][th_ix] = 0; + } + + while (wr_ix - rd_ix <= N_TILE) { + // Choose segment with least element. + uint my_min; + if (th_ix < N_WG) { + if (th_ix == 0) { + sh_selected_n = 0; + sh_min_buf = ~1; + } + } + barrier(); + // Tempting to do this with subgroups, but atomic should be good enough. + my_min = sh_first_el[th_ix]; + if (th_ix < N_WG) { + atomicMin(sh_min_buf, my_min); + } + barrier(); + if (th_ix < N_WG) { + if (sh_first_el[th_ix] == sh_min_buf) { + sh_elements_ref = sh_chunk[th_ix] + BinChunk_size; + uint selected_n = sh_chunk_n[th_ix]; + sh_selected_n = selected_n; + uint next_chunk = sh_chunk_next[th_ix]; + if (next_chunk == 0) { + sh_first_el[th_ix] = ~0; + } else { + sh_chunk[th_ix] = next_chunk; + BinChunk chunk = BinChunk_read(BinChunkRef(next_chunk)); + sh_chunk_n[th_ix] = chunk.n; + sh_chunk_next[th_ix] = chunk.next.offset; + sh_first_el[th_ix] = BinInstance_read( + BinInstanceRef(next_chunk + BinChunk_size)).element_ix; + } + } + } + barrier(); + uint chunk_n = sh_selected_n; + if (chunk_n == 0) { + // All chunks consumed + break; + } + BinInstanceRef inst_ref = BinInstanceRef(sh_elements_ref); + if (th_ix < chunk_n) { + uint el = BinInstance_read(BinInstance_index(inst_ref, th_ix)).element_ix; + sh_elements[(wr_ix + th_ix) % N_RINGBUF] = el; + probe = el; + } + wr_ix += chunk_n; + } + + // We've done the merge and filled the buffer. + uint tag = Annotated_Nop; + AnnotatedRef ref; + if (th_ix + rd_ix < wr_ix) { + uint element_ix = (sh_elements[rd_ix] + th_ix) % N_RINGBUF; + ref = AnnotatedRef(element_ix * Annotated_size); + tag = Annotated_tag(ref); + probe = tag; + } + rd_ix += N_TILE; + } while (wr_ix > rd_ix); + ptcl[bin_ix * N_TILE + th_ix] = probe; +} diff --git a/piet-gp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Buffer, el_pipeline: D::Pipeline, el_ds: D::DescriptorSet, @@ -127,6 +128,12 @@ pub struct Renderer { bin_alloc_buf_host: D::Buffer, bin_alloc_buf_dev: D::Buffer, + coarse_pipeline: D::Pipeline, + coarse_ds: D::DescriptorSet, + + coarse_alloc_buf_host: D::Buffer, + coarse_alloc_buf_dev: D::Buffer, + /* k1_alloc_buf_host: D::Buffer, k1_alloc_buf_dev: D::Buffer, @@ -172,6 +179,7 @@ impl Renderer { let state_buf = device.create_buffer(64 * 1024 * 1024, dev)?; let anno_buf = device.create_buffer(64 * 1024 * 1024, dev)?; let bin_buf = device.create_buffer(64 * 1024 * 1024, dev)?; + let ptcl_buf = device.create_buffer(48 * 1024 * 1024, dev)?; let image_dev = device.create_image2d(WIDTH as u32, HEIGHT as u32, dev)?; let el_code = include_bytes!("../shader/elements.spv"); @@ -202,6 +210,23 @@ impl Renderer { &[], )?; + let coarse_alloc_buf_host = device.create_buffer(4, host)?; + let coarse_alloc_buf_dev = device.create_buffer(4, dev)?; + + let coarse_alloc_start = 256 * 64 * N_WG; + device + .write_buffer(&coarse_alloc_buf_host, &[ + coarse_alloc_start, + ]) + ?; + let coarse_code = include_bytes!("../shader/coarse.spv"); + let coarse_pipeline = device.create_simple_compute_pipeline(coarse_code, 4, 0)?; + let coarse_ds = device.create_descriptor_set( + &coarse_pipeline, + &[&anno_buf, &bin_buf, &coarse_alloc_buf_dev, &ptcl_buf], + &[], + )?; + /* let tilegroup_buf = device.create_buffer(4 * 1024 * 1024, dev)?; let ptcl_buf = device.create_buffer(48 * 1024 * 1024, dev)?; @@ -285,11 +310,16 @@ impl Renderer { el_ds, bin_pipeline, bin_ds, + coarse_pipeline, + coarse_ds, state_buf, anno_buf, bin_buf, + ptcl_buf, bin_alloc_buf_host, bin_alloc_buf_dev, + coarse_alloc_buf_host, + coarse_alloc_buf_dev, n_elements, }) } @@ -297,6 +327,7 @@ impl Renderer { pub unsafe fn record(&self, cmd_buf: &mut impl CmdBuf, query_pool: &D::QueryPool) { cmd_buf.copy_buffer(&self.scene_buf, &self.scene_dev); cmd_buf.copy_buffer(&self.bin_alloc_buf_host, &self.bin_alloc_buf_dev); + cmd_buf.copy_buffer(&self.coarse_alloc_buf_host, &self.coarse_alloc_buf_dev); cmd_buf.memory_barrier(); cmd_buf.image_barrier( &self.image_dev, @@ -319,6 +350,13 @@ impl Renderer { ); cmd_buf.write_timestamp(&query_pool, 2); cmd_buf.memory_barrier(); + cmd_buf.dispatch( + &self.coarse_pipeline, + &self.coarse_ds, + (WIDTH as u32 / 256, HEIGHT as u32 / 256, 1), + ); + cmd_buf.write_timestamp(&query_pool, 3); + cmd_buf.memory_barrier(); cmd_buf.image_barrier(&self.image_dev, ImageLayout::General, ImageLayout::BlitSrc); } }