warp-lang 1.8.0__py3-none-manylinux_2_34_aarch64.whl → 1.9.0__py3-none-manylinux_2_34_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.

Files changed (153) hide show
  1. warp/__init__.py +282 -103
  2. warp/__init__.pyi +482 -110
  3. warp/bin/warp-clang.so +0 -0
  4. warp/bin/warp.so +0 -0
  5. warp/build.py +93 -30
  6. warp/build_dll.py +48 -63
  7. warp/builtins.py +955 -137
  8. warp/codegen.py +327 -209
  9. warp/config.py +1 -1
  10. warp/context.py +1363 -800
  11. warp/examples/core/example_marching_cubes.py +1 -0
  12. warp/examples/core/example_render_opengl.py +100 -3
  13. warp/examples/fem/example_apic_fluid.py +98 -52
  14. warp/examples/fem/example_convection_diffusion_dg.py +25 -4
  15. warp/examples/fem/example_diffusion_mgpu.py +8 -3
  16. warp/examples/fem/utils.py +68 -22
  17. warp/examples/interop/example_jax_callable.py +34 -4
  18. warp/examples/interop/example_jax_kernel.py +27 -1
  19. warp/fabric.py +1 -1
  20. warp/fem/cache.py +27 -19
  21. warp/fem/domain.py +2 -2
  22. warp/fem/field/nodal_field.py +2 -2
  23. warp/fem/field/virtual.py +266 -166
  24. warp/fem/geometry/geometry.py +5 -5
  25. warp/fem/integrate.py +200 -91
  26. warp/fem/space/restriction.py +4 -0
  27. warp/fem/space/shape/tet_shape_function.py +3 -10
  28. warp/jax_experimental/custom_call.py +1 -1
  29. warp/jax_experimental/ffi.py +203 -54
  30. warp/marching_cubes.py +708 -0
  31. warp/native/array.h +103 -8
  32. warp/native/builtin.h +90 -9
  33. warp/native/bvh.cpp +64 -28
  34. warp/native/bvh.cu +58 -58
  35. warp/native/bvh.h +2 -2
  36. warp/native/clang/clang.cpp +7 -7
  37. warp/native/coloring.cpp +13 -3
  38. warp/native/crt.cpp +2 -2
  39. warp/native/crt.h +3 -5
  40. warp/native/cuda_util.cpp +42 -11
  41. warp/native/cuda_util.h +10 -4
  42. warp/native/exports.h +1842 -1908
  43. warp/native/fabric.h +2 -1
  44. warp/native/hashgrid.cpp +37 -37
  45. warp/native/hashgrid.cu +2 -2
  46. warp/native/initializer_array.h +1 -1
  47. warp/native/intersect.h +4 -4
  48. warp/native/mat.h +1913 -119
  49. warp/native/mathdx.cpp +43 -43
  50. warp/native/mesh.cpp +24 -24
  51. warp/native/mesh.cu +26 -26
  52. warp/native/mesh.h +5 -3
  53. warp/native/nanovdb/GridHandle.h +179 -12
  54. warp/native/nanovdb/HostBuffer.h +8 -7
  55. warp/native/nanovdb/NanoVDB.h +517 -895
  56. warp/native/nanovdb/NodeManager.h +323 -0
  57. warp/native/nanovdb/PNanoVDB.h +2 -2
  58. warp/native/quat.h +337 -16
  59. warp/native/rand.h +7 -7
  60. warp/native/range.h +7 -1
  61. warp/native/reduce.cpp +10 -10
  62. warp/native/reduce.cu +13 -14
  63. warp/native/runlength_encode.cpp +2 -2
  64. warp/native/runlength_encode.cu +5 -5
  65. warp/native/scan.cpp +3 -3
  66. warp/native/scan.cu +4 -4
  67. warp/native/sort.cpp +10 -10
  68. warp/native/sort.cu +22 -22
  69. warp/native/sparse.cpp +8 -8
  70. warp/native/sparse.cu +14 -14
  71. warp/native/spatial.h +366 -17
  72. warp/native/svd.h +23 -8
  73. warp/native/temp_buffer.h +2 -2
  74. warp/native/tile.h +303 -70
  75. warp/native/tile_radix_sort.h +5 -1
  76. warp/native/tile_reduce.h +16 -25
  77. warp/native/tuple.h +2 -2
  78. warp/native/vec.h +385 -18
  79. warp/native/volume.cpp +54 -54
  80. warp/native/volume.cu +1 -1
  81. warp/native/volume.h +2 -1
  82. warp/native/volume_builder.cu +30 -37
  83. warp/native/warp.cpp +150 -149
  84. warp/native/warp.cu +337 -193
  85. warp/native/warp.h +227 -226
  86. warp/optim/linear.py +736 -271
  87. warp/render/imgui_manager.py +289 -0
  88. warp/render/render_opengl.py +137 -57
  89. warp/render/render_usd.py +0 -1
  90. warp/sim/collide.py +1 -2
  91. warp/sim/graph_coloring.py +2 -2
  92. warp/sim/integrator_vbd.py +10 -2
  93. warp/sparse.py +559 -176
  94. warp/tape.py +2 -0
  95. warp/tests/aux_test_module_aot.py +7 -0
  96. warp/tests/cuda/test_async.py +3 -3
  97. warp/tests/cuda/test_conditional_captures.py +101 -0
  98. warp/tests/geometry/test_marching_cubes.py +233 -12
  99. warp/tests/sim/test_cloth.py +89 -6
  100. warp/tests/sim/test_coloring.py +82 -7
  101. warp/tests/test_array.py +56 -5
  102. warp/tests/test_assert.py +53 -0
  103. warp/tests/test_atomic_cas.py +127 -114
  104. warp/tests/test_codegen.py +3 -2
  105. warp/tests/test_context.py +8 -15
  106. warp/tests/test_enum.py +136 -0
  107. warp/tests/test_examples.py +2 -2
  108. warp/tests/test_fem.py +45 -2
  109. warp/tests/test_fixedarray.py +229 -0
  110. warp/tests/test_func.py +18 -15
  111. warp/tests/test_future_annotations.py +7 -5
  112. warp/tests/test_linear_solvers.py +30 -0
  113. warp/tests/test_map.py +1 -1
  114. warp/tests/test_mat.py +1540 -378
  115. warp/tests/test_mat_assign_copy.py +178 -0
  116. warp/tests/test_mat_constructors.py +574 -0
  117. warp/tests/test_module_aot.py +287 -0
  118. warp/tests/test_print.py +69 -0
  119. warp/tests/test_quat.py +162 -34
  120. warp/tests/test_quat_assign_copy.py +145 -0
  121. warp/tests/test_reload.py +2 -1
  122. warp/tests/test_sparse.py +103 -0
  123. warp/tests/test_spatial.py +140 -34
  124. warp/tests/test_spatial_assign_copy.py +160 -0
  125. warp/tests/test_static.py +48 -0
  126. warp/tests/test_struct.py +43 -3
  127. warp/tests/test_tape.py +38 -0
  128. warp/tests/test_types.py +0 -20
  129. warp/tests/test_vec.py +216 -441
  130. warp/tests/test_vec_assign_copy.py +143 -0
  131. warp/tests/test_vec_constructors.py +325 -0
  132. warp/tests/tile/test_tile.py +206 -152
  133. warp/tests/tile/test_tile_cholesky.py +605 -0
  134. warp/tests/tile/test_tile_load.py +169 -0
  135. warp/tests/tile/test_tile_mathdx.py +2 -558
  136. warp/tests/tile/test_tile_matmul.py +179 -0
  137. warp/tests/tile/test_tile_mlp.py +1 -1
  138. warp/tests/tile/test_tile_reduce.py +100 -11
  139. warp/tests/tile/test_tile_shared_memory.py +16 -16
  140. warp/tests/tile/test_tile_sort.py +59 -55
  141. warp/tests/unittest_suites.py +16 -0
  142. warp/tests/walkthrough_debug.py +1 -1
  143. warp/thirdparty/unittest_parallel.py +108 -9
  144. warp/types.py +554 -264
  145. warp/utils.py +68 -86
  146. {warp_lang-1.8.0.dist-info → warp_lang-1.9.0.dist-info}/METADATA +28 -65
  147. {warp_lang-1.8.0.dist-info → warp_lang-1.9.0.dist-info}/RECORD +150 -138
  148. warp/native/marching.cpp +0 -19
  149. warp/native/marching.cu +0 -514
  150. warp/native/marching.h +0 -19
  151. {warp_lang-1.8.0.dist-info → warp_lang-1.9.0.dist-info}/WHEEL +0 -0
  152. {warp_lang-1.8.0.dist-info → warp_lang-1.9.0.dist-info}/licenses/LICENSE.md +0 -0
  153. {warp_lang-1.8.0.dist-info → warp_lang-1.9.0.dist-info}/top_level.txt +0 -0
