Align all arrays in mjData's buffer to 64 byte boundaries.

The introduction of additional mjData arrays for the implicit integrator caused in a shift in data alignment in memory. In certain combinations of machines and models, this change resulted in ~5% performance regression that appears to be attributable to L2 cache misses.

This change aligns all arrays in mjData to the boundary of a typical L2 cache line size. Benchmarking shows that this resolves the performance regression on a Broadwell machine.

PiperOrigin-RevId: 451652783
Change-Id: I4ed2c2d03453a83a0b4a9b8e224e2fd7c0dadea9
This commit is contained in:
Saran Tunyasuvunakool
2022-05-28 13:02:49 -07:00
committed by Copybara-Service
parent 981fa22302
commit 5cc73c30bf
6 changed files with 28 additions and 30 deletions
+1 -1
View File
@@ -732,7 +732,7 @@ MJAPI void mju_warning_s(const char* msg, const char* text);
// Clear user error and memory handlers.
MJAPI void mju_clearHandlers(void);
// Allocate memory; byte-align on 8; pad size to multiple of 8.
// Allocate memory; byte-align on 64; pad size to multiple of 64.
MJAPI void* mju_malloc(size_t size);
// Free memory, using free() by default.