Skip to content

Commit 9f1a98a

Browse files
authored
[MISC] Enable back GsTaichi dynamic array mode by default except for MacOS. (#1977)
* Get around GsTaichi bug causing dof frictionloss to break on Apple Metal. * Enable back GsTaichi dynamic array mode by default except for MacOS.
1 parent 7900d51 commit 9f1a98a

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

genesis/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ def init(
118118

119119
# Configure GsTaichi fast cache and array type
120120
global use_ndarray, use_fastcache
121-
# is_ndarray_disabled = (os.environ.get("GS_ENABLE_NDARRAY") or ("0" if sys.platform == "darwin" else "1")) == "0"
122-
is_ndarray_disabled = os.environ.get("GS_ENABLE_NDARRAY", "0") == "0"
121+
is_ndarray_disabled = (os.environ.get("GS_ENABLE_NDARRAY") or ("0" if sys.platform == "darwin" else "1")) == "0"
123122
if use_ndarray is None:
124123
_use_ndarray = not (is_ndarray_disabled or performance_mode)
125124
else:

genesis/engine/solvers/rigid/constraint_solver_decomp.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,11 @@ def add_frictionloss_constraints(
10671067
n_dofs = dofs_state.ctrl_mode.shape[0]
10681068

10691069
# TODO: sparse mode
1070-
ti.loop_config(serialize=ti.static(static_rigid_sim_config.para_level < gs.PARA_LEVEL.ALL))
1070+
# FIXME: The condition `if dofs_info.frictionloss[I_d] > EPS:` is not correctly evaluated on Apple Metal
1071+
# if `serialize=True`...
1072+
ti.loop_config(
1073+
serialize=ti.static(static_rigid_sim_config.para_level < gs.PARA_LEVEL.ALL and gs.backend != gs.metal)
1074+
)
10711075
for i_b in range(_B):
10721076
constraint_state.n_constraints_frictionloss[i_b] = 0
10731077

tests/test_rigid_physics.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,6 +1754,10 @@ def test_set_dofs_frictionloss_physics(gs_sim, tol):
17541754
@pytest.mark.required
17551755
def test_frictionloss_advanced(show_viewer, tol):
17561756
scene = gs.Scene(
1757+
viewer_options=gs.options.ViewerOptions(
1758+
camera_pos=(1.0, 0.25, 0.75),
1759+
camera_lookat=(0.0, 0.0, 0.0),
1760+
),
17571761
show_viewer=show_viewer,
17581762
show_FPS=False,
17591763
)

0 commit comments

Comments
 (0)