warp/tests/test_static.py CHANGED
@@ -559,6 +559,54 @@ def test_static_len_query(test, _):
559
559
  wp.launch(static_len_query_kernel, 1, inputs=(v1,))
560
560
 
561
561
 
562
+ @wp.func
563
+ def func_1() -> int:
564
+ return 1
565
+
566
+
567
+ @wp.func
568
+ def func_2() -> int:
569
+ return 2
570
+
571
+
572
+ funcs = [func_1, func_2]
573
+
574
+
575
+ def unresolved_builder(funcids):
576
+ _funcs = [funcs[id] for id in funcids]
577
+
578
+ @wp.kernel
579
+ def eval(input: wp.array(dtype=int), output: wp.array(dtype=int)):
580
+ for i in range(wp.static(len(_funcs))):
581
+ output[0] = wp.static(_funcs[i])()
582
+
583
+ return eval
584
+
585
+
586
+ def test_unresolved_static_expression(test, device):
587
+ # The module hash will need to be updated from the static expressions
588
+ # resolved at code generation time, since some of them cannot be evaluated
589
+ # at declaration time.
590
+ with wp.ScopedDevice(device):
591
+ output1 = wp.array((1,), dtype=int)
592
+ wp.launch(
593
+ unresolved_builder([0]),
594
+ dim=(1,),
595
+ inputs=[wp.array(np.array([0]), dtype=int)],
596
+ outputs=[output1],
597
+ )
598
+ test.assertEqual(output1.numpy()[0], 1)
599
+
600
+ output2 = wp.array((1,), dtype=int)
601
+ wp.launch(
602
+ unresolved_builder([1]),
603
+ dim=(1,),
604
+ inputs=[wp.array(np.array([1]), dtype=int)],
605
+ outputs=[output2],
606
+ )
607
+ test.assertEqual(output2.numpy()[0], 2)
608
+
609
+
562
610
  devices = get_test_devices()
