You are browsing as a guest. Sign up (or log in) to start making projects!

Smoke Sim Optimizations

  • 3 Devlogs
  • 8 Total hours

Optimizing everything there is to optimize in Smoke Sim

Open comments for this post

3h 49m 46s logged

So, the first idea was to implement shared memory into the smooth shader, and I did so. That brought down the average run time of the pressure solve shader from 15.4 ms to 13.87ms. Only 1.5 ms improvement.. why? Well, there was a halo of cells that had to be still fetched from global memory. So I thought to load those too to shared memory, but that introduced a ton of branching, which brought the average runtime to 29.7 ms… immediatelly reverted the change. At this point, unhappy with only 1.5 ms of change I didn’t stop here: fixing barrier bits brought down 13.87ms to 13.74ms, and changing the pressure and residual images from r32f to r16f (as that much precision is anyways not needed) brought it further down to 13.62ms. The biggest improvement was batching the gauss seidel calls: that allowed the GPU to better use the cached values and avoid CPU overhead. This brought the execution down to 8.93ms! This initial optimization sped up the pressure solve shader of a whooping 42%! And there is still the compute residual, prolong pressure, restrict residual and restrict solid shaders which too affect the pressure solve runtime!

TLDR:

  1. Initial runtime (avg) - 15.4ms
  2. Shared memory - 13.87ms (-1.53)
  3. Barrier bit fix - 13.742ms (-1.66)
  4. r32f to r16f - 13.62ms (-1.78)
  5. Batching smooth calls - 8.93ms (-6.47)
0
0
2
Open comments for this post

2h 13m 33s logged

took a long enough break from coding to forget a few things of my project, but that was helpful to rewrite the benchmarking logic: it was a complete mess. It now logs data correctly and makes a proper csv file! Now, I can cleanup the benchmark setup code and then I can finally start optimizing my shaders and seeing the effects of what I’m doing! (Gotta make benchmark enviroment end at a set amount of frames + skip first initial frames)

0
0
2
Open comments for this post

1h 31m 29s logged

Started making a benchmark enviroment that saves the GPU times on a .csv to allow me to calculate how changes on the shaders impact performance. It is pretty messy for now, and that will be improved next, but at least I have some code to work on now.

0
0
3

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…