chrono_batch_render/
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
148 / 155
95.5%
Branches:
248 / 292
84.9%
Functions:
11 / 11, 4 excl
100.0%

stage/columns/column_store.h
Line Branch Exec Source
1 // SPDX-License-Identifier: BSD-3-Clause
2 #pragma once
3
4 #include <cstddef>
5 #include <cstdint>
6 #include <map>
7 #include <memory>
8 #include <span>
9 #include <string>
10
11 #include <unordered_map>
12 #include <vector>
13
14 #include <dlpack/dlpack.h>
15
16 #include "chrono_batch_render/device/buffer.h"
17 #include "chrono_batch_render/device/commands.h"
18 #include "chrono_batch_render/device/device.h"
19 #include "chrono_batch_render/device/program.h"
20 #include "chrono_batch_render/device/queue.h"
21 #include "chrono_batch_render/device/ref.h"
22 #include "chrono_batch_render/stage/columns/array_pool.h"
23 #include "chrono_batch_render/stage/columns/column_table.h"
24 #include "chrono_batch_render/stage/columns/device_heap.h"
25 #include "chrono_batch_render/stage/columns/kernels/authored.h"
26 #include "chrono_batch_render/stage/columns/kernels/cells.h"
27 #include "chrono_batch_render/stage/columns/kernels/changes.h"
28 #include "chrono_batch_render/stage/schema/schema.h"
29 #include "chrono_batch_render/stage/store_lock.h"
30
31 namespace chrono::batch_render {
32
33 using Ordinal = uint64_t;
34
35 enum PrimColumn : uint32_t {
36 kPrimSchema,
37 kPrimParent,
38 kPrimWorld,
39 kPrimFlags,
40 kPrimSlots,
41 kPrimApis
42 };
43
44 inline constexpr uint32_t kNoStamp = ~0u;
45
46 struct Attachment {
47 ColumnRef column;
48 std::vector<uint32_t> rows;
49 std::vector<uint32_t> sorted;
50 bool inPlace = false;
51 std::shared_ptr<const DLTensor> tensor;
52 };
53
54 class ColumnStore {
55 public:
56 explicit ColumnStore(device::Device& device);
57 ~ColumnStore();
58 ColumnStore(const ColumnStore&) = delete;
59 ColumnStore& operator=(const ColumnStore&) = delete;
60
61 211995 device::Device& GetDevice() const {
62
43/50
✓ Branch 0 taken 60 times.
✓ Branch 1 taken 491 times.
✓ Branch 1 taken 1809 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 5434 times.
✓ Branch 2 taken 2364 times.
✓ Branch 3 taken 382 times.
✓ Branch 3 taken 186 times.
✓ Branch 3 taken 100 times.
✓ Branch 4 taken 11 times.
✓ Branch 4 taken 1759 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1320 times.
✓ Branch 5 taken 525 times.
✓ Branch 5 taken 461 times.
✗ Branch 6 not taken.
✓ Branch 6 taken 7 times.
✓ Branch 6 taken 866 times.
✓ Branch 7 taken 34 times.
✓ Branch 7 taken 360 times.
✓ Branch 7 taken 40 times.
✓ Branch 7 taken 431 times.
✓ Branch 8 taken 264 times.
✓ Branch 8 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 8 taken 31 times.
✓ Branch 9 taken 94 times.
✓ Branch 10 taken 1 time.
✓ Branch 10 taken 115 times.
✓ Branch 11 taken 16859 times.
✗ Branch 12 not taken.
✓ Branch 12 taken 26 times.
✓ Branch 13 taken 22 times.
✓ Branch 13 taken 35118 times.
✓ Branch 14 taken 2280 times.
✓ Branch 14 taken 5 times.
✓ Branch 15 taken 1162 times.
✓ Branch 15 taken 786 times.
✓ Branch 16 taken 33966 times.
✓ Branch 17 taken 784 times.
✓ Branch 18 taken 12716 times.
✓ Branch 20 taken 177 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 7 times.
✓ Branch 23 taken 331 times.
✗ Branch 25 not taken.
✗ Branch 28 not taken.
✓ Branch 37 taken 5 times.
✓ Branch 38 taken 1 time.
✓ Branch 42 taken 1 time.
211991 return m_device;
63 }
64
65 706 void SetLock(const StoreLock* lock) {
66 706 m_lock = lock;
67 }
68
69 633168 const StoreLock* Lock() const {
70
53/64
✓ Branch 0 taken 92862 times.
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 16391 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 88936 times.
✓ Branch 2 taken 230 times.
✓ Branch 3 taken 12887 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 82460 times.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 15 times.
✓ Branch 6 taken 108 times.
✗ Branch 7 not taken.
✓ Branch 7 taken 7 times.
✓ Branch 8 taken 36374 times.
✓ Branch 9 taken 11 times.
✓ Branch 10 taken 40507 times.
✓ Branch 10 taken 530 times.
✓ Branch 11 taken 1 time.
✗ Branch 11 not taken.
✓ Branch 12 taken 2208 times.
✓ Branch 12 taken 417 times.
✓ Branch 13 taken 9 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 300 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 3964 times.
✓ Branch 17 taken 14 times.
✓ Branch 18 taken 823 times.
✓ Branch 19 taken 25 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 3 times.
✓ Branch 22 taken 12517 times.
✓ Branch 23 taken 142 times.
✓ Branch 24 taken 12577 times.
✓ Branch 25 taken 141 times.
✓ Branch 26 taken 110 times.
✓ Branch 27 taken 6 times.
✓ Branch 28 taken 1 time.
✓ Branch 29 taken 6 times.
✓ Branch 30 taken 2 times.
✓ Branch 31 taken 7 times.
✓ Branch 32 taken 12 times.
✓ Branch 33 taken 4 times.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✓ Branch 36 taken 9 times.
✓ Branch 37 taken 5 times.
✓ Branch 38 taken 1 time.
✓ Branch 39 taken 5 times.
✓ Branch 40 taken 2 times.
✓ Branch 41 taken 1 time.
✓ Branch 42 taken 62 times.
✓ Branch 43 taken 8 times.
✓ Branch 44 taken 42001 times.
✓ Branch 45 taken 50 times.
✓ Branch 46 taken 42079 times.
✓ Branch 47 taken 107 times.
✓ Branch 48 taken 12575 times.
✓ Branch 49 taken 151 times.
✓ Branch 50 taken 130988 times.
✓ Branch 51 taken 509 times.
633168 return m_lock;
71 }
72
73 DeviceHeap& GetDeviceHeap() {
74 return m_heap;
75 }
76
77 ColumnTable& Schema(SchemaId schema);
78 const ColumnTable& Schema(SchemaId schema) const;
79
80 void Pin(SchemaId schema);
81 void Unpin(SchemaId schema);
82 bool Pinned(SchemaId schema) const;
83
84 149930 ColumnTable& Prims() {
85
6/6
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 127 times.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 127 times.
✓ Branch 9 taken 2477 times.
✓ Branch 12 taken 2477 times.
149930 return m_prims;
86 }
87
88 5646 ColumnTable& Slots() {
89
5/5
✓ Branch 2 taken 126 times.
✓ Branch 5 taken 20 times.
✓ Branch 8 taken 2718 times.
✓ Branch 11 taken 2718 times.
✓ Branch 14 taken 127 times.
8364 return m_slots;
90 }
91
92 8 ColumnTable& Worlds() {
93
2/2
<unknown function 84>:
✓ Branch 1 taken 1 time.
<unknown function 92>:
✓ Branch 1 taken 1 time.
8 return m_worlds;
94 }
95
96 ArrayPool& Arrays(ColumnType type);
97
98 void Attach(Attachment attachment);
99 const Attachment* FindAttachment(ColumnRef column, std::span<const uint32_t> rows) const;
100 bool Attached(ColumnRef column, std::span<const uint32_t> rows) const;
101 Attachment Detach(ColumnRef column, std::span<const uint32_t> rows);
102
103 43231 uint32_t AttachmentCount() const {
104
8/8
✓ Branch 0 taken 25 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 10 times.
✓ Branch 6 taken 2 times.
✓ Branch 7 taken 43183 times.
43231 return uint32_t(m_attachments.size());
105 }
106
107 uint32_t PrimsColumn(SchemaId schema) const;
108 uint32_t StampColumn(ColumnRef column) const;
109 bool Tracked(ColumnRef column) const;
110 void TrackRows(ColumnRef column);
111
112 void Touch(ColumnRef column);
113 uint64_t LastWrite(ColumnRef column) const;
114
115 55867 uint64_t WriteSequence() const {
116
11/11
<unknown function 61>:
✓ Branch 0 taken 1934 times.
✓ Branch 0 taken 490 times.
✓ Branch 1 taken 768 times.
✓ Branch 1 taken 300 times.
✓ Branch 1 taken 1299 times.
✓ Branch 1 taken 545 times.
✓ Branch 2 taken 10464 times.
✓ Branch 2 taken 28 times.
✓ Branch 4 taken 20580 times.
✓ Branch 5 taken 1261 times.
<unknown function 84>:
✓ Branch 1 taken 1 time.
55867 return m_writes;
117 }
118
119 41391 Ordinal Stamp() const {
120
4/5
<unknown function 61>:
✗ Branch 1 not taken.
✓ Branch 1 taken 36 times.
✓ Branch 4 taken 16860 times.
<unknown function 92>:
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
41391 return m_stamp;
121 }
122
123 16905 void SetStamp(Ordinal stamp) {
124
11/15
<unknown function 61>:
✗ Branch 1 not taken.
✓ Branch 4 taken 1 time.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✓ Branch 13 taken 1 time.
<unknown function 84>:
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
<unknown function 92>:
✓ Branch 1 taken 1 time.
✓ Branch 1 taken 1 time.
✗ Branch 4 not taken.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 20 taken 1 time.
16872 m_stamp = stamp;
125 33 }
126
127 StampTarget Stamps(ColumnRef column);
128 void StampWorld(uint32_t world);
129 Ordinal WorldStamp(uint32_t world) const;
130
131 void Stage(ColumnRef column, uint32_t first, std::span<const std::byte> cells);
132 void Fill(ColumnRef column, uint32_t first, uint32_t count, std::span<const std::byte> cell);
133 void Override(ColumnRef column, uint32_t row, uint64_t owner,
134 std::span<const std::byte> authored, std::span<const std::byte> value);
135 void ClearOverride(ColumnRef column, uint32_t row, uint64_t owner);
136 bool Overridden(ColumnRef column, uint32_t row) const;
137 std::vector<std::byte> Authored(ColumnRef column, uint32_t row) const;
138 void Reassert(ColumnRef column, std::span<const uint32_t> rows);
139 void DropOverrides(SchemaId table, uint32_t row);
140 void CloneRows(SchemaId table, std::span<const uint32_t> sources, uint32_t first,
141 uint32_t copies);
142
143 ArrayRef Array(ColumnRef column, uint32_t row) const;
144 bool Exclusive(ColumnRef column, uint32_t row) const;
145 void SetArray(ColumnRef column, uint32_t row, const ArrayRef& array);
146 std::vector<uint32_t> ArrayRows(ColumnRef column, Ordinal since, Ordinal until) const;
147 void LogArrayRows(ColumnRef column, std::span<const uint32_t> rows);
148 void TrimArrayWrites(Ordinal through, std::span<const std::pair<ColumnRef, Ordinal>> held = {});
149
150 void SetCounts(uint32_t prims, uint32_t worlds);
151
152 void Flush();
153 AuthoredData Data() const;
154 uint64_t DeviceData();
155
156 353 void Prepare() {
157
1/1
✓ Branch 1 taken 353 times.
353 Kernels();
158 353 }
159
160 device::Download ReadRowsAsync(const Ref<device::Buffer>& source, uint32_t stride,
161 std::span<const uint32_t> rows);
162
163 template <class T>
164 174 std::vector<T> ReadRows(const Ref<device::Buffer>& source, std::span<const uint32_t> rows) {
165 static_assert(sizeof(T) % sizeof(uint32_t) == 0);
166 174 std::vector<T> values(rows.size());
167
3/3
std::vector<chrono::batch_render::Box, std::allocator<chrono::batch_render::Box> > chrono::batch_render::ColumnStore::ReadRows<chrono::batch_render::Box>(chrono::batch_render::Ref<chrono::batch_render::device::Buffer> const&, std::span<unsigned int const, 18446744073709551615ul>):
✓ Branch 1 taken 113 times.
std::vector<chrono::batch_render::ResolvedImageable, std::allocator<chrono::batch_render::ResolvedImageable> > chrono::batch_render::ColumnStore::ReadRows<chrono::batch_render::ResolvedImageable>(chrono::batch_render::Ref<chrono::batch_render::device::Buffer> const&, std::span<unsigned int const, 18446744073709551615ul>):
✓ Branch 1 taken 8 times.
std::vector<chrono::batch_render::WorldTransform, std::allocator<chrono::batch_render::WorldTransform> > chrono::batch_render::ColumnStore::ReadRows<chrono::batch_render::WorldTransform>(chrono::batch_render::Ref<chrono::batch_render::device::Buffer> const&, std::span<unsigned int const, 18446744073709551615ul>):
✓ Branch 1 taken 53 times.
174 const device::Download download = ReadRowsAsync(source, sizeof(T), rows);
168
3/3
std::vector<chrono::batch_render::Box, std::allocator<chrono::batch_render::Box> > chrono::batch_render::ColumnStore::ReadRows<chrono::batch_render::Box>(chrono::batch_render::Ref<chrono::batch_render::device::Buffer> const&, std::span<unsigned int const, 18446744073709551615ul>):
✓ Branch 1 taken 113 times.
std::vector<chrono::batch_render::ResolvedImageable, std::allocator<chrono::batch_render::ResolvedImageable> > chrono::batch_render::ColumnStore::ReadRows<chrono::batch_render::ResolvedImageable>(chrono::batch_render::Ref<chrono::batch_render::device::Buffer> const&, std::span<unsigned int const, 18446744073709551615ul>):
✓ Branch 1 taken 8 times.
std::vector<chrono::batch_render::WorldTransform, std::allocator<chrono::batch_render::WorldTransform> > chrono::batch_render::ColumnStore::ReadRows<chrono::batch_render::WorldTransform>(chrono::batch_render::Ref<chrono::batch_render::device::Buffer> const&, std::span<unsigned int const, 18446744073709551615ul>):
✓ Branch 1 taken 53 times.
174 download.Wait();
169
10/15
std::vector<chrono::batch_render::Box, std::allocator<chrono::batch_render::Box> > chrono::batch_render::ColumnStore::ReadRows<chrono::batch_render::Box>(chrono::batch_render::Ref<chrono::batch_render::device::Buffer> const&, std::span<unsigned int const, 18446744073709551615ul>):
✓ Branch 0 taken 113 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 113 times.
✓ Branch 5 taken 113 times.
✗ Branch 6 not taken.
std::vector<chrono::batch_render::ResolvedImageable, std::allocator<chrono::batch_render::ResolvedImageable> > chrono::batch_render::ColumnStore::ReadRows<chrono::batch_render::ResolvedImageable>(chrono::batch_render::Ref<chrono::batch_render::device::Buffer> const&, std::span<unsigned int const, 18446744073709551615ul>):
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 8 times.
✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
std::vector<chrono::batch_render::WorldTransform, std::allocator<chrono::batch_render::WorldTransform> > chrono::batch_render::ColumnStore::ReadRows<chrono::batch_render::WorldTransform>(chrono::batch_render::Ref<chrono::batch_render::device::Buffer> const&, std::span<unsigned int const, 18446744073709551615ul>):
✓ Branch 0 taken 52 times.
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 52 times.
✓ Branch 5 taken 52 times.
✗ Branch 6 not taken.
174 if (!values.empty() && download.Bytes().size() == values.size() * sizeof(T)) {
170
3/3
std::vector<chrono::batch_render::Box, std::allocator<chrono::batch_render::Box> > chrono::batch_render::ColumnStore::ReadRows<chrono::batch_render::Box>(chrono::batch_render::Ref<chrono::batch_render::device::Buffer> const&, std::span<unsigned int const, 18446744073709551615ul>):
✓ Branch 1 taken 113 times.
std::vector<chrono::batch_render::ResolvedImageable, std::allocator<chrono::batch_render::ResolvedImageable> > chrono::batch_render::ColumnStore::ReadRows<chrono::batch_render::ResolvedImageable>(chrono::batch_render::Ref<chrono::batch_render::device::Buffer> const&, std::span<unsigned int const, 18446744073709551615ul>):
✓ Branch 1 taken 8 times.
std::vector<chrono::batch_render::WorldTransform, std::allocator<chrono::batch_render::WorldTransform> > chrono::batch_render::ColumnStore::ReadRows<chrono::batch_render::WorldTransform>(chrono::batch_render::Ref<chrono::batch_render::device::Buffer> const&, std::span<unsigned int const, 18446744073709551615ul>):
✓ Branch 1 taken 52 times.
173 std::memcpy(values.data(), download.Bytes().data(), values.size() * sizeof(T));
171 }
172 174 return values;
173 174 }
174
175 template <class Params>
176 4071 void Record(device::CommandEncoder& encoder, const char* entry, const Params& params,
177 uint64_t threads) {
178
2/2
✓ Branch 0 taken 3732 times.
✓ Branch 1 taken 339 times.
4071 if (threads == 0) {
179 3732 return;
180 }
181
1/1
✓ Branch 1 taken 339 times.
678 const device::ZoneScope zone(encoder,
182
1/1
✓ Branch 2 taken 339 times.
678 profiler::ZoneId::Named(std::string("ColumnStore/") + entry));
183
3/3
✓ Branch 1 taken 339 times.
✓ Branch 4 taken 339 times.
✓ Branch 7 taken 339 times.
339 encoder.Dispatch(Kernels().Entry(entry), params,
184
1/1
✓ Branch 1 taken 339 times.
339 {.x = device::GroupCount(threads, kCellsGroup)});
185 339 }
186
187 template <class Params>
188 37151 device::Operation Dispatch(const char* entry, const Params& params, uint64_t threads) {
189
7/14
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::CellsParams>(char const*, chrono::batch_render::CellsParams const&, unsigned long):
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::CloneRowsParams>(char const*, chrono::batch_render::CloneRowsParams const&, unsigned long):
✗ Branch 0 not taken.
✓ Branch 1 taken 1205 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::CopyWordsParams>(char const*, chrono::batch_render::CopyWordsParams const&, unsigned long):
✗ Branch 0 not taken.
✓ Branch 1 taken 372 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::FillCellsParams>(char const*, chrono::batch_render::FillCellsParams const&, unsigned long):
✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::GatherRowsParams>(char const*, chrono::batch_render::GatherRowsParams const&, unsigned long):
✗ Branch 0 not taken.
✓ Branch 1 taken 273 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::PoseParams>(char const*, chrono::batch_render::PoseParams const&, unsigned long):
✗ Branch 0 not taken.
✓ Branch 1 taken 35233 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::StampParams>(char const*, chrono::batch_render::StampParams const&, unsigned long):
✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
37151 device::Queue& queue = m_device.GetQueue();
190
7/14
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::CellsParams>(char const*, chrono::batch_render::CellsParams const&, unsigned long):
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::CloneRowsParams>(char const*, chrono::batch_render::CloneRowsParams const&, unsigned long):
✗ Branch 0 not taken.
✓ Branch 1 taken 1205 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::CopyWordsParams>(char const*, chrono::batch_render::CopyWordsParams const&, unsigned long):
✗ Branch 0 not taken.
✓ Branch 1 taken 372 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::FillCellsParams>(char const*, chrono::batch_render::FillCellsParams const&, unsigned long):
✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::GatherRowsParams>(char const*, chrono::batch_render::GatherRowsParams const&, unsigned long):
✗ Branch 0 not taken.
✓ Branch 1 taken 273 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::PoseParams>(char const*, chrono::batch_render::PoseParams const&, unsigned long):
✗ Branch 0 not taken.
✓ Branch 1 taken 35233 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::StampParams>(char const*, chrono::batch_render::StampParams const&, unsigned long):
✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
37151 if (threads == 0) {
191 ✗ return queue.Mark();
192 }
193 37151 device::CommandEncoder encoder = queue.CreateEncoder();
194 {
195
7/7
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::CellsParams>(char const*, chrono::batch_render::CellsParams const&, unsigned long):
✓ Branch 1 taken 26 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::CloneRowsParams>(char const*, chrono::batch_render::CloneRowsParams const&, unsigned long):
✓ Branch 1 taken 1205 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::CopyWordsParams>(char const*, chrono::batch_render::CopyWordsParams const&, unsigned long):
✓ Branch 1 taken 372 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::FillCellsParams>(char const*, chrono::batch_render::FillCellsParams const&, unsigned long):
✓ Branch 1 taken 7 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::GatherRowsParams>(char const*, chrono::batch_render::GatherRowsParams const&, unsigned long):
✓ Branch 1 taken 273 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::PoseParams>(char const*, chrono::batch_render::PoseParams const&, unsigned long):
✓ Branch 1 taken 35233 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::StampParams>(char const*, chrono::batch_render::StampParams const&, unsigned long):
✓ Branch 1 taken 35 times.
74302 const device::ZoneScope zone(
196
14/14
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::CellsParams>(char const*, chrono::batch_render::CellsParams const&, unsigned long):
✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::CloneRowsParams>(char const*, chrono::batch_render::CloneRowsParams const&, unsigned long):
✓ Branch 1 taken 1205 times.
✓ Branch 4 taken 1205 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::CopyWordsParams>(char const*, chrono::batch_render::CopyWordsParams const&, unsigned long):
✓ Branch 1 taken 372 times.
✓ Branch 4 taken 372 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::FillCellsParams>(char const*, chrono::batch_render::FillCellsParams const&, unsigned long):
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::GatherRowsParams>(char const*, chrono::batch_render::GatherRowsParams const&, unsigned long):
✓ Branch 1 taken 273 times.
✓ Branch 4 taken 273 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::PoseParams>(char const*, chrono::batch_render::PoseParams const&, unsigned long):
✓ Branch 1 taken 35233 times.
✓ Branch 4 taken 35233 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::StampParams>(char const*, chrono::batch_render::StampParams const&, unsigned long):
✓ Branch 1 taken 35 times.
✓ Branch 4 taken 35 times.
74302 encoder, profiler::ZoneId::Named(std::string("ColumnStore/") + entry));
197
21/21
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::CellsParams>(char const*, chrono::batch_render::CellsParams const&, unsigned long):
✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::CloneRowsParams>(char const*, chrono::batch_render::CloneRowsParams const&, unsigned long):
✓ Branch 1 taken 1205 times.
✓ Branch 4 taken 1205 times.
✓ Branch 7 taken 1205 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::CopyWordsParams>(char const*, chrono::batch_render::CopyWordsParams const&, unsigned long):
✓ Branch 1 taken 372 times.
✓ Branch 4 taken 372 times.
✓ Branch 7 taken 372 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::FillCellsParams>(char const*, chrono::batch_render::FillCellsParams const&, unsigned long):
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::GatherRowsParams>(char const*, chrono::batch_render::GatherRowsParams const&, unsigned long):
✓ Branch 1 taken 273 times.
✓ Branch 4 taken 273 times.
✓ Branch 7 taken 273 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::PoseParams>(char const*, chrono::batch_render::PoseParams const&, unsigned long):
✓ Branch 1 taken 35233 times.
✓ Branch 4 taken 35233 times.
✓ Branch 7 taken 35233 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::StampParams>(char const*, chrono::batch_render::StampParams const&, unsigned long):
✓ Branch 1 taken 35 times.
✓ Branch 4 taken 35 times.
✓ Branch 7 taken 35 times.
37151 encoder.Dispatch(Kernels().Entry(entry), params,
198
7/7
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::CellsParams>(char const*, chrono::batch_render::CellsParams const&, unsigned long):
✓ Branch 1 taken 26 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::CloneRowsParams>(char const*, chrono::batch_render::CloneRowsParams const&, unsigned long):
✓ Branch 1 taken 1205 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::CopyWordsParams>(char const*, chrono::batch_render::CopyWordsParams const&, unsigned long):
✓ Branch 1 taken 372 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::FillCellsParams>(char const*, chrono::batch_render::FillCellsParams const&, unsigned long):
✓ Branch 1 taken 7 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::GatherRowsParams>(char const*, chrono::batch_render::GatherRowsParams const&, unsigned long):
✓ Branch 1 taken 273 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::PoseParams>(char const*, chrono::batch_render::PoseParams const&, unsigned long):
✓ Branch 1 taken 35233 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::StampParams>(char const*, chrono::batch_render::StampParams const&, unsigned long):
✓ Branch 1 taken 35 times.
37151 {.x = device::GroupCount(threads, kCellsGroup)});
199 37151 }
200
14/14
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::CellsParams>(char const*, chrono::batch_render::CellsParams const&, unsigned long):
✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::CloneRowsParams>(char const*, chrono::batch_render::CloneRowsParams const&, unsigned long):
✓ Branch 1 taken 1205 times.
✓ Branch 4 taken 1205 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::CopyWordsParams>(char const*, chrono::batch_render::CopyWordsParams const&, unsigned long):
✓ Branch 1 taken 372 times.
✓ Branch 4 taken 372 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::FillCellsParams>(char const*, chrono::batch_render::FillCellsParams const&, unsigned long):
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::GatherRowsParams>(char const*, chrono::batch_render::GatherRowsParams const&, unsigned long):
✓ Branch 1 taken 273 times.
✓ Branch 4 taken 273 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::PoseParams>(char const*, chrono::batch_render::PoseParams const&, unsigned long):
✓ Branch 1 taken 35233 times.
✓ Branch 4 taken 35233 times.
chrono::batch_render::device::Operation chrono::batch_render::ColumnStore::Dispatch<chrono::batch_render::StampParams>(char const*, chrono::batch_render::StampParams const&, unsigned long):
✓ Branch 1 taken 35 times.
✓ Branch 4 taken 35 times.
37151 return queue.Submit(encoder.Finish());
201 37151 }
202
203 private:
204 struct Entry {
205 std::unique_ptr<ColumnTable> table;
206 std::vector<uint32_t> stamps;
207 std::vector<uint64_t> writes;
208 uint32_t pins = 0;
209 };
210
211
0/2
✗ Branch 17 not taken.
✗ Branch 18 not taken.
12 struct OverrideLayer {
212 uint64_t owner = 0;
213 std::vector<std::byte> value;
214 };
215
216 2 struct OverrideCell {
217 std::vector<std::byte> authored;
218 std::vector<OverrideLayer> layers;
219 };
220
221 3 struct AuthoredRead {
222 uint64_t key = 0;
223 device::Download read;
224 };
225
226 struct ArrayWrite {
227 Ordinal stamp = 0;
228 uint32_t row = 0;
229 };
230
231 const Entry& Lookup(SchemaId schema) const;
232 void Place(std::byte* data, uint32_t offset, uint64_t address) const;
233 void FillWords(ColumnTable& table, uint32_t column, uint32_t first, uint32_t count,
234 std::span<const std::byte> cell);
235 void StampRows(ColumnRef column, uint32_t first, uint32_t count);
236 void StageLive(ColumnRef column, uint32_t first, std::span<const std::byte> cells);
237 bool OverridesBetween(ColumnRef column, uint32_t first, uint32_t count) const;
238 void LandAuthored(bool wait) const;
239 device::Program& Kernels();
240 static uint64_t ArrayKey(ColumnRef column, uint32_t row);
241
242 device::Device& m_device;
243 const StoreLock* m_lock = nullptr;
244 mutable DeviceHeap m_heap;
245 mutable std::vector<Entry> m_entries;
246 ColumnTable m_prims;
247 ColumnTable m_slots;
248 ColumnTable m_worlds;
249 std::map<uint32_t, std::unique_ptr<ArrayPool>> m_arrayHeaps;
250 std::vector<std::byte> m_payload;
251 std::unordered_map<uint64_t, ArrayRef> m_arrays;
252 std::map<uint64_t, std::vector<ArrayWrite>> m_arrayWrites;
253 mutable std::map<uint64_t, OverrideCell> m_overrides;
254 mutable std::vector<AuthoredRead> m_authoredReads;
255 std::vector<Ordinal> m_worldStamps = std::vector<Ordinal>(1, 0);
256 Ref<device::Program> m_program;
257 Ref<device::Buffer> m_deviceData;
258 std::vector<std::byte> m_uploaded;
259 std::vector<uint64_t> m_uploadedLayout;
260 uint64_t m_writes = 0;
261 Ordinal m_stamp = 1;
262 uint32_t m_primCount = 0;
263 uint32_t m_worldCount = 0;
264 std::vector<Attachment> m_attachments;
265 };
266
267 }
268