warp-lang 1.5.1__py3-none-manylinux2014_aarch64.whl → 1.6.1__py3-none-manylinux2014_aarch64.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.so +0 -0
- warp/bin/warp.so +0 -0
- warp/build.py +40 -12
- warp/build_dll.py +13 -6
- warp/builtins.py +1077 -481
- warp/codegen.py +250 -122
- warp/config.py +65 -21
- warp/context.py +500 -149
- 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_marching_cubes.py +1 -1
- warp/examples/core/example_mesh.py +1 -1
- warp/examples/core/example_torch.py +18 -34
- warp/examples/core/example_wave.py +1 -1
- 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_self_contact.py +314 -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 +191 -0
- warp/examples/tile/example_tile_walker.py +319 -0
- 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 +6 -2
- warp/native/crt.h +1 -0
- warp/native/cuda_util.cpp +35 -0
- warp/native/cuda_util.h +5 -0
- warp/native/exports.h +40 -40
- warp/native/intersect.h +17 -0
- warp/native/mat.h +57 -3
- 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 +1189 -664
- 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 +132 -59
- warp/render/render_usd.py +10 -2
- warp/sim/__init__.py +6 -1
- warp/sim/collide.py +289 -32
- warp/sim/import_urdf.py +20 -5
- warp/sim/integrator_euler.py +25 -7
- warp/sim/integrator_featherstone.py +147 -35
- warp/sim/integrator_vbd.py +842 -40
- warp/sim/model.py +173 -112
- warp/sim/render.py +2 -2
- warp/stubs.py +249 -116
- 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 +100 -0
- warp/tests/test_assert.py +242 -0
- warp/tests/test_codegen.py +14 -61
- warp/tests/test_collision.py +8 -8
- warp/tests/test_examples.py +16 -1
- 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_launch.py +77 -26
- warp/tests/test_mat.py +213 -168
- warp/tests/test_math.py +47 -1
- warp/tests/test_matmul.py +11 -7
- warp/tests/test_matmul_lite.py +4 -4
- 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 +6 -5
- 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_static.py +16 -0
- warp/tests/test_tape.py +25 -0
- warp/tests/test_tile.py +134 -191
- warp/tests/test_tile_load.py +399 -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 -11
- warp/thirdparty/unittest_parallel.py +5 -2
- warp/types.py +419 -111
- warp/utils.py +9 -5
- {warp_lang-1.5.1.dist-info → warp_lang-1.6.1.dist-info}/METADATA +86 -45
- {warp_lang-1.5.1.dist-info → warp_lang-1.6.1.dist-info}/RECORD +129 -118
- {warp_lang-1.5.1.dist-info → warp_lang-1.6.1.dist-info}/WHEEL +1 -1
- warp/examples/benchmarks/benchmark_tile.py +0 -179
- warp/native/tile_gemm.h +0 -341
- {warp_lang-1.5.1.dist-info → warp_lang-1.6.1.dist-info}/LICENSE.md +0 -0
- {warp_lang-1.5.1.dist-info → warp_lang-1.6.1.dist-info}/top_level.txt +0 -0
|
@@ -1162,31 +1162,90 @@ 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(P, i * 6, 0
|
|
1180
|
+
wp.tile_assign(P, P_body, offset=(i * 6, 0))
|
|
1181
1181
|
|
|
1182
1182
|
# compute H = J^T*P
|
|
1183
1183
|
H = wp.tile_matmul(wp.tile_transpose(J), P)
|
|
1184
1184
|
|
|
1185
|
-
wp.tile_store(H_arr[articulation],
|
|
1185
|
+
wp.tile_store(H_arr[articulation], H)
|
|
1186
1186
|
|
|
1187
1187
|
return eval_dense_gemm_tile
|
|
1188
1188
|
|
|
1189
1189
|
|
|
1190
|
+
def create_batched_cholesky_kernel(num_dofs):
|
|
1191
|
+
assert num_dofs == 18
|
|
1192
|
+
|
|
1193
|
+
@wp.kernel
|
|
1194
|
+
def eval_tiled_dense_cholesky_batched(
|
|
1195
|
+
A: wp.array3d(dtype=float), R: wp.array2d(dtype=float), L: wp.array3d(dtype=float)
|
|
1196
|
+
):
|
|
1197
|
+
articulation = wp.tid()
|
|
1198
|
+
|
|
1199
|
+
a = wp.tile_load(A[articulation], shape=(num_dofs, num_dofs), storage="shared")
|
|
1200
|
+
r = wp.tile_load(R[articulation], shape=num_dofs, storage="shared")
|
|
1201
|
+
a_r = wp.tile_diag_add(a, r)
|
|
1202
|
+
l = wp.tile_cholesky(a_r)
|
|
1203
|
+
wp.tile_store(L[articulation], wp.tile_transpose(l))
|
|
1204
|
+
|
|
1205
|
+
return eval_tiled_dense_cholesky_batched
|
|
1206
|
+
|
|
1207
|
+
|
|
1208
|
+
def create_inertia_matrix_cholesky_kernel(num_joints, num_dofs):
|
|
1209
|
+
@wp.kernel
|
|
1210
|
+
def eval_dense_gemm_and_cholesky_tile(
|
|
1211
|
+
J_arr: wp.array3d(dtype=float),
|
|
1212
|
+
M_arr: wp.array3d(dtype=float),
|
|
1213
|
+
R_arr: wp.array2d(dtype=float),
|
|
1214
|
+
H_arr: wp.array3d(dtype=float),
|
|
1215
|
+
L_arr: wp.array3d(dtype=float),
|
|
1216
|
+
):
|
|
1217
|
+
articulation = wp.tid()
|
|
1218
|
+
|
|
1219
|
+
J = wp.tile_load(J_arr[articulation], shape=(wp.static(6 * num_joints), num_dofs))
|
|
1220
|
+
P = wp.tile_zeros(shape=(wp.static(6 * num_joints), num_dofs), dtype=float)
|
|
1221
|
+
|
|
1222
|
+
# compute P = M*J where M is a 6x6 block diagonal mass matrix
|
|
1223
|
+
for i in range(int(num_joints)):
|
|
1224
|
+
# 6x6 block matrices are on the diagonal
|
|
1225
|
+
M_body = wp.tile_load(M_arr[articulation], shape=(6, 6), offset=(i * 6, i * 6))
|
|
1226
|
+
|
|
1227
|
+
# load a 6xN row from the Jacobian
|
|
1228
|
+
J_body = wp.tile_view(J, offset=(i * 6, 0), shape=(6, num_dofs))
|
|
1229
|
+
|
|
1230
|
+
# compute weighted row
|
|
1231
|
+
P_body = wp.tile_matmul(M_body, J_body)
|
|
1232
|
+
|
|
1233
|
+
# assign to the P slice
|
|
1234
|
+
wp.tile_assign(P, P_body, offset=(i * 6, 0))
|
|
1235
|
+
|
|
1236
|
+
# compute H = J^T*P
|
|
1237
|
+
H = wp.tile_matmul(wp.tile_transpose(J), P)
|
|
1238
|
+
wp.tile_store(H_arr[articulation], H)
|
|
1239
|
+
|
|
1240
|
+
# cholesky L L^T = (H + diag(R))
|
|
1241
|
+
R = wp.tile_load(R_arr[articulation], shape=num_dofs, storage="shared")
|
|
1242
|
+
H_R = wp.tile_diag_add(H, R)
|
|
1243
|
+
L = wp.tile_cholesky(H_R)
|
|
1244
|
+
wp.tile_store(L_arr[articulation], L)
|
|
1245
|
+
|
|
1246
|
+
return eval_dense_gemm_and_cholesky_tile
|
|
1247
|
+
|
|
1248
|
+
|
|
1190
1249
|
@wp.kernel
|
|
1191
1250
|
def eval_dense_gemm_batched(
|
|
1192
1251
|
m: wp.array(dtype=int),
|
|
@@ -1458,16 +1517,28 @@ class FeatherstoneIntegrator(Integrator):
|
|
|
1458
1517
|
|
|
1459
1518
|
"""
|
|
1460
1519
|
|
|
1461
|
-
def __init__(
|
|
1520
|
+
def __init__(
|
|
1521
|
+
self,
|
|
1522
|
+
model,
|
|
1523
|
+
angular_damping=0.05,
|
|
1524
|
+
update_mass_matrix_every=1,
|
|
1525
|
+
friction_smoothing=1.0,
|
|
1526
|
+
use_tile_gemm=False,
|
|
1527
|
+
fuse_cholesky=True,
|
|
1528
|
+
):
|
|
1462
1529
|
"""
|
|
1463
1530
|
Args:
|
|
1464
1531
|
model (Model): the model to be simulated.
|
|
1465
1532
|
angular_damping (float, optional): Angular damping factor. Defaults to 0.05.
|
|
1466
1533
|
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.
|
|
1534
|
+
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
1535
|
"""
|
|
1468
1536
|
self.angular_damping = angular_damping
|
|
1469
1537
|
self.update_mass_matrix_every = update_mass_matrix_every
|
|
1538
|
+
self.friction_smoothing = friction_smoothing
|
|
1470
1539
|
self.use_tile_gemm = use_tile_gemm
|
|
1540
|
+
self.fuse_cholesky = fuse_cholesky
|
|
1541
|
+
|
|
1471
1542
|
self._step = 0
|
|
1472
1543
|
|
|
1473
1544
|
self.compute_articulation_indices(model)
|
|
@@ -1475,7 +1546,14 @@ class FeatherstoneIntegrator(Integrator):
|
|
|
1475
1546
|
|
|
1476
1547
|
if self.use_tile_gemm:
|
|
1477
1548
|
# create a custom kernel to evaluate the system matrix for this type
|
|
1478
|
-
|
|
1549
|
+
if self.fuse_cholesky:
|
|
1550
|
+
self.eval_inertia_matrix_cholesky_kernel = create_inertia_matrix_cholesky_kernel(
|
|
1551
|
+
int(self.joint_count), int(self.dof_count)
|
|
1552
|
+
)
|
|
1553
|
+
else:
|
|
1554
|
+
self.eval_inertia_matrix_kernel = create_inertia_matrix_kernel(
|
|
1555
|
+
int(self.joint_count), int(self.dof_count)
|
|
1556
|
+
)
|
|
1479
1557
|
|
|
1480
1558
|
# ensure matrix is reloaded since otherwise an unload can happen during graph capture
|
|
1481
1559
|
# todo: should not be necessary?
|
|
@@ -1758,6 +1836,7 @@ class FeatherstoneIntegrator(Integrator):
|
|
|
1758
1836
|
model.rigid_contact_shape0,
|
|
1759
1837
|
model.rigid_contact_shape1,
|
|
1760
1838
|
True,
|
|
1839
|
+
self.friction_smoothing,
|
|
1761
1840
|
],
|
|
1762
1841
|
outputs=[body_f],
|
|
1763
1842
|
device=model.device,
|
|
@@ -1842,23 +1921,56 @@ class FeatherstoneIntegrator(Integrator):
|
|
|
1842
1921
|
# reshape arrays
|
|
1843
1922
|
M_tiled = self.M.reshape((-1, 6 * self.joint_count, 6 * self.joint_count))
|
|
1844
1923
|
J_tiled = self.J.reshape((-1, 6 * self.joint_count, self.dof_count))
|
|
1924
|
+
R_tiled = model.joint_armature.reshape((-1, self.dof_count))
|
|
1845
1925
|
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
|
-
|
|
1926
|
+
L_tiled = self.L.reshape((-1, self.dof_count, self.dof_count))
|
|
1927
|
+
assert H_tiled.shape == (model.articulation_count, 18, 18)
|
|
1928
|
+
assert L_tiled.shape == (model.articulation_count, 18, 18)
|
|
1929
|
+
assert R_tiled.shape == (model.articulation_count, 18)
|
|
1930
|
+
|
|
1931
|
+
if self.fuse_cholesky:
|
|
1932
|
+
wp.launch_tiled(
|
|
1933
|
+
self.eval_inertia_matrix_cholesky_kernel,
|
|
1934
|
+
dim=model.articulation_count,
|
|
1935
|
+
inputs=[J_tiled, M_tiled, R_tiled],
|
|
1936
|
+
outputs=[H_tiled, L_tiled],
|
|
1937
|
+
device=model.device,
|
|
1938
|
+
block_dim=64,
|
|
1939
|
+
)
|
|
1940
|
+
|
|
1941
|
+
else:
|
|
1942
|
+
wp.launch_tiled(
|
|
1943
|
+
self.eval_inertia_matrix_kernel,
|
|
1944
|
+
dim=model.articulation_count,
|
|
1945
|
+
inputs=[J_tiled, M_tiled],
|
|
1946
|
+
outputs=[H_tiled],
|
|
1947
|
+
device=model.device,
|
|
1948
|
+
block_dim=256,
|
|
1949
|
+
)
|
|
1950
|
+
|
|
1951
|
+
wp.launch(
|
|
1952
|
+
eval_dense_cholesky_batched,
|
|
1953
|
+
dim=model.articulation_count,
|
|
1954
|
+
inputs=[
|
|
1955
|
+
self.articulation_H_start,
|
|
1956
|
+
self.articulation_H_rows,
|
|
1957
|
+
self.H,
|
|
1958
|
+
model.joint_armature,
|
|
1959
|
+
],
|
|
1960
|
+
outputs=[self.L],
|
|
1961
|
+
device=model.device,
|
|
1962
|
+
)
|
|
1859
1963
|
|
|
1860
1964
|
# import numpy as np
|
|
1861
|
-
#
|
|
1965
|
+
# J = J_tiled.numpy()
|
|
1966
|
+
# M = M_tiled.numpy()
|
|
1967
|
+
# R = R_tiled.numpy()
|
|
1968
|
+
# for i in range(model.articulation_count):
|
|
1969
|
+
# r = R[i,:,0]
|
|
1970
|
+
# H = J[i].T @ M[i] @ J[i]
|
|
1971
|
+
# L = np.linalg.cholesky(H + np.diag(r))
|
|
1972
|
+
# np.testing.assert_allclose(H, H_tiled.numpy()[i], rtol=1e-2, atol=1e-2)
|
|
1973
|
+
# np.testing.assert_allclose(L, L_tiled.numpy()[i], rtol=1e-1, atol=1e-1)
|
|
1862
1974
|
|
|
1863
1975
|
else:
|
|
1864
1976
|
# form P = M*J
|
|
@@ -1904,19 +2016,19 @@ class FeatherstoneIntegrator(Integrator):
|
|
|
1904
2016
|
device=model.device,
|
|
1905
2017
|
)
|
|
1906
2018
|
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
2019
|
+
# compute decomposition
|
|
2020
|
+
wp.launch(
|
|
2021
|
+
eval_dense_cholesky_batched,
|
|
2022
|
+
dim=model.articulation_count,
|
|
2023
|
+
inputs=[
|
|
2024
|
+
self.articulation_H_start,
|
|
2025
|
+
self.articulation_H_rows,
|
|
2026
|
+
self.H,
|
|
2027
|
+
model.joint_armature,
|
|
2028
|
+
],
|
|
2029
|
+
outputs=[self.L],
|
|
2030
|
+
device=model.device,
|
|
2031
|
+
)
|
|
1920
2032
|
|
|
1921
2033
|
# print("joint_act:")
|
|
1922
2034
|
# print(control.joint_act.numpy())
|