From b23fe25177733d29edf76058809c61b8ffeb9750 Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Tue, 28 Apr 2020 22:25:57 -0700 Subject: [PATCH] Use linked list strategy for segments Trying to allocate them contiguously wasn't good. --- piet-gpu-types/src/ptcl.rs | 3 +-- piet-gpu-types/src/segment.rs | 9 +++++-- piet-gpu/shader/build.ninja | 4 ++-- piet-gpu/shader/kernel2s.comp | 42 +++++++++++++++++++-------------- piet-gpu/shader/kernel2s.spv | Bin 16608 -> 17528 bytes piet-gpu/shader/kernel3.comp | 3 +-- piet-gpu/shader/kernel3.spv | Bin 19300 -> 18936 bytes piet-gpu/shader/kernel4.comp | 19 +++++++++------ piet-gpu/shader/kernel4.spv | Bin 11640 -> 12328 bytes piet-gpu/shader/ptcl.h | 18 ++++++-------- piet-gpu/shader/segment.h | 43 +++++++++++++++++++++++++++------- piet-gpu/shader/setup.h | 4 ++++ piet-gpu/src/main.rs | 2 +- 13 files changed, 95 insertions(+), 52 deletions(-) diff --git a/piet-gpu-types/src/ptcl.rs b/piet-gpu-types/src/ptcl.rs index 3faffb9..36274c4 100644 --- a/piet-gpu-types/src/ptcl.rs +++ b/piet-gpu-types/src/ptcl.rs @@ -13,8 +13,7 @@ piet_gpu! { end: [f32; 2], } struct CmdStroke { - n_segs: u32, - // Should be Ref if we had cross-module references. + // Should be Ref if we had cross-module references. seg_ref: u32, half_width: f32, rgba_color: u32, diff --git a/piet-gpu-types/src/segment.rs b/piet-gpu-types/src/segment.rs index ba5f3e2..0b18ab8 100644 --- a/piet-gpu-types/src/segment.rs +++ b/piet-gpu-types/src/segment.rs @@ -12,8 +12,7 @@ piet_gpu! { // Note: this is only suitable for strokes, fills require backdrop. struct ItemHeader { - n: u32, - segments: Ref, + segments: Ref, } // TODO: strongly consider using f16. If so, these would be @@ -23,5 +22,11 @@ piet_gpu! { start: [f32; 2], end: [f32; 2], } + + struct SegChunk { + n: u32, + next: Ref, + // Segments follow (could represent this as a variable sized array). + } } } diff --git a/piet-gpu/shader/build.ninja b/piet-gpu/shader/build.ninja index 3da40c9..4a8181f 100644 --- a/piet-gpu/shader/build.ninja +++ b/piet-gpu/shader/build.ninja @@ -13,6 +13,6 @@ build kernel1.spv: glsl kernel1.comp | scene.h tilegroup.h setup.h build kernel2s.spv: glsl kernel2s.comp | scene.h tilegroup.h segment.h setup.h -build kernel3.spv: glsl kernel3.comp | scene.h tilegroup.h ptcl.h setup.h +build kernel3.spv: glsl kernel3.comp | scene.h tilegroup.h segment.h ptcl.h setup.h -build kernel4.spv: glsl kernel4.comp | ptcl.h setup.h +build kernel4.spv: glsl kernel4.comp | ptcl.h segment.h setup.h diff --git a/piet-gpu/shader/kernel2s.comp b/piet-gpu/shader/kernel2s.comp index 3eb2d00..8c60b5b 100644 --- a/piet-gpu/shader/kernel2s.comp +++ b/piet-gpu/shader/kernel2s.comp @@ -44,12 +44,15 @@ void main() { InstanceRef stroke_ref = InstanceRef(chunk_ref.offset + Chunk_size); ItemHeaderRef item_header = ItemHeaderRef(atomicAdd(alloc, stroke_n * ItemHeader_size)); TileHeader_write(tile_header_ref, TileHeader(stroke_n, item_header)); - SegmentRef seg_ref = SegmentRef(0); + SegChunkRef seg_chunk_ref = SegChunkRef(0); uint seg_limit = 0; // Iterate through items; stroke_n holds count remaining. while (true) { if (chunk.chunk_n == 0) { chunk_ref = chunk.next; + if (chunk_ref.offset == 0) { + break; + } chunk = Chunk_read(chunk_ref); stroke_ref = InstanceRef(chunk_ref.offset + Chunk_size); } @@ -58,16 +61,8 @@ void main() { // Process the stroke polyline item. uint max_n_segs = poly.n_points - 1; - uint reserve = max_n_segs * Segment_size; - if (seg_ref.offset + reserve > seg_limit) { - // This is a heuristic to balance atomic bandwidth and utilization. - // The output always gets a contiguous allocation. We might use - // all, some, or none of the capacity. - uint capacity_bytes = stroke_n > 1 ? reserve * 2 + 128 : reserve; - seg_ref.offset = atomicAdd(alloc, capacity_bytes); - seg_limit = seg_ref.offset + capacity_bytes; - } - uint n_segs = 0; + uint chunk_n_segs = 0; + SegChunkRef seg_chunk_ref; vec2 start = Point_read(poly.points).xy; for (uint j = 0; j < max_n_segs; j++) { poly.points.offset += Point_size; @@ -103,18 +98,31 @@ void main() { && max(min(start.y, end.y), ymin) < min(max(start.y, end.y), ymax) && s00 * s01 + s00 * s10 + s00 * s11 < 3.0) { + // Allocate a chunk if needed. + if (chunk_n_segs == 0) { + if (seg_chunk_ref.offset + 40 > seg_limit) { + seg_chunk_ref.offset = atomicAdd(alloc, SEG_CHUNK_ALLOC); + seg_limit = seg_chunk_ref.offset + SEG_CHUNK_ALLOC - Segment_size; + } + ItemHeader_write(item_header, ItemHeader(seg_chunk_ref)); + } else if (seg_chunk_ref.offset + SegChunk_size + Segment_size * chunk_n_segs > seg_limit) { + uint new_chunk_ref = atomicAdd(alloc, SEG_CHUNK_ALLOC); + seg_limit = new_chunk_ref + SEG_CHUNK_ALLOC - Segment_size; + SegChunk_write(seg_chunk_ref, SegChunk(chunk_n_segs, SegChunkRef(new_chunk_ref))); + seg_chunk_ref.offset = new_chunk_ref; + chunk_n_segs = 0; + } Segment seg = Segment(start, end); - Segment_write(Segment_index(seg_ref, n_segs), seg); - n_segs++; + Segment_write(SegmentRef(seg_chunk_ref.offset + SegChunk_size + Segment_size * chunk_n_segs), seg); + chunk_n_segs++; } start = end; } - ItemHeader_write(item_header, ItemHeader(n_segs, seg_ref)); - if (--stroke_n == 0) { - break; + if (chunk_n_segs > 0) { + SegChunk_write(seg_chunk_ref, SegChunk(chunk_n_segs, SegChunkRef(0))); + seg_chunk_ref.offset += SegChunk_size + Segment_size * chunk_n_segs; } - seg_ref.offset += n_segs * Segment_size; stroke_ref.offset += Instance_size; chunk.chunk_n--; diff --git a/piet-gpu/shader/kernel2s.spv b/piet-gpu/shader/kernel2s.spv index 7c7f48f69cd129409b108c4092967ac2799a6c5a..4f249bbbe82be66b12983c07851eb737ee5e5c5d 100644 GIT binary patch literal 17528 zcmZvi2Y_8wwT2Iwnb3Q0F`)zy0)*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`2(q%zYJ}J=C7DUju8iKF(bp+tD-vlSF_Kf`&SetRJfjqYF zfX$T}d>3q8tbzV=ed7N;urd6$97O+pnwsO?mmkm^zk%j>xjv3}FMmkW?mmmN&(p!P zXg-J2+~*neN7Q&G{gE{H{3!a&_eWrToNwm%W3YPoPr#1N?)UvkUfz`5(--FdIrX|lGz|N=4^GCRP&d#5}Pt-ofaPQRgORhhI%UpkftM$>0 z;~qUpGuH-MneVT)E&2WiPd?+APffq_cL-~JI?ZPe&03#KKexuG(w|1N)@RVC)_(_= zwf+a(G3A_|f~%+2{{*Y0*2YlF`uVk{QcJD3fUA|Y-V*M7$~;|Y>REd?IBPeCYgf}R zxq855t_g6pK4PcVTfxoMS?jIQwI$y+;N&xo`PB65to7N%^O;A>J2=0_XVEX9S?g!e zr`FpNr>ymMaL1H2n24sHT5k_lORbHemi6xdR!gmS1go`bJ)wE$+X?P`%%kquZRjVV zYxC#R1o+NiwbWx5aOz=P>!GG!^6v^R^X~>%>m#0VZl~WJp8V>`zX!UuYbZyB$8LXE4`-79;xaL>WFZri{%luQ} kYPS^m4}d3sA9~h*AiB2XKM1Ur{0D=R-?-*i(=X@oUniI3{r~^~ diff --git a/piet-gpu/shader/kernel3.comp b/piet-gpu/shader/kernel3.comp index fc4f9ea..81c24d1 100644 --- a/piet-gpu/shader/kernel3.comp +++ b/piet-gpu/shader/kernel3.comp @@ -87,10 +87,9 @@ void main() { case PietItem_Poly: ItemHeader stroke_item = ItemHeader_read(stroke_th.items); stroke_th.items.offset += ItemHeader_size; - if (stroke_item.n > 0) { + if (stroke_item.segments.offset != 0) { PietStrokePolyLine poly = PietItem_Poly_read(item_ref); CmdStroke cmd = CmdStroke( - stroke_item.n, stroke_item.segments.offset, 0.5 * poly.width, poly.rgba_color diff --git a/piet-gpu/shader/kernel3.spv b/piet-gpu/shader/kernel3.spv index f5b83bc7cec35213b4f2278dd2f7955c3cb1b4b1..3b8aa91edbd837852a8bd75d786250c301e9e74c 100644 GIT binary patch literal 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T{6^ zQ?6gc+y-`h5wi!ZX8T_1K8o$PQfx2RC))Re9Y^f50kHnDhvfR`KbiU!6z%_J|BK_S zOasrL`1o%No|OZs{d=Nkc;FEj=rjz+;bSkG7YBwK?C8O&+#ag44LW;cDqw*#nQb z+N14dU~R^Aj^tsx0-VOZ60Vk>m8;+pS9`R560*|8-!;9R9Bd>mU1Cu21;C0qj`fT)YviW_!=Y zjTGC*`pfl+_HP24bM*ISu>Lnu9FJTd{oVU-p=kG9h~r!w20oJFb2!CwaVYf>6wk#` z)Nw9u2B+uZmW1C5zOCeu)7#+2an2&|w}aJVpT7gF7UQ%JweWu@SS|MXyTEGcK7Thn z)>nJ9eGgch^I@*?u)Pvoul_tv^#&|n7;|&V<gFnsT-}@V zDL!*4k?TCLxgJk#uHM!6P|{pK3)e5r^>c9b$o2DJwa9fU_-=~2xf)X*e{Z@MJcFWc zuJXv$eXxk)vw#x0E(DwFv#HJ1^YaiT&Gn0L{nA|ThpR`f4}jGo*F(S$Qq;}WnDY3& z=}X`vDeC4bk6cdxpGxsLiDIscsZTEPiPWc1%=Co>AAuoYZ1|eh5~Jx%d%SExogzgg-&CAMMfh z$6#&7b!_smJq=Fd{sgYJkrH>sPr(sad$j!-SetR3BYD_<4o>6#0?tgv_>TPx*f#2}`xffIQrru!hkeTRiTXR7JdFN*f#3X b=fA-Axs_s{a{Y|Cg!> 2; - ptcl[ix + 0] = s.n_segs; - ptcl[ix + 1] = s.seg_ref; - ptcl[ix + 2] = floatBitsToUint(s.half_width); - ptcl[ix + 3] = s.rgba_color; + ptcl[ix + 0] = s.seg_ref; + ptcl[ix + 1] = floatBitsToUint(s.half_width); + ptcl[ix + 2] = s.rgba_color; } CmdFill CmdFill_read(CmdFillRef ref) { diff --git a/piet-gpu/shader/segment.h b/piet-gpu/shader/segment.h index 517c115..2843b64 100644 --- a/piet-gpu/shader/segment.h +++ b/piet-gpu/shader/segment.h @@ -12,6 +12,10 @@ struct SegmentRef { uint offset; }; +struct SegChunkRef { + uint offset; +}; + struct TileHeader { uint n; ItemHeaderRef items; @@ -24,11 +28,10 @@ TileHeaderRef TileHeader_index(TileHeaderRef ref, uint index) { } struct ItemHeader { - uint n; - SegmentRef segments; + SegChunkRef segments; }; -#define ItemHeader_size 8 +#define ItemHeader_size 4 ItemHeaderRef ItemHeader_index(ItemHeaderRef ref, uint index) { return ItemHeaderRef(ref.offset + index * ItemHeader_size); @@ -45,6 +48,17 @@ SegmentRef Segment_index(SegmentRef ref, uint index) { return SegmentRef(ref.offset + index * Segment_size); } +struct SegChunk { + uint n; + SegChunkRef next; +}; + +#define SegChunk_size 8 + +SegChunkRef SegChunk_index(SegChunkRef ref, uint index) { + return SegChunkRef(ref.offset + index * SegChunk_size); +} + TileHeader TileHeader_read(TileHeaderRef ref) { uint ix = ref.offset >> 2; uint raw0 = segment[ix + 0]; @@ -64,17 +78,14 @@ void TileHeader_write(TileHeaderRef ref, TileHeader s) { ItemHeader ItemHeader_read(ItemHeaderRef ref) { uint ix = ref.offset >> 2; uint raw0 = segment[ix + 0]; - uint raw1 = segment[ix + 1]; ItemHeader s; - s.n = raw0; - s.segments = SegmentRef(raw1); + s.segments = SegChunkRef(raw0); return s; } void ItemHeader_write(ItemHeaderRef ref, ItemHeader s) { uint ix = ref.offset >> 2; - segment[ix + 0] = s.n; - segment[ix + 1] = s.segments.offset; + segment[ix + 0] = s.segments.offset; } Segment Segment_read(SegmentRef ref) { @@ -97,3 +108,19 @@ void Segment_write(SegmentRef ref, Segment s) { segment[ix + 3] = floatBitsToUint(s.end.y); } +SegChunk SegChunk_read(SegChunkRef ref) { + uint ix = ref.offset >> 2; + uint raw0 = segment[ix + 0]; + uint raw1 = segment[ix + 1]; + SegChunk s; + s.n = raw0; + s.next = SegChunkRef(raw1); + return s; +} + +void SegChunk_write(SegChunkRef ref, SegChunk s) { + uint ix = ref.offset >> 2; + segment[ix + 0] = s.n; + segment[ix + 1] = s.next.offset; +} + diff --git a/piet-gpu/shader/setup.h b/piet-gpu/shader/setup.h index a644dc0..2bebabe 100644 --- a/piet-gpu/shader/setup.h +++ b/piet-gpu/shader/setup.h @@ -32,3 +32,7 @@ #define TILE_HEIGHT_PX 16 #define PTCL_INITIAL_ALLOC 1024 + +// Maximum number of segments in a SegChunk +#define SEG_CHUNK_N 32 +#define SEG_CHUNK_ALLOC 512 \ No newline at end of file diff --git a/piet-gpu/src/main.rs b/piet-gpu/src/main.rs index 949ccc2..0a41a16 100644 --- a/piet-gpu/src/main.rs +++ b/piet-gpu/src/main.rs @@ -53,7 +53,7 @@ fn render_scene(rc: &mut impl RenderContext) { } fn render_cardioid(rc: &mut impl RenderContext) { - let n = 100; + let n = 91; let dth = std::f64::consts::PI * 2.0 / (n as f64); let center = Point::new(1024.0, 768.0); let r = 750.0;