Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
7b7d80d
early sign of life. Cartpole and Ant are training.
AntoineRichard Jan 27, 2026
86169ed
removing sensors
AntoineRichard Jan 27, 2026
6050eef
removing old files.
AntoineRichard Jan 27, 2026
44160c8
added thin wrapper to allow usage of object_X mehtods on RigidObjectC…
AntoineRichard Jan 27, 2026
1e6f4f0
All tests for the assets are passing.
AntoineRichard Jan 28, 2026
39be136
Doc + test update
AntoineRichard Jan 28, 2026
6711a05
Now uses root_view instead of root_physx_view
AntoineRichard Jan 28, 2026
080c5b7
More doc
AntoineRichard Jan 28, 2026
24f5d87
pre-commits.
AntoineRichard Jan 28, 2026
23d2375
fixing failing doc
AntoineRichard Jan 28, 2026
4b981d2
Fixing doc build errors
AntoineRichard Jan 28, 2026
252633e
Fix multi-rotor + wrench composer tests.
AntoineRichard Jan 28, 2026
64c758e
Fixing issues here and here.
AntoineRichard Jan 28, 2026
e9ae031
Fixing more issues.
AntoineRichard Jan 28, 2026
03fd801
pre-commits
AntoineRichard Jan 28, 2026
2bc7c41
Fixing failing doc build.
AntoineRichard Jan 28, 2026
ac8c2e5
Addressing last doc bits
AntoineRichard Jan 28, 2026
da06657
should fix some of the failing mimic tests.
AntoineRichard Jan 29, 2026
32a6f41
Merge branch 'develop' into antoiner/multi-backend
AntoineRichard Jan 29, 2026
69be8a4
Initial commit
AntoineRichard Jan 29, 2026
28f62c9
Iterating.
AntoineRichard Jan 29, 2026
aa98401
Should be ready
AntoineRichard Jan 29, 2026
2b06fc4
pre-commits
AntoineRichard Jan 29, 2026
51f2d06
Initial push for mock interfaces to allow for benchmarking before mig…
AntoineRichard Jan 29, 2026
07708fb
cleaning up
AntoineRichard Jan 29, 2026
e7af2ce
pre-commits
AntoineRichard Jan 29, 2026
618af8a
Update tendon property references to fixed values
kellyguo11 Jan 29, 2026
730d513
Improvements around the mocking. Some QOL to make patching less tedio…
AntoineRichard Jan 30, 2026
041196d
pre-commits
AntoineRichard Jan 30, 2026
2d430dc
bumped version number
AntoineRichard Jan 30, 2026
db416d9
more precise warning.
AntoineRichard Jan 30, 2026
84513ff
Merge branch 'develop' into antoiner/multi-backend
AntoineRichard Jan 30, 2026
ca95f90
bumped the version in the extension.toml
AntoineRichard Jan 30, 2026
46324c3
made the warning much more explicit in term of deprecation date. This…
AntoineRichard Jan 30, 2026
52bd9ba
merge updated base
AntoineRichard Jan 30, 2026
c004441
Merge branch 'antoiner/multi-backend-sensor' into antoiner/mock_inter…
AntoineRichard Jan 30, 2026
a666933
Added changelogs
AntoineRichard Jan 30, 2026
82e1fb6
should work now.
AntoineRichard Jan 30, 2026
9bf5859
tentative merge...
AntoineRichard Feb 3, 2026
f75b5cb
Missed a quaternion convertion...
AntoineRichard Feb 3, 2026
48d6eea
pre-commits
AntoineRichard Feb 3, 2026
8cf1809
Addressing the lizard's comments.
AntoineRichard Feb 3, 2026
927bed0
Merge branch 'develop' into antoiner/mock_interfaces
AntoineRichard Feb 3, 2026
fa6fbb4
initial commit
AntoineRichard Jan 30, 2026
01c3c2c
changelogs
AntoineRichard Jan 30, 2026
2d1796a
pre-commits
AntoineRichard Jan 30, 2026
f7e9fc4
Merge branch 'develop' into antoiner/physx-assets-micro-benchmarks
kellyguo11 Feb 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/source/testing/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ This section covers testing utilities and patterns for Isaac Lab development.
:maxdepth: 2

mock_interfaces
micro_benchmarks
348 changes: 348 additions & 0 deletions docs/source/testing/micro_benchmarks.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,348 @@
.. _testing_micro_benchmarks:

Micro-Benchmarks for Performance Testing
========================================

Isaac Lab provides micro-benchmarking tools to measure the performance of asset
setter/writer methods and data property accessors without requiring Isaac Sim.

Overview
--------

The benchmarks use **mock interfaces** to simulate PhysX views, allowing performance
measurement of Python-level overhead in isolation. This is useful for:

- Comparing list vs tensor index performance
- Identifying bottlenecks in hot code paths
- Tracking performance regressions
- Optimizing custom methods

Quick Start
-----------

Run benchmarks using the Isaac Lab launcher:

.. code-block:: bash

# Run Articulation method benchmarks
./isaaclab.sh -p source/isaaclab_physx/benchmark/assets/benchmark_articulation.py

