Commit Graph

13 Commits

Author SHA1 Message Date
Saran Tunyasuvunakool b849023069 Miscellaneous linting in src/engine.
PiperOrigin-RevId: 462415459
Change-Id: I6c79c592613c6b0a665af06faf945586bb6ba32d
2022-07-21 10:16:49 -07:00
Nimrod Gileadi 1392843aed Fix the use of __has_builtin for GCC < 10.
The breakage was introduced in af12322e9d.

__has_builtin was introduced to GCC in version 10, and the arithmetic overflow builtins were available since version 5.

Fixes deepmind/mujoco#386.

Tested with GCC 9.

PiperOrigin-RevId: 461463027
Change-Id: I76627539a5c0e7f5617b56a2c9ada9251bceb0f6
2022-07-17 07:51:40 -07:00
Nimrod Gileadi af12322e9d Avoid integer overflows when computing buffer sizes.
If any field size would cause an overflow, fail to create the model.

PiperOrigin-RevId: 460466485
Change-Id: Ic8b84f3b56f2617c04ba04604729f0f76c6d62ee
2022-07-12 08:20:40 -07:00
Yuval Tassa c14a7ef4a7 Add clock sensor type.
PiperOrigin-RevId: 459720950
Change-Id: Ibda48ae7dc4aa7be451a947a1c53d10a7eaf176b
2022-07-08 03:50:08 -07:00
Yuval Tassa 09a5efc09e Add control values to keyframes.
- Add basic test for keyframes.
- Add missing documentation for keyframe mocap positions and quaternions.

PiperOrigin-RevId: 459021649
Change-Id: I91cf7ecbddc6262e8c72a868eeb82d627f389fb3
2022-07-05 01:07:37 -07:00
Nimrod Gileadi dbef8e6c2b Fix memory leaks when loading an invalid model from MJB.
PiperOrigin-RevId: 458445745
Change-Id: I99229a66fc86f7763cfe2b5382229b0304bdfa9c
2022-07-01 05:21:55 -07:00
Nimrod Gileadi d567263959 Fix null pointer dereference in mj_loadModel.
mj_makeModel returns NULL if any of the array sizes are negative. Callers of the function need to handle that case.

PiperOrigin-RevId: 457948558
Change-Id: I9a5c8c0d3293ed0a92c5791f00d3ed34c848e024
2022-06-29 05:09:54 -07:00
Saran Tunyasuvunakool 5cc73c30bf 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
2022-05-28 13:03:38 -07:00
Yuval Tassa e94a46c20f Indent #ifdef blocks, improve comment for MSVC pragma.
PiperOrigin-RevId: 451614625
Change-Id: I5b46572521955b51da48f183d2195817df6ea28d
2022-05-28 04:49:58 -07:00
Saran Tunyasuvunakool 1da4e1c784 Fix ASAN_(UN)POISON_MEMORY_REGION macros for MSVC.
Closes #306.

PiperOrigin-RevId: 451609183
Change-Id: Iadc2db7c5550261050340e38b7f7eb8a806013a1
2022-05-28 03:56:32 -07:00
Saran Tunyasuvunakool b5a6a725e5 Asan-poison padding regions in mjModel and mjData buffers.
This allows us to detect reads and writes that are logically out of bounds.

PiperOrigin-RevId: 451520772
Change-Id: I614a8062c404d97148166bcd37db399420956d8b
2022-05-27 17:34:29 -07:00
Saran Tunyasuvunakool 185b79f664 Make msan treat mjData buffer as uninitialized in mj_resetData.
Indiscriminate memset into d->buffer and m->buffer previously caused msan to not detect uninitialized reads.

Also fix tests with uninitialized read bugs that are detected by msan after this change.

PiperOrigin-RevId: 451508224
Change-Id: I1f4b080a8ef765c34ba7a0adc2c686419f6e5516
2022-05-27 16:34:33 -07:00
Saran Tunyasuvunakool 1913a02b40 Initial open sourcing of MuJoCo.
PiperOrigin-RevId: 450374687
Change-Id: Ie3225a46ce095fc28ae8e63c326a640261f562bb
2022-05-23 01:08:49 -07:00