563
611
 
564
612
 
warp/tests/test_struct.py CHANGED
@@ -235,6 +235,44 @@ def test_nested_struct(test, device):
235
235
  )
236
236
 
237
237
 
238
+ @wp.struct
239
+ class MatStruct:
240
+ m: wp.mat44
241
+
242
+
243
+ @wp.kernel
244
+ def kernel_nested_mat(out: wp.array(dtype=wp.mat44)):
245
+ s = MatStruct()
246
+ m = wp.mat44()
247
+
248
+ s.m[1, 2] = 3.0
249
+
250
+ out[0] = s.m
251
+
252
+
253
+ def test_nested_mat(test, device):
254
+ m = wp.array([wp.mat44()], dtype=wp.mat44, device=device)
255
+ wp.launch(kernel_nested_mat, dim=1, outputs=[m], device=device)
256
+ wp.synchronize()
257
+
258
+ out = m.numpy()
259
+ assert_np_equal(out[0][1, 2], 3.0)
260
+
261
+
262
+ def test_assign_view(test, device):
263
+ @wp.kernel
264
+ def kernel_assign_view(out: wp.array2d(dtype=wp.mat44)):
265
+ out[0][2, 2] = 6.0
266
+
267
+ m = wp.array([[wp.mat44()]], dtype=wp.mat44, device=device)
268
+
269
+ with test.assertRaisesRegex(
270
+ wp.codegen.WarpCodegenError,
271
+ r"Incorrect number of indices specified for array indexing",
272
+ ):
273
+ wp.launch(kernel_assign_view, dim=[1, 1], outputs=[m], device=device)
274
+
275
+
238
276
  def test_struct_attribute_error(test, device):
239
277
  @wp.kernel
240
278
  def kernel(foo: Foo):
@@ -751,9 +789,6 @@ def test_struct_array_gc_requires_grad_toggle(test, device):
751
789
  tape.backward(loss=loss_wp)
752
790
 
753
791
 
754
- devices = get_test_devices()
755
-
756
-
757
792
  class TestStruct(unittest.TestCase):
758
793
  # check structs default initialized in Python correctly
759
794
  def test_struct_default_attributes_python(self):
@@ -772,6 +807,9 @@ class TestStruct(unittest.TestCase):
772
807
  np.testing.assert_equal(arr.numpy().tolist(), expected)
773
808
 
774
809
 
810
+ devices = get_test_devices()
811
+
812
+
775
813
  add_function_test(TestStruct, "test_step", test_step, devices=devices)
776
814
  add_function_test(TestStruct, "test_step_grad", test_step_grad, devices=devices)
777
815
  add_kernel_test(TestStruct, kernel=test_empty, name="test_empty", dim=1, inputs=[Empty()], devices=devices)
@@ -785,6 +823,8 @@ add_kernel_test(
785
823
  )
786
824
  add_kernel_test(TestStruct, kernel=test_return, name="test_return", dim=1, inputs=[], devices=devices)
787
825
  add_function_test(TestStruct, "test_nested_struct", test_nested_struct, devices=devices)
826
+ add_function_test(TestStruct, "test_nested_mat", test_nested_mat, devices=devices)
827
+ add_function_test(TestStruct, "test_assign_view", test_assign_view, devices=devices)
788
828
  add_function_test(TestStruct, "test_struct_attribute_error", test_struct_attribute_error, devices=devices)
