feat: Improve GPU memory usage indication#158
Conversation
seankmartin
left a comment
There was a problem hiding this comment.
Note, these comments are from last week, seems I forgot to submit the review
| numChunkMemoryStatistics, | ||
| } from "#src/chunk_manager/base.js"; | ||
|
|
||
| export type GpuMemoryPressure = "normal" | "warning" | "critical"; |
There was a problem hiding this comment.
Would probably be better to use an enum
| export type GpuMemoryPressure = "normal" | "warning" | "critical"; | ||
|
|
||
| export const GPU_MEMORY_PRESSURE_WARNING_RATIO = 0.9; | ||
| export const GPU_MEMORY_PRESSURE_CRITICAL_RATIO = 0.98; |
There was a problem hiding this comment.
Due to the size of chunks, I think it's quite likely 0.98 won't be reached in many cases. Thinking on that
| export const GPU_MEMORY_PRESSURE_WARNING_RATIO = 0.9; | ||
| export const GPU_MEMORY_PRESSURE_CRITICAL_RATIO = 0.98; | ||
|
|
||
| export function computeGpuMemoryBytes( |
There was a problem hiding this comment.
I think overall this might be a bit too inclusive. While I like that it's a non-biased stance, I think we might need to be a bit more heuristic based.
I guess it doesn't matter much if a prefetch chunk is causing memory pressure. The problems with memory pressure will become tangible to the user when the visible chunk memory is hitting the limit.
Similarly we may want to only show memory pressure on visible chunks (the top bar in the layer indicator), and make the prefetch bar smaller or hidden by default and a UI config setting to turn on the prefetch bar.
I get the sense that at the moment as soon as you enter a situation of high memory pressure, then even if you leave that high memory pressure situation for visible chunks, you'll still see the warning and critical colors very often because the non-visible memory usage is still high
| if ( | ||
| !Number.isFinite(gpuMemoryBytes) || | ||
| !Number.isFinite(gpuMemoryLimitBytes) || | ||
| gpuMemoryBytes < 0 || | ||
| gpuMemoryLimitBytes <= 0 | ||
| ) { | ||
| return "normal"; | ||
| } |
There was a problem hiding this comment.
I'm not sure any of these can really happen, outside of the limit being 0, but then we'd just get infinity which is fine as a critical value
|
Moving to draft as we need to further discuss the expected behaviour. For now #170 should be enough |
Closes https://metacell.atlassian.net/browse/NA-758
Layer bar visual changes:
A layer only gets the orange (90%) /red (98%) colouring if global GPU memory pressure is high and that layer still has visible chunks missing. If all visible chunks for that layer are available, it stays normal gray even under pressure.