unisim.backend.mjwarp.randomization¶
Per-world model-field expansion for the independent mjwarp backend.
MuJoCo Warp declares the leading dimension of randomizable Model fields as
"*": every kernel reads field[worldid % field.shape[0]], so tiling a
field from (1, ...) to (nworld, ...) yields per-world semantics without
kernel changes. Expansion replaces the array allocation, so it is a cold-path
operation: the backend expands the declared set once during construction,
before CUDA graph capture, and all later DR writes are in-place assign
uploads into the same fixed-address arrays (graph-safe).
The field list is ported from mjlab’s expand_model_fields usage and checked
against the pinned mujoco-warp 3.11 Model dataclass. Derived fields are
expanded alongside their inputs because the set_const* recompute kernels
size their launch grid from the output field’s leading dimension.
Functions
|
Tile the declared DR model fields from |
Classes
Cold-path geometry classification for batch-only bounds recomputation. |
- class unisim.backend.mjwarp.randomization.PrimitiveGeomBounds[source]¶
Bases:
objectCold-path geometry classification for batch-only bounds recomputation.
Uses official MuJoCo primitive geometry formulas. Meshes, planes, height fields and SDFs may appear in dense payloads unchanged, but resizing them is unsupported. No model/XML metadata is consulted during reset.
- unisim.backend.mjwarp.randomization.expand_model_fields(warp, model, nworld)[source]¶
Tile the declared DR model fields from
(1, ...)to(nworld, ...).Returns the names actually expanded. Fields already per-world (e.g. from a prior expansion) are skipped, mirroring mjlab’s guard. A single-world backend keeps the shared arrays untouched.