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

@@ -390,9 +390,9 @@ def compute_gfx_vertices(
390
390
  gfx_vertices: wp.array(dtype=float, ndim=2),
391
391
  ):
392
392
  tid = wp.tid()
393
- v0 = vertices[indices[tid, 0]] * scale[0]
394
- v1 = vertices[indices[tid, 1]] * scale[1]
395
- v2 = vertices[indices[tid, 2]] * scale[2]
393
+ v0 = wp.cw_mul(vertices[indices[tid, 0]], scale)
394
+ v1 = wp.cw_mul(vertices[indices[tid, 1]], scale)
395
+ v2 = wp.cw_mul(vertices[indices[tid, 2]], scale)
396
396
  i = tid * 3
397
397
  j = i + 1
398
398
  k = i + 2
@@ -421,6 +421,7 @@ def compute_gfx_vertices(
421
421
  def compute_average_normals(
422
422
  indices: wp.array(dtype=int, ndim=2),
423
423
  vertices: wp.array(dtype=wp.vec3),
424
+ scale: wp.vec3,
424
425
  # outputs
425
426
  normals: wp.array(dtype=wp.vec3),
426
427
  faces_per_vertex: wp.array(dtype=int),
@@ -429,9 +430,9 @@ def compute_average_normals(
429
430
  i = indices[tid, 0]
430
431
  j = indices[tid, 1]
431
432
  k = indices[tid, 2]
432
- v0 = vertices[i]
433
- v1 = vertices[j]
434
- v2 = vertices[k]
433
+ v0 = wp.cw_mul(vertices[i], scale)
434
+ v1 = wp.cw_mul(vertices[j], scale)
435
+ v2 = wp.cw_mul(vertices[k], scale)
435
436
  n = wp.normalize(wp.cross(v1 - v0, v2 - v0))
436
437
  wp.atomic_add(normals, i, n)
437
438
  wp.atomic_add(faces_per_vertex, i, 1)
@@ -446,15 +447,16 @@ def assemble_gfx_vertices(
446
447
  vertices: wp.array(dtype=wp.vec3, ndim=1),
447
448
  normals: wp.array(dtype=wp.vec3),
448
449
  faces_per_vertex: wp.array(dtype=int),
450
+ scale: wp.vec3,
449
451
  # outputs
450
452
  gfx_vertices: wp.array(dtype=float, ndim=2),
451
453
  ):
452
454
  tid = wp.tid()
453
455
  v = vertices[tid]
454
456
  n = normals[tid] / float(faces_per_vertex[tid])
455
- gfx_vertices[tid, 0] = v[0]
456
- gfx_vertices[tid, 1] = v[1]
457
- gfx_vertices[tid, 2] = v[2]
457
+ gfx_vertices[tid, 0] = v[0] * scale[0]
458
+ gfx_vertices[tid, 1] = v[1] * scale[1]
459
+ gfx_vertices[tid, 2] = v[2] * scale[2]
458
460
  gfx_vertices[tid, 3] = n[0]
459
461
  gfx_vertices[tid, 4] = n[1]
460
462
  gfx_vertices[tid, 5] = n[2]
@@ -3130,7 +3132,7 @@ Instances: {len(self._instances)}"""
3130
3132
  wp.launch(
3131
3133
  compute_average_normals,
3132
3134
  dim=idx_count,
3133
- inputs=[wp.array(indices, dtype=int), vertices],
3135
+ inputs=[wp.array(indices, dtype=int), vertices, scale],
3134
3136
  outputs=[normals, faces_per_vertex],
3135
3137
  record_tape=False,
3136
3138
  )
@@ -3138,7 +3140,7 @@ Instances: {len(self._instances)}"""
3138
3140
  wp.launch(
3139
3141
  assemble_gfx_vertices,
3140
3142
  dim=point_count,
3141
- inputs=[vertices, normals, faces_per_vertex],
3143
+ inputs=[vertices, normals, faces_per_vertex, scale],
3142
3144
  outputs=[gfx_vertices],
3143
3145
  record_tape=False,
3144
3146
  )
@@ -3149,7 +3151,7 @@ Instances: {len(self._instances)}"""
3149
3151
  wp.launch(
3150
3152
  compute_gfx_vertices,
3151
3153
  dim=idx_count,
3152
- inputs=[wp.array(indices, dtype=int), wp.array(points, dtype=wp.vec3)],
3154
+ inputs=[wp.array(indices, dtype=int), wp.array(points, dtype=wp.vec3), scale],
3153
3155
  outputs=[gfx_vertices],
3154
3156
  record_tape=False,
3155
3157
  )
warp/render/render_usd.py CHANGED
@@ -647,6 +647,7 @@ class UsdRenderer:
647
647
  mesh.GetDisplayColorAttr().Set(colors, self.time)
648
648
 
649
649
  self._shape_constructors[name] = UsdGeom.Mesh
650
+ self._shape_custom_scale[name] = scale
650
651
 
651
652
  if not is_template:
652
653
  _usd_set_xform(mesh, pos, rot, scale, self.time)
@@ -191,7 +191,44 @@ def test_hashgrid_inputs(test, device):
191
191
  assert_array_equal(counts_ndim, counts_ref)
192
192
 
193
193
 
194
+ def test_hashgrid_multiple_streams(test, device):
195
+ with wp.ScopedDevice(device):
196
+ points = particle_grid(16, 32, 16, (0.0, 0.3, 0.0), cell_radius * 0.25, 0.1)
197
+ points_ref = wp.array(points, dtype=wp.vec3)
198
+ counts_ref = wp.zeros(len(points), dtype=int)
199
+
200
+ grid_dim = 64
201
+ grid_ref = wp.HashGrid(grid_dim, grid_dim, grid_dim)
202
+ grid_ref.build(points_ref, cell_radius)
203
+
204
+ # get reference counts
205
+ wp.launch(kernel=count_neighbors, dim=len(points), inputs=[grid_ref.id, query_radius, points_ref, counts_ref])
206
+
207
+ # create multiple streams
208
+ num_streams = 10
209
+ streams = [wp.Stream(device=device) for _ in range(num_streams)]
210
+ counts_per_stream = [wp.zeros(len(points), dtype=int) for _ in range(num_streams)]
211
+
212
+ # test whether HashGrid and radix sort work with multiple streams without race conditions
213
+ for i in range(num_streams):
214
+ with wp.ScopedStream(streams[i]):
215
+ grid = wp.HashGrid(grid_dim, grid_dim, grid_dim)
216
+ grid.build(points_ref, cell_radius)
217
+
218
+ # get counts for this stream
219
+ wp.launch(
220
+ kernel=count_neighbors,
221
+ dim=len(points),
222
+ inputs=[grid.id, query_radius, points_ref, counts_per_stream[i]],
223
+ )
224
+
225
+ # run this loop after all streams are scheduled to ensure asynchronous behaviour above
226
+ for i in range(num_streams):
227
+ assert_array_equal(counts_per_stream[i], counts_ref)
228
+
229
+
194
230
  devices = get_test_devices()
231
+ cuda_devices = get_cuda_test_devices()
195
232
 
196
233
 
197
234
  class TestHashGrid(unittest.TestCase):
@@ -214,6 +251,7 @@ class TestHashGrid(unittest.TestCase):
214
251
 
215
252
  add_function_test(TestHashGrid, "test_hashgrid_query", test_hashgrid_query, devices=devices)
216
253
  add_function_test(TestHashGrid, "test_hashgrid_inputs", test_hashgrid_inputs, devices=devices)
254
+ add_function_test(TestHashGrid, "test_hashgrid_multiple_streams", test_hashgrid_multiple_streams, devices=cuda_devices)
217
255
 
218
256
 
219
257
  if __name__ == "__main__":