789
829
  add_function_test(TestStruct, "test_struct_inheritance_error", test_struct_inheritance_error, devices=devices)
790
830
  add_function_test(TestStruct, "test_nested_array_struct", test_nested_array_struct, devices=devices)
warp/tests/test_tape.py CHANGED
@@ -157,6 +157,43 @@ def test_tape_zero_multiple_outputs(test, device):
157
157
  assert_np_equal(x.grad.numpy(), np.ones(3, dtype=float))
158
158
 
159
159
 
160
+ @wp.struct
161
+ class NestedStruct:
162
+ arr: wp.array(dtype=float)
163
+
164
+
165
+ @wp.struct
166
+ class WrapperStruct:
167
+ nested: NestedStruct
168
+
169
+
170
+ @wp.kernel
171
+ def nested_loss_kernel(wrapper: WrapperStruct, loss: wp.array(dtype=float)):
172
+ i = wp.tid()
173
+ wp.atomic_add(loss, 0, wrapper.nested.arr[i])
174
+
175
+
176
+ def test_tape_nested_struct(test, device):
177
+ wrapper = WrapperStruct()
178
+ wrapper.nested = NestedStruct()
179
+ wrapper.nested.arr = wp.ones(shape=(1,), dtype=float, requires_grad=True, device=device)
180
+
181
+ loss = wp.zeros(shape=(1,), dtype=float, requires_grad=True, device=device)
182
+
183
+ tape = wp.Tape()
184
+ with tape:
185
+ wp.launch(nested_loss_kernel, dim=1, inputs=(wrapper, loss), device=device)
186
+
187
+ assert_np_equal(loss.numpy(), [1.0])
188
+
189
+ tape.backward(loss)
190
+ assert_np_equal(wrapper.nested.arr.grad.numpy(), [1.0])
191
+
192
+ tape.zero()
193
+
194
+ assert_np_equal(wrapper.nested.arr.grad.numpy(), [0.0])
195
+
196
+
160
197
  def test_tape_visualize(test, device):
161
198
  dim = 8
162
199
  tape = wp.Tape()
@@ -196,6 +233,7 @@ add_function_test(TestTape, "test_tape_mul_constant", test_tape_mul_constant, de
196
233
  add_function_test(TestTape, "test_tape_mul_variable", test_tape_mul_variable, devices=devices)
197
234
  add_function_test(TestTape, "test_tape_dot_product", test_tape_dot_product, devices=devices)
198
235
  add_function_test(TestTape, "test_tape_zero_multiple_outputs", test_tape_zero_multiple_outputs, devices=devices)
236
+ add_function_test(TestTape, "test_tape_nested_struct", test_tape_nested_struct, devices=devices)
199
237
  add_function_test(TestTape, "test_tape_visualize", test_tape_visualize, devices=devices)
200
238
 
201
239
 
warp/tests/test_types.py CHANGED
@@ -267,11 +267,6 @@ class TestTypes(unittest.TestCase):
267
267
  with self.assertRaisesRegex(TypeError, r"Expected to assign a `int32` value but got `str` instead"):
268
268
  v1[0] = "123.0"
269
269
 
270
- with self.assertRaisesRegex(
271
- TypeError, r"Expected to assign a slice from a sequence of values but got `int` instead"
272
- ):
273
- v1[:] = 123
274
-
275
270
  with self.assertRaisesRegex(
276
271
  TypeError, r"Expected to assign a slice from a sequence of `int32` values but got `vec3i` instead"
277
272
  ):
@@ -483,26 +478,11 @@ class TestTypes(unittest.TestCase):
483
478
  with self.assertRaisesRegex(TypeError, r"Expected to assign a `float16` value but got `str` instead"):
484
479
  m[0][0] = "123.0"
485
480
 
486
- with self.assertRaisesRegex(
487
- TypeError, r"Expected to assign a slice from a sequence of values but got `int` instead"
488
- ):
489
- m[0] = 123
490
-
491
481
  with self.assertRaisesRegex(
492
482
  TypeError, r"Expected to assign a slice from a sequence of `float16` values but got `mat22h` instead"
493
483
  ):
494
484
  m[0] = (m,)
495
485
 
496
- with self.assertRaisesRegex(
497
- KeyError, r"Slices are not supported when indexing matrices using the `m\[start:end\]` notation"
498
- ):
499
- m[:] = 123
500
-
501
- with self.assertRaisesRegex(
502
- KeyError, r"Slices are not supported when indexing matrices using the `m\[i, j\]` notation"
503
- ):
504
- m[0, :1] = (123,)
505
-
506
486
  with self.assertRaisesRegex(ValueError, r"Can only assign sequence of same size"):
507
487
  m[0][:1] = (1, 2)
508
488