# With custom parameters
./isaaclab.sh -p source/isaaclab_physx/benchmark/assets/benchmark_articulation.py \
--num_iterations 1000 \
--num_instances 64 \
--num_bodies 5 \
--num_joints 4

Available Benchmarks
--------------------

Asset Method Benchmarks
~~~~~~~~~~~~~~~~~~~~~~~

These benchmark setter and writer methods on asset classes:

.. list-table::
:header-rows: 1
:widths: 35 25 40

* - Benchmark File
- Asset Class
- Methods Covered
* - ``benchmark_articulation.py``
- ``Articulation``
- 24 methods (root/joint state, mass props, forces)
* - ``benchmark_rigid_object.py``
- ``RigidObject``
- 13 methods (root state, mass props, forces)
* - ``benchmark_rigid_object_collection.py``
- ``RigidObjectCollection``
- 13 methods (body state, mass props, forces)

Data Property Benchmarks
~~~~~~~~~~~~~~~~~~~~~~~~

These benchmark property accessors on data classes:

.. list-table::
:header-rows: 1
:widths: 40 30 30

* - Benchmark File
- Data Class
- Properties
* - ``benchmark_articulation_data.py``
- ``ArticulationData``
- 59 properties
* - ``benchmark_rigid_object_data.py``
- ``RigidObjectData``
- 40 properties
* - ``benchmark_rigid_object_collection_data.py``
- ``RigidObjectCollectionData``
- 40 properties

All benchmarks are located in ``source/isaaclab_physx/benchmark/assets/``.

Command Line Arguments
----------------------

Common Arguments
~~~~~~~~~~~~~~~~

.. list-table::
:header-rows: 1
:widths: 20 15 65

* - Argument
- Default
- Description
* - ``--num_iterations``
- 1000
- Number of timed iterations
* - ``--warmup_steps``
- 10
- Warmup iterations (not timed)
* - ``--num_instances``
- 4096
- Number of asset instances
* - ``--device``
- ``cuda:0``
- Device for tensors
* - ``--mode``
- ``all``
- ``all``, ``torch_list``, or ``torch_tensor``
* - ``--output``
- auto
- Output JSON filename
* - ``--no_csv``
- false
- Disable CSV output

Asset-Specific Arguments
~~~~~~~~~~~~~~~~~~~~~~~~

**Articulation benchmarks:**

- ``--num_bodies``: Number of links (default: 13)
- ``--num_joints``: Number of DOFs (default: 12)

**RigidObjectCollection benchmarks:**

- ``--num_bodies``: Number of bodies in collection (default: 5)

Benchmark Modes
---------------

Each method is benchmarked under two input scenarios:

**torch_list**
Environment/body IDs passed as Python lists. Measures the overhead of
list-to-tensor conversion, which is common in user code.

**torch_tensor**
Environment/body IDs passed as pre-allocated tensors. Represents the
optimal baseline with minimal overhead.

Example output:

.. code-block:: text

[1/24] [TORCH_LIST] write_root_state_to_sim... 132.02 ± 6.79 µs
[1/24] [TORCH_TENSOR] write_root_state_to_sim... 65.44 ± 3.06 µs

The comparison shows tensor indices are ~2x faster than list indices.

Output Format
-------------

Console Output
~~~~~~~~~~~~~~

.. code-block:: text

Benchmarking Articulation (PhysX) with 64 instances, 5 bodies, 4 joints...
Device: cuda:0
Iterations: 100, Warmup: 10

Benchmarking 24 methods...
[1/24] [TORCH_LIST] write_root_state_to_sim... 132.02 ± 6.79 µs
[1/24] [TORCH_TENSOR] write_root_state_to_sim... 65.44 ± 3.06 µs
...

================================================================================
COMPARISON: Torch_list vs Torch_tensor
================================================================================
Method Name Torch_list Torch_tensor Speedup
------------------------------------------------------------------------
write_root_state_to_sim 132.02 65.44 2.02x

Export Files
~~~~~~~~~~~~

Results are automatically exported to:

- ``{benchmark_name}_{timestamp}.json`` - Full results with hardware info
- ``{benchmark_name}_{timestamp}.csv`` - Tabular results for analysis

JSON Structure
~~~~~~~~~~~~~~

.. code-block:: json

{
"config": {
"num_iterations": 100,
"num_instances": 64,
"device": "cuda:0"
},
"hardware": {
"cpu": "Intel Core i9-13950HX",
"gpu": "NVIDIA RTX 5000",
"pytorch": "2.7.0",
"cuda": "12.8"
},
"results": [
{
"name": "write_root_state_to_sim",
"mode": "torch_list",
"mean_us": 132.02,
"std_us": 6.79,
"iterations": 100
}
]
}

Architecture
------------

The benchmarks use mock interfaces to simulate PhysX views without Isaac Sim:

.. code-block:: text

┌─────────────────────┐ ┌──────────────────────┐
│ Asset Class │────>│ MockArticulationView│
│ (Articulation) │ │ (mock_interfaces) │
└─────────────────────┘ └──────────────────────┘
v
┌─────────────────────┐
│ Benchmark │
│ Framework │
└─────────────────────┘

Key Components
~~~~~~~~~~~~~~

1. **Mock Views** (``isaaclab_physx/test/mock_interfaces/``)

- ``MockArticulationView`` - Mimics PhysX ArticulationView
- ``MockRigidBodyView`` - Mimics PhysX RigidBodyView

2. **Benchmark Utilities** (``isaaclab/test/benchmark/``)

- ``BenchmarkConfig`` - Configuration dataclass
- ``MethodBenchmark`` - Benchmark definition
- ``benchmark_method()`` - Core timing function
- Export utilities for JSON/CSV

3. **Module Mocking**

Each benchmark file mocks Isaac Sim dependencies (``isaacsim``, ``omni``, ``pxr``)
to allow the asset classes to be instantiated without simulation.

Adding New Benchmarks
---------------------

Adding a Method Benchmark
~~~~~~~~~~~~~~~~~~~~~~~~~

1. Create input generator functions:

.. code-block:: python

def gen_my_method_torch_list(config: BenchmarkConfig) -> dict:
return {
"param1": torch.rand(config.num_instances, 3, device=config.device),
"env_ids": list(range(config.num_instances)),
}

def gen_my_method_torch_tensor(config: BenchmarkConfig) -> dict:
return {
"param1": torch.rand(config.num_instances, 3, device=config.device),
"env_ids": make_tensor_env_ids(config.num_instances, config.device),
}

2. Add to the ``BENCHMARKS`` list:

.. code-block:: python

MethodBenchmark(
name="my_method",
method_name="my_method",
input_generators={
"torch_list": gen_my_method_torch_list,
"torch_tensor": gen_my_method_torch_tensor,
},
category="my_category",
),

Adding a Property Benchmark
~~~~~~~~~~~~~~~~~~~~~~~~~~~

For data class properties, add to the ``PROPERTIES`` list:

.. code-block:: python

("my_property", {"derived_from": ["dependency1", "dependency2"]}),

The ``derived_from`` key indicates dependencies that should be pre-computed
before timing the property access.

Performance Tips
----------------

Based on benchmark results:

1. **Use tensor indices** instead of lists for 30-50% speedup
2. **Pre-allocate index tensors** and reuse them across calls
3. **Batch operations** where possible (e.g., set all joint positions at once)
4. **Mass properties are CPU-bound** - PhysX requires CPU tensors for these

Example optimization:

.. code-block:: python

# Slow: Create new list each call
for _ in range(1000):
robot.write_joint_state_to_sim(state, env_ids=list(range(64)))

# Fast: Pre-allocate tensor and reuse
env_ids = torch.arange(64, device="cuda:0")
for _ in range(1000):
robot.write_joint_state_to_sim(state, env_ids=env_ids)

Troubleshooting
---------------

Import Errors
~~~~~~~~~~~~~

Ensure you're running through ``isaaclab.sh``:

.. code-block:: bash

./isaaclab.sh -p source/isaaclab_physx/benchmark/assets/benchmark_articulation.py

CUDA Out of Memory
~~~~~~~~~~~~~~~~~~

Reduce ``--num_instances``:

.. code-block:: bash

./isaaclab.sh -p ... --num_instances 1024

Slow First Run
~~~~~~~~~~~~~~

The first run compiles Warp kernels. Subsequent runs will be faster.
2 changes: 1 addition & 1 deletion source/isaaclab/config/extension.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

# Note: Semantic Versioning is used: https://semver.org/
version = "2.1.1"
version = "2.1.2"

# Description
title = "Isaac Lab framework for Robot Learning"
Expand Down
24 changes: 24 additions & 0 deletions source/isaaclab/docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
Changelog
---------

2.1.2 (2026-01-30)
~~~~~~~~~~~~~~~~~~~

Added
^^^^^

* Added :mod:`isaaclab.test.benchmark` module providing a comprehensive benchmarking framework
for measuring performance of Isaac Lab components. Includes:

* :class:`BenchmarkConfig`: Configuration dataclass for benchmark execution parameters
(iterations, warmup steps, instances, device).
* :class:`BenchmarkResult`: Dataclass capturing timing statistics (mean, std in microseconds),
skip status, and dependency information.
* :class:`MethodBenchmark`: Definition class for methods to benchmark with multi-mode
input generators.
* Input generator helpers for creating standardized tensors and Warp masks:
``make_tensor_env_ids``, ``make_tensor_joint_ids``, ``make_tensor_body_ids``,
``make_warp_env_mask``, ``make_warp_joint_mask``, ``make_warp_body_mask``.
* :func:`benchmark_method`: Core function for benchmarking with warmup phases,
GPU synchronization, and graceful error handling.
* I/O utilities: :func:`get_hardware_info`, :func:`get_git_info`, :func:`print_hardware_info`,
:func:`print_results`, :func:`export_results_json`, :func:`export_results_csv`.


2.1.1 (2026-02-03)
~~~~~~~~~~~~~~~~~~~

Expand Down
Loading