-
Notifications
You must be signed in to change notification settings - Fork 1
/
SpringLab TODO.txt
434 lines (402 loc) · 11.9 KB
/
SpringLab TODO.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
Classic:
- 80x5_bending_test
- Bending: ...
- CPU: 11us
- 544x68_bending_test
- Bending: ...
- CPU: 980us
FS 0 - Base:
- 80x5_bending_test
- Bending: 20
- CPU: 220us
- 544x68_bending_test
- Bending: 186-189 (187.5)
- w/80 iterations: 28.9
- CPU: 24,300us
FS 10 - By Springs, With Intrinsics:
- 80x5_bending_test
- Bending: 20
- CPU: 180us
- 544x68_bending_test
- Bending:
- CPU: 20,200us
FS 11 - By Springs, With Intrinsics, Layout Optimized:
- 80x5_bending_test
- Bending: 20
- Optimize 1:
- CPU: 180us
- Optimize 2:
- CPU: ?
- 544x68_bending_test
- Bending:
- Optimize 1:
- CPU: ?
FS 12 - By Springs, Structural Intrinsics
- 80x5_bending_test
- Bending: 20
- CPU: 114us
- 544x68_bending_test
- Bending: 188.3
- CPU: 11,300us
FS 13 - By Springs, Structural Intrinsics, MT
- 80x5_bending_test
- Bending: 20
- 1 thread:
- CPU: 122us
- 2 threads:
- CPU: 148us
- 4 threads:
- CPU: 202us
- 8 threads:
- CPU: 440us
- 544x68_bending_test
- Bending: 186-189
- 1 thread:
- CPU: 11,500us
- 2 threads:
- CPU: 8,600us
- 3 threads:
- CPU: 7,500us
- 4 threads:
- CPU: 7,300us
- 8 threads:
- CPU: 8,200us
FS 14 - By Spring - Structural Instrinsics - MT - (Integration) Vectorized
- 80x5_bending_test
- Bending: 20
- 1 thread:
- CPU: 117us
- 2 threads:
- CPU: 135us
- 3 threads:
- CPU: 160us
- 4 threads:
- CPU: 205us
- 8 threads:
- CPU: 490us
- 544x68_bending_test
- 1 thread:
- CPU: 11,500us
- 2 threads:
- CPU: 8,100us
- 3 threads:
- CPU: 7,700us
- 4 threads:
- CPU: 6,800us
- 8 threads:
- CPU: 9,800us
FS 15 - By Spring - Structural PseudoInstrinsics - MT - Vectorized
- 544x68_bending_test
- 1 thread:
- CPU: 21,000us
- 2 threads:
- CPU: 14,900us
- 4 threads:
- CPU: 12,900us
FS 20 - By Point:
- 80x5_bending_test
- Bending: 20
- CPU: 396us | 352us |
- 544x68_bending_test
- Bending:
- CPU: 37,100us
FS 21 - By Point, Compact:
- 80x5_bending_test
- Bending: 20
- CPU: 375us | 332
- 544x68_bending_test
- Bending:
- CPU: 36,700us
FS 22 - By Point, Compact, Integrating:
- 80x5_bending_test
- Bending: 20
- CPU: 380us | 342
- 544x68_bending_test
- Bending:
- CPU: 37,300us
Gauss-Seidel - By Point:
- 80x5_bending_test
- Bending: 12
- CPU: 430us
- 544x68_bending_test (spring reduction fraction: 0.468750)
- Bending: 108.00 - 108.80
- CPU: 43,400us
##########################################################
= Five-pronged plan:
+ 0. FS Base (by spring)
+ 0b. Fixes:
+ Fix move
+ Bending measurement
+ New object (very long), with fixed and probe
+ 10. By Spring, With Intrinsics
+ 11. By Spring, With Intrinsics, Layout Optimized
+ SCoreLib::CacheModel class
+ Reorderings done by ObjectBuilder, with new ILayoutOptimizer framework
+ initial ACMR = 0.515219 (CacheModel<1, 64, vec2f>)
+ Optimize
+ Lookahead=0 CacheModel<1, 64, vec2f> : final ACMR = 0.385301
+ New algo: final ACMR = 0.58686
+ 12. By Spring, With Structural Intrinsics
+ Layout
+ Intrinsics structure
+ Result: 184
+ Redo with another strategy
+ Result: 176/185
+ Redo with reciprocals
! sqrt 12, (div 11, and 1), (div 11, and 1), sub 4 = 6/40
! rsqrt 4, and 1, (mul 4), (mul 4), rec 4, and 1, sub 4 = 7/22
+ 13. By Spring, With Structural Intrinsics, Multi-threaded
+ Add large ship
+ Add fixed and bending
+ Make bar of similar # of springs as Hesleden (38229 points, 150019 springs), with fixed and bending
+ 544x68(8)
+ TaskThreadPool:
+ Pass *pointers* to tasks
+ Different locking: threads access own task without locking?
+ Test with original, small bar
+ Start:
- 1t: 160-170
- 2t: 210-220
- 4t: 280-290
X Then:
- 1t: 160-170
- 2t: 930-980
- 4t: 1380-1420
+ Re-test with older pool, and decide whether it really pays off to use new one
+ Check assembly of adding back spring forces - try to make it 4 at a time
! Buffer::Fill is 3%
! Add is 2%
+ Nuke Simulator specialization for two pools - keep TaskThreadPool only
= Further ideas for optimizations:
+ Spin off "...vectorized" out of MT
+ Redo integration factor buffer in whole hierarchy, as vec2f of two copies
+ Verify assembly is now vectorized along whole hierarchy
+ Base
+ Intrinsics
+ IntrinsicsStructural
+ IntrinsicsStructuralMTVect_<1>
+ IntrinsicsStructuralMTVect_<N> TODOHERE: NOT!
+ Re-take measurements above
+ Code profiling of Vectorized, 1 thread:
+ ApplySpringForces: 52.85%
+ IntegrateAndResetSpringForces: 3.56%
+ Integration does both force add & force reset
+ Replace 1+N-1 buffers with N buffers
+ Add new measurements to above
X Pointer increment instead of indexing
+ No alloc/delete for that local force vector
+ Redo all measurements (above) with large bar
+ Bending improvements:
+ Vectorized, 1 thread:
+ 40 iterations:
+ Bending = 111.6 (FSBase: 187.5)
+ CPU = 20,000us (FSBase: 24,300us)
+ Then, 0.60x K:
+ Bending = 92.0
+ 20. By Point
+ 21. By Point, Compact metadata
+ 22. By Point, Compact metadata, With integration
+ a. PositionBased
+ b. With integration (requires new buffer & swap)
= Position-Based, Basic (Muller)
+ Fix frozen
+ See infinite oscillations
+ Nail down params for better rigidity
+ See if correctly re-using output of earlier iteration
- Add bending constraints
- Or not: after all they seems to only be useful in 3D when there are no springs constraining the bend...
- But could still try and come up with constraints on the angles between each pair of springs incident to the same vertex
= Gauss-Seidel, By Point
- See why not stable
= Fast MSS Simulation (with Eigen)
+ External forces
+ Inertial term: subst a (cur-prev) with (vel * dt)
+ Fixed points
+ Force their positions back to original
+ SettingsDialog tab
- Optimize
- Those vectors that we keep creating, save an allocation
- Fixed points
! Notes:
! When integration is...integrated, it might fare worse because we do double the number of fp operations
####################################################################################################
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
####################################################################################################
= Initial conditions:
+ Gravity:
+ Goes to SimulationParameters, as vec2f AssignedGravity,
via SimulationController::EnableGravity(bool)
+ Comment on convenience
+ Move:
+ As now
+ Pin:
+ Tool
+ Sets via Points::SetFrozenCoefficient(...)
+ Render: also uploaded as part of Points, always
+ Shader: black
- Particle Force:
- UI:
- When Particle Force engaged: at click/particle selection, open window for {direction & magnitude}, {remove}
- Sets via Points::SetAssignedForce(...)
- Render: uploaded as vectors by SimulationController at Render()
- Enabled/Disabled by menu item => SimulationController::mDoRenderAssignedParticleForces
####################################################################################################
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
####################################################################################################
DONE:
+ Get started with V 1.0:
+ Containers, buffers, special vectors
+ ResourceLocator
+ StructuralMaterial
+ StructuralMaterialDatabase
+ Points
+ Phys: position, velocity
+ Network: springs
+ Render: render radius, render color (vec4f), factory render color
+ Springs
+ Physics:
+ Stiffness
+ RestLength
+ Network
+ Render: render thickness, render color (vec4f), factory render color
+ Object: purely data
+ Points
+ Springs
+ ObjectDefinition/File
+ ObjectBuilder
+ ViewModel
+ RenderContext skeleton
+ SimulationController
+ MainFrame
+ MainApp
+ Add to GitHub
+ Make json
+ Rendering:
+ MainFrame:
+ Always render with timer loop
+ mMainGLCanvas.Refresh()
+ Change OnPaint to be on canvas
+ OnPaint: SimulationController.Render()
+ RenderContext:
! RenderContext does not take point count, does everything at upload
+ API:
+ cctor
+ Load shaders
+ Setup VBOs
+ Set params
+ RenderStart()
+ Upload(...all...)
+ Points
+ Shader
+ Springs
- Shader
+ RenderEnd()
+ Run all shaders
+ Complete:
+ OnViewModelUpdated()
+ Interactions:
+ Tools
+ ToolController
+ Mouse-taking @ MainFrame (see 'TODO')
+ Do shift @ MouseDown & MouseMove, passing as boolean to ToolController::OnMouseXYZ(.)
+ See move
+ Put timer back
+ Rename "RenderTimer" as "SimulationTimer"
+ On timer:
+ Detect shift and send to ToolController
+ Like before
+ Remove extra shift boolean at others
+ Invoke ToolController::Update
+ Remove other invocations
+ Reset menu
+ Point highlight when picked
+ Tool: Controller->HighlightPoint(elementIndex, true/false)
+ new Points buffer: float highlight
+ Uploaded to RenderContext
+ ...which populates float in struct
+ BGColor
+ ViewModel: recalc zoom at resize
+ See if exists API to get max size
+ Communicate size @ controller creation
+ See if available by then
+ Also do camera calculation
+ MoveTool:
+ Consider offset, not absolute position
+ Controller::GetPointPosition(), store in engagement state, and use it for offset
+ OpenGL on separate thread
================================================================
+ UI Toolbars:
+ Simulation control:
+ Play: 1 simulation step per-second
+ Fast-Forward: 1 simulation step as fast as possible
+ Pause: step on-demand
+ UI:
+ All sticky buttons, mutex
+ Pause: space
+ Step on-demand: via Enter
+ Only do if currently selected
- Initial conditions:
+ Gravity (boolean)
+ Move
+ Pin
+ Particle Force
+ UI:
+ Gravity: sticky button, independent
+ Move, Pin, Particle Forces: sticky buttons, mutex
+ Remove Tools menu
+ Simulator type change:
+ SimulationController::SetSimulator(enum from SLabTypes)
+ Changes simulator and resets
+ SimulationController holds only one simulator, the current one
+ ISimulator architecture:
+ Files:
+ Simulator/Common
+ ISimulator
+ SimulatorCommonParameters.h
+ SimulatorRegistry (static)
+ Simulator/Classic
+ SimulatorClassic
+ SimulatorClassicParameters.h
+ SimulationParameters:
+ SimulatorCommonParameters member
+ In SimulatorCommonParameters.h
+ SimulatorClassicParameters member
+ From own include
+ <SimulatorXXX: ISimulator>
+ cctor(Object, SimulationParameters)
+ OnSimulationParametersChanged(SimulationParameters)
+ Setting paramers:
+ Controller::Set(common parameter @ SimulationParameters)
+ Controller::Set(specific parameter @ SimulationParameters::SimulatorXParameters)
+ Both: cause invocation - later - of ISimulator->OnSimulationParametersChanged(SimulationParameters)
+ Controlled via controller's mAreParametersDirty, @ beginning of simulation step
+ Reset after use
+ Do "ClassicSimulator"
+ Do
+ Decide whether to change spring reduction fraction into spring stiffness, and also damping
+ If so, recalc defaults to match FS
+ If so, nuke dt's
+ & rename both, & Tooltips
+ MT RenderContext: exceptions
+ The thing that's ahred_ptr is the TaskCompletion
+ TaskCompletion stores exc message
+ Wait throws
+ Test w/shader error
+ Test w/OpenGL version
+ Nuke BufferAllocator & AllocWorkBuffer/Copy methods
+ SettingsDialog
+ Settings
+ SettingsManager
+ Create @ MainFrame
+ Takes SimulationController directly
+ CommonParams, SimulationController and SettingsManager:
+ Gravity
+ dt
+ MassAdjustment
+ GlobalDamping
+ Dialog
+ One static box per common + each simulator
+ Use params @ Simulator
+ Open via toolbar, together with Reset and Open
+ "Actions"
+ Leave in menu, and add "Settings..."