warp-lang 1.5.0__py3-none-win_amd64.whl → 1.6.0__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of warp-lang might be problematic. Click here for more details.
- warp/__init__.py +5 -0
- warp/autograd.py +414 -191
- warp/bin/warp-clang.dll +0 -0
- warp/bin/warp.dll +0 -0
- warp/build.py +40 -12
- warp/build_dll.py +13 -6
- warp/builtins.py +1124 -497
- warp/codegen.py +261 -136
- warp/config.py +1 -1
- warp/context.py +357 -119
- warp/examples/assets/square_cloth.usd +0 -0
- warp/examples/benchmarks/benchmark_gemm.py +27 -18
- warp/examples/benchmarks/benchmark_interop_paddle.py +3 -3
- warp/examples/benchmarks/benchmark_interop_torch.py +3 -3
- warp/examples/core/example_torch.py +18 -34
- warp/examples/fem/example_apic_fluid.py +1 -0
- warp/examples/fem/example_mixed_elasticity.py +1 -1
- warp/examples/optim/example_bounce.py +1 -1
- warp/examples/optim/example_cloth_throw.py +1 -1
- warp/examples/optim/example_diffray.py +4 -15
- warp/examples/optim/example_drone.py +1 -1
- warp/examples/optim/example_softbody_properties.py +392 -0
- warp/examples/optim/example_trajectory.py +1 -3
- warp/examples/optim/example_walker.py +5 -0
- warp/examples/sim/example_cartpole.py +0 -2
- warp/examples/sim/example_cloth.py +3 -1
- warp/examples/sim/example_cloth_self_contact.py +260 -0
- warp/examples/sim/example_granular_collision_sdf.py +4 -5
- warp/examples/sim/example_jacobian_ik.py +0 -2
- warp/examples/sim/example_quadruped.py +5 -2
- warp/examples/tile/example_tile_cholesky.py +79 -0
- warp/examples/tile/example_tile_convolution.py +2 -2
- warp/examples/tile/example_tile_fft.py +2 -2
- warp/examples/tile/example_tile_filtering.py +3 -3
- warp/examples/tile/example_tile_matmul.py +4 -4
- warp/examples/tile/example_tile_mlp.py +12 -12
- warp/examples/tile/example_tile_nbody.py +180 -0
- warp/examples/tile/example_tile_walker.py +319 -0
- warp/fem/geometry/geometry.py +0 -2
- warp/math.py +147 -0
- warp/native/array.h +12 -0
- warp/native/builtin.h +0 -1
- warp/native/bvh.cpp +149 -70
- warp/native/bvh.cu +287 -68
- warp/native/bvh.h +195 -85
- warp/native/clang/clang.cpp +5 -1
- warp/native/coloring.cpp +5 -1
- warp/native/cuda_util.cpp +91 -53
- warp/native/cuda_util.h +5 -0
- warp/native/exports.h +40 -40
- warp/native/intersect.h +17 -0
- warp/native/mat.h +41 -0
- warp/native/mathdx.cpp +19 -0
- warp/native/mesh.cpp +25 -8
- warp/native/mesh.cu +153 -101
- warp/native/mesh.h +482 -403
- warp/native/quat.h +40 -0
- warp/native/solid_angle.h +7 -0
- warp/native/sort.cpp +85 -0
- warp/native/sort.cu +34 -0
- warp/native/sort.h +3 -1
- warp/native/spatial.h +11 -0
- warp/native/tile.h +1187 -669
- warp/native/tile_reduce.h +8 -6
- warp/native/vec.h +41 -0
- warp/native/warp.cpp +8 -1
- warp/native/warp.cu +263 -40
- warp/native/warp.h +19 -5
- warp/optim/linear.py +22 -4
- warp/render/render_opengl.py +130 -64
- warp/sim/__init__.py +6 -1
- warp/sim/collide.py +270 -26
- warp/sim/import_urdf.py +8 -8
- warp/sim/integrator_euler.py +25 -7
- warp/sim/integrator_featherstone.py +154 -35
- warp/sim/integrator_vbd.py +842 -40
- warp/sim/model.py +134 -72
- warp/sparse.py +1 -1
- warp/stubs.py +265 -132
- warp/tape.py +28 -30
- warp/tests/aux_test_module_unload.py +15 -0
- warp/tests/{test_sim_grad.py → flaky_test_sim_grad.py} +104 -63
- warp/tests/test_array.py +74 -0
- warp/tests/test_assert.py +242 -0
- warp/tests/test_codegen.py +14 -61
- warp/tests/test_collision.py +2 -2
- warp/tests/test_coloring.py +12 -2
- warp/tests/test_examples.py +12 -1
- warp/tests/test_func.py +21 -4
- warp/tests/test_grad_debug.py +87 -2
- warp/tests/test_hash_grid.py +1 -1
- warp/tests/test_ipc.py +116 -0
- warp/tests/test_lerp.py +13 -87
- warp/tests/test_mat.py +138 -167
- warp/tests/test_math.py +47 -1
- warp/tests/test_matmul.py +17 -16
- warp/tests/test_matmul_lite.py +10 -15
- warp/tests/test_mesh.py +84 -60
- warp/tests/test_mesh_query_aabb.py +165 -0
- warp/tests/test_mesh_query_point.py +328 -286
- warp/tests/test_mesh_query_ray.py +134 -121
- warp/tests/test_mlp.py +2 -2
- warp/tests/test_operators.py +43 -0
- warp/tests/test_overwrite.py +47 -2
- warp/tests/test_quat.py +77 -0
- warp/tests/test_reload.py +29 -0
- warp/tests/test_sim_grad_bounce_linear.py +204 -0
- warp/tests/test_smoothstep.py +17 -83
- warp/tests/test_static.py +19 -3
- warp/tests/test_tape.py +25 -0
- warp/tests/test_tile.py +178 -191
- warp/tests/test_tile_load.py +356 -0
- warp/tests/test_tile_mathdx.py +61 -8
- warp/tests/test_tile_mlp.py +17 -17
- warp/tests/test_tile_reduce.py +24 -18
- warp/tests/test_tile_shared_memory.py +66 -17
- warp/tests/test_tile_view.py +165 -0
- warp/tests/test_torch.py +35 -0
- warp/tests/test_utils.py +36 -24
- warp/tests/test_vec.py +110 -0
- warp/tests/unittest_suites.py +29 -4
- warp/tests/unittest_utils.py +30 -13
- warp/thirdparty/unittest_parallel.py +2 -2
- warp/types.py +411 -101
- warp/utils.py +10 -7
- {warp_lang-1.5.0.dist-info → warp_lang-1.6.0.dist-info}/METADATA +92 -69
- {warp_lang-1.5.0.dist-info → warp_lang-1.6.0.dist-info}/RECORD +130 -119
- {warp_lang-1.5.0.dist-info → warp_lang-1.6.0.dist-info}/WHEEL +1 -1
- warp/examples/benchmarks/benchmark_tile.py +0 -179
- warp/native/tile_gemm.h +0 -341
- {warp_lang-1.5.0.dist-info → warp_lang-1.6.0.dist-info}/LICENSE.md +0 -0
- {warp_lang-1.5.0.dist-info → warp_lang-1.6.0.dist-info}/top_level.txt +0 -0
|
@@ -1162,31 +1162,97 @@ def create_inertia_matrix_kernel(num_joints, num_dofs):
|
|
|
1162
1162
|
):
|
|
1163
1163
|
articulation = wp.tid()
|
|
1164
1164
|
|
|
1165
|
-
J = wp.tile_load(J_arr[articulation],
|
|
1166
|
-
P = wp.tile_zeros(
|
|
1165
|
+
J = wp.tile_load(J_arr[articulation], shape=(wp.static(6 * num_joints), num_dofs))
|
|
1166
|
+
P = wp.tile_zeros(shape=(wp.static(6 * num_joints), num_dofs), dtype=float)
|
|
1167
1167
|
|
|
1168
1168
|
# compute P = M*J where M is a 6x6 block diagonal mass matrix
|
|
1169
1169
|
for i in range(int(num_joints)):
|
|
1170
1170
|
# 6x6 block matrices are on the diagonal
|
|
1171
|
-
M_body = wp.tile_load(M_arr[articulation],
|
|
1171
|
+
M_body = wp.tile_load(M_arr[articulation], shape=(6, 6), offset=(i * 6, i * 6))
|
|
1172
1172
|
|
|
1173
1173
|
# load a 6xN row from the Jacobian
|
|
1174
|
-
J_body = wp.tile_view(J, i * 6, 0,
|
|
1174
|
+
J_body = wp.tile_view(J, offset=(i * 6, 0), shape=(6, num_dofs))
|
|
1175
1175
|
|
|
1176
1176
|
# compute weighted row
|
|
1177
1177
|
P_body = wp.tile_matmul(M_body, J_body)
|
|
1178
1178
|
|
|
1179
1179
|
# assign to the P slice
|
|
1180
|
-
wp.tile_assign(
|
|
1180
|
+
wp.tile_assign(
|
|
1181
|
+
P,
|
|
1182
|
+
P_body,
|
|
1183
|
+
offset=(
|
|
1184
|
+
i * 6,
|
|
1185
|
+
0,
|
|
1186
|
+
),
|
|
1187
|
+
)
|
|
1181
1188
|
|
|
1182
1189
|
# compute H = J^T*P
|
|
1183
1190
|
H = wp.tile_matmul(wp.tile_transpose(J), P)
|
|
1184
1191
|
|
|
1185
|
-
wp.tile_store(H_arr[articulation],
|
|
1192
|
+
wp.tile_store(H_arr[articulation], H)
|
|
1186
1193
|
|
|
1187
1194
|
return eval_dense_gemm_tile
|
|
1188
1195
|
|
|
1189
1196
|
|
|
1197
|
+
def create_batched_cholesky_kernel(num_dofs):
|
|
1198
|
+
assert num_dofs == 18
|
|
1199
|
+
|
|
1200
|
+
@wp.kernel
|
|
1201
|
+
def eval_tiled_dense_cholesky_batched(
|
|
1202
|
+
A: wp.array3d(dtype=float), R: wp.array2d(dtype=float), L: wp.array3d(dtype=float)
|
|
1203
|
+
):
|
|
1204
|
+
articulation = wp.tid()
|
|
1205
|
+
|
|
1206
|
+
a = wp.tile_load(A[articulation], shape=(num_dofs, num_dofs), storage="shared")
|
|
1207
|
+
r = wp.tile_load(R[articulation], shape=num_dofs, storage="shared")
|
|
1208
|
+
wp.tile_diag_add(a, r)
|
|
1209
|
+
wp.tile_cholesky(a)
|
|
1210
|
+
wp.tile_store(L[articulation], wp.tile_transpose(a))
|
|
1211
|
+
|
|
1212
|
+
return eval_tiled_dense_cholesky_batched
|
|
1213
|
+
|
|
1214
|
+
|
|
1215
|
+
def create_inertia_matrix_cholesky_kernel(num_joints, num_dofs):
|
|
1216
|
+
@wp.kernel
|
|
1217
|
+
def eval_dense_gemm_and_cholesky_tile(
|
|
1218
|
+
J_arr: wp.array3d(dtype=float),
|
|
1219
|
+
M_arr: wp.array3d(dtype=float),
|
|
1220
|
+
R_arr: wp.array2d(dtype=float),
|
|
1221
|
+
H_arr: wp.array3d(dtype=float),
|
|
1222
|
+
L_arr: wp.array3d(dtype=float),
|
|
1223
|
+
):
|
|
1224
|
+
articulation = wp.tid()
|
|
1225
|
+
|
|
1226
|
+
J = wp.tile_load(J_arr[articulation], shape=(wp.static(6 * num_joints), num_dofs))
|
|
1227
|
+
P = wp.tile_zeros(shape=(wp.static(6 * num_joints), num_dofs), dtype=float)
|
|
1228
|
+
|
|
1229
|
+
# compute P = M*J where M is a 6x6 block diagonal mass matrix
|
|
1230
|
+
for i in range(int(num_joints)):
|
|
1231
|
+
# 6x6 block matrices are on the diagonal
|
|
1232
|
+
M_body = wp.tile_load(M_arr[articulation], shape=(6, 6), offset=(i * 6, i * 6))
|
|
1233
|
+
|
|
1234
|
+
# load a 6xN row from the Jacobian
|
|
1235
|
+
J_body = wp.tile_view(J, offset=(i * 6, 0), shape=(6, num_dofs))
|
|
1236
|
+
|
|
1237
|
+
# compute weighted row
|
|
1238
|
+
P_body = wp.tile_matmul(M_body, J_body)
|
|
1239
|
+
|
|
1240
|
+
# assign to the P slice
|
|
1241
|
+
wp.tile_assign(P, P_body, offset=(i * 6, 0))
|
|
1242
|
+
|
|
1243
|
+
# compute H = J^T*P
|
|
1244
|
+
H = wp.tile_matmul(wp.tile_transpose(J), P)
|
|
1245
|
+
wp.tile_store(H_arr[articulation], H)
|
|
1246
|
+
|
|
1247
|
+
# cholesky L L^T = (H + diag(R))
|
|
1248
|
+
R = wp.tile_load(R_arr[articulation], shape=num_dofs, storage="shared")
|
|
1249
|
+
H_R = wp.tile_diag_add(H, R)
|
|
1250
|
+
L = wp.tile_cholesky(H_R)
|
|
1251
|
+
wp.tile_store(L_arr[articulation], L)
|
|
1252
|
+
|
|
1253
|
+
return eval_dense_gemm_and_cholesky_tile
|
|
1254
|
+
|
|
1255
|
+
|
|
1190
1256
|
@wp.kernel
|
|
1191
1257
|
def eval_dense_gemm_batched(
|
|
1192
1258
|
m: wp.array(dtype=int),
|
|
@@ -1458,16 +1524,28 @@ class FeatherstoneIntegrator(Integrator):
|
|
|
1458
1524
|
|
|
1459
1525
|
"""
|
|
1460
1526
|
|
|
1461
|
-
def __init__(
|
|
1527
|
+
def __init__(
|
|
1528
|
+
self,
|
|
1529
|
+
model,
|
|
1530
|
+
angular_damping=0.05,
|
|
1531
|
+
update_mass_matrix_every=1,
|
|
1532
|
+
friction_smoothing=1.0,
|
|
1533
|
+
use_tile_gemm=False,
|
|
1534
|
+
fuse_cholesky=True,
|
|
1535
|
+
):
|
|
1462
1536
|
"""
|
|
1463
1537
|
Args:
|
|
1464
1538
|
model (Model): the model to be simulated.
|
|
1465
1539
|
angular_damping (float, optional): Angular damping factor. Defaults to 0.05.
|
|
1466
1540
|
update_mass_matrix_every (int, optional): How often to update the mass matrix (every n-th time the :meth:`simulate` function gets called). Defaults to 1.
|
|
1541
|
+
friction_smoothing (float, optional): The delta value for the Huber norm (see :func:`warp.math.norm_huber`) used for the friction velocity normalization. Defaults to 1.0.
|
|
1467
1542
|
"""
|
|
1468
1543
|
self.angular_damping = angular_damping
|
|
1469
1544
|
self.update_mass_matrix_every = update_mass_matrix_every
|
|
1545
|
+
self.friction_smoothing = friction_smoothing
|
|
1470
1546
|
self.use_tile_gemm = use_tile_gemm
|
|
1547
|
+
self.fuse_cholesky = fuse_cholesky
|
|
1548
|
+
|
|
1471
1549
|
self._step = 0
|
|
1472
1550
|
|
|
1473
1551
|
self.compute_articulation_indices(model)
|
|
@@ -1475,7 +1553,14 @@ class FeatherstoneIntegrator(Integrator):
|
|
|
1475
1553
|
|
|
1476
1554
|
if self.use_tile_gemm:
|
|
1477
1555
|
# create a custom kernel to evaluate the system matrix for this type
|
|
1478
|
-
|
|
1556
|
+
if self.fuse_cholesky:
|
|
1557
|
+
self.eval_inertia_matrix_cholesky_kernel = create_inertia_matrix_cholesky_kernel(
|
|
1558
|
+
int(self.joint_count), int(self.dof_count)
|
|
1559
|
+
)
|
|
1560
|
+
else:
|
|
1561
|
+
self.eval_inertia_matrix_kernel = create_inertia_matrix_kernel(
|
|
1562
|
+
int(self.joint_count), int(self.dof_count)
|
|
1563
|
+
)
|
|
1479
1564
|
|
|
1480
1565
|
# ensure matrix is reloaded since otherwise an unload can happen during graph capture
|
|
1481
1566
|
# todo: should not be necessary?
|
|
@@ -1758,6 +1843,7 @@ class FeatherstoneIntegrator(Integrator):
|
|
|
1758
1843
|
model.rigid_contact_shape0,
|
|
1759
1844
|
model.rigid_contact_shape1,
|
|
1760
1845
|
True,
|
|
1846
|
+
self.friction_smoothing,
|
|
1761
1847
|
],
|
|
1762
1848
|
outputs=[body_f],
|
|
1763
1849
|
device=model.device,
|
|
@@ -1842,23 +1928,56 @@ class FeatherstoneIntegrator(Integrator):
|
|
|
1842
1928
|
# reshape arrays
|
|
1843
1929
|
M_tiled = self.M.reshape((-1, 6 * self.joint_count, 6 * self.joint_count))
|
|
1844
1930
|
J_tiled = self.J.reshape((-1, 6 * self.joint_count, self.dof_count))
|
|
1931
|
+
R_tiled = model.joint_armature.reshape((-1, self.dof_count))
|
|
1845
1932
|
H_tiled = self.H.reshape((-1, self.dof_count, self.dof_count))
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1933
|
+
L_tiled = self.L.reshape((-1, self.dof_count, self.dof_count))
|
|
1934
|
+
assert H_tiled.shape == (model.articulation_count, 18, 18)
|
|
1935
|
+
assert L_tiled.shape == (model.articulation_count, 18, 18)
|
|
1936
|
+
assert R_tiled.shape == (model.articulation_count, 18)
|
|
1937
|
+
|
|
1938
|
+
if self.fuse_cholesky:
|
|
1939
|
+
wp.launch_tiled(
|
|
1940
|
+
self.eval_inertia_matrix_cholesky_kernel,
|
|
1941
|
+
dim=model.articulation_count,
|
|
1942
|
+
inputs=[J_tiled, M_tiled, R_tiled],
|
|
1943
|
+
outputs=[H_tiled, L_tiled],
|
|
1944
|
+
device=model.device,
|
|
1945
|
+
block_dim=64,
|
|
1946
|
+
)
|
|
1947
|
+
|
|
1948
|
+
else:
|
|
1949
|
+
wp.launch_tiled(
|
|
1950
|
+
self.eval_inertia_matrix_kernel,
|
|
1951
|
+
dim=model.articulation_count,
|
|
1952
|
+
inputs=[J_tiled, M_tiled],
|
|
1953
|
+
outputs=[H_tiled],
|
|
1954
|
+
device=model.device,
|
|
1955
|
+
block_dim=256,
|
|
1956
|
+
)
|
|
1957
|
+
|
|
1958
|
+
wp.launch(
|
|
1959
|
+
eval_dense_cholesky_batched,
|
|
1960
|
+
dim=model.articulation_count,
|
|
1961
|
+
inputs=[
|
|
1962
|
+
self.articulation_H_start,
|
|
1963
|
+
self.articulation_H_rows,
|
|
1964
|
+
self.H,
|
|
1965
|
+
model.joint_armature,
|
|
1966
|
+
],
|
|
1967
|
+
outputs=[self.L],
|
|
1968
|
+
device=model.device,
|
|
1969
|
+
)
|
|
1859
1970
|
|
|
1860
1971
|
# import numpy as np
|
|
1861
|
-
#
|
|
1972
|
+
# J = J_tiled.numpy()
|
|
1973
|
+
# M = M_tiled.numpy()
|
|
1974
|
+
# R = R_tiled.numpy()
|
|
1975
|
+
# for i in range(model.articulation_count):
|
|
1976
|
+
# r = R[i,:,0]
|
|
1977
|
+
# H = J[i].T @ M[i] @ J[i]
|
|
1978
|
+
# L = np.linalg.cholesky(H + np.diag(r))
|
|
1979
|
+
# np.testing.assert_allclose(H, H_tiled.numpy()[i], rtol=1e-2, atol=1e-2)
|
|
1980
|
+
# np.testing.assert_allclose(L, L_tiled.numpy()[i], rtol=1e-1, atol=1e-1)
|
|
1862
1981
|
|
|
1863
1982
|
else:
|
|
1864
1983
|
# form P = M*J
|
|
@@ -1904,19 +2023,19 @@ class FeatherstoneIntegrator(Integrator):
|
|
|
1904
2023
|
device=model.device,
|
|
1905
2024
|
)
|
|
1906
2025
|
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
2026
|
+
# compute decomposition
|
|
2027
|
+
wp.launch(
|
|
2028
|
+
eval_dense_cholesky_batched,
|
|
2029
|
+
dim=model.articulation_count,
|
|
2030
|
+
inputs=[
|
|
2031
|
+
self.articulation_H_start,
|
|
2032
|
+
self.articulation_H_rows,
|
|
2033
|
+
self.H,
|
|
2034
|
+
model.joint_armature,
|
|
2035
|
+
],
|
|
2036
|
+
outputs=[self.L],
|
|
2037
|
+
device=model.device,
|
|
2038
|
+
)
|
|
1920
2039
|
|
|
1921
2040
|
# print("joint_act:")
|
|
1922
2041
|
# print(control.joint_act.numpy())
|