stephen-hqxu / superterrainplus

SuperTerrain+: A real-time procedural 3D infinite terrain engine with geographical features and photorealistic rendering.
MIT License
12 stars 1 forks source link

Paged memory pool on CUDA #9

Closed stephen-hqxu closed 3 years ago

stephen-hqxu commented 3 years ago

Current

In STPHeightfieldGenerator, each time a new chunk needs to be computed, new device memory is allocated. However once the computation is done, memory is freed.

It may cause some memory allcation overhead if there are a lot of chunks being computed at the same time.

Suggestion

Approach

We need to have a function to measure how often and how much those allocated pages are used.

stephen-hqxu commented 3 years ago

Update

STPMemoryPool will be out in the next release, it supports customisable allocator and deallocator with user-defined passing arguments.

Heightfield generator has been implemented with the new memory pool, and I am pleased to say that even without legit benchmarking, the computational time has been cutdown by a lot, even noticeable by inspection.