Skip to content

Commit

Permalink
Align MemoryArenas to cache lines.
Browse files Browse the repository at this point in the history
The SPPMIntegrator and the MLTIntegrator both have per-thread MemoryArenas; they allocate them in contiguous memory, which is a slight problem, since MemoryArenas are 80 bytes big; this leads to false sharing, which hurts performance.

Taking best of 3 runs on a 32 CPU system with the "breakfast" scene, this fix speeds up the camera and photon pass by just ~1%, but speeds up SPPM grid construction by 36% (from 1.859s to 1.367s).
  • Loading branch information
mmp committed Dec 8, 2015
1 parent f66f558 commit 74cab9e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ T *AllocAligned(int count) {
}

void FreeAligned(void *);
class MemoryArena {
class alignas(128) MemoryArena {
public:
// MemoryArena Public Methods
MemoryArena(size_t blockSize = 262144) : blockSize(blockSize) {}
Expand Down

0 comments on commit 74cab9e

Please sign in to comment.