Skip to content

Commit

Permalink
Merge branch 'ershi/release-1.5.1-final' into 'release-1.5'
Browse files Browse the repository at this point in the history
Finalize 1.5.1 Release

See merge request omniverse/warp!943
  • Loading branch information
shi-eric committed Jan 3, 2025
2 parents d1900e8 + ecc5496 commit 2961bd0
Show file tree
Hide file tree
Showing 11 changed files with 106 additions and 89 deletions.
2 changes: 1 addition & 1 deletion VERSION.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.1-rc.2
1.5.1
47 changes: 24 additions & 23 deletions docs/modules/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ Tile Primitives
:returns: A tile with ``shape=(m,n)`` and dtype the same as the source array


.. py:function:: tile_store(a: Array[Any], i: int32, t: Any) -> None
.. py:function:: tile_store(a: Array[Any], i: int32, t: Tile) -> None
Stores a 1D tile to a global memory array.

Expand All @@ -887,7 +887,7 @@ Tile Primitives
:param t: The source tile to store data from, must have the same dtype as the destination array


.. py:function:: tile_store(a: Array[Any], i: int32, j: int32, t: Any) -> None
.. py:function:: tile_store(a: Array[Any], i: int32, j: int32, t: Tile) -> None
:noindex:
:nocontentsentry:

Expand All @@ -901,7 +901,7 @@ Tile Primitives
:param t: The source tile to store data from, must have the same dtype as the destination array


.. py:function:: tile_atomic_add(a: Array[Any], x: int32, y: int32, t: Any) -> Tile
.. py:function:: tile_atomic_add(a: Array[Any], x: int32, y: int32, t: Tile) -> Tile
Atomically add a tile to the array `a`, each element will be updated atomically.

Expand Down Expand Up @@ -967,7 +967,7 @@ Tile Primitives
.. py:function:: untile(a: Any) -> Scalar
.. py:function:: untile(a: Tile) -> Scalar
Convert a Tile back to per-thread values.

Expand All @@ -991,7 +991,7 @@ Tile Primitives
t = wp.tile(i)*2
# convert back to per-thread values
s = wp.untile()
s = wp.untile(t)
print(s)
Expand Down Expand Up @@ -1038,7 +1038,7 @@ Tile Primitives
Broadcast a tile.

This method will attempt to broadcast the input tile ``a`` to the destination shape (m, n), broadcasting follows NumPy broadcast rules.
This function will attempt to broadcast the input tile ``a`` to the destination shape (m, n), broadcasting follows NumPy broadcast rules.

:param a: Tile to broadcast
:returns: Tile with broadcast ``shape=(m, n)``
Expand All @@ -1061,9 +1061,9 @@ Tile Primitives
t = wp.tile_ones(dtype=float, m=16, n=16)
s = wp.tile_sum(t)
print(t)
print(s)
wp.launch(compute, dim=[64], inputs=[])
wp.launch_tiled(compute, dim=[1], inputs=[], block_dim=64)
Prints:

Expand All @@ -1088,18 +1088,19 @@ Tile Primitives
@wp.kernel
def compute():
t = wp.tile_arange(start=--10, stop=10, dtype=float)
t = wp.tile_arange(64, 128)
s = wp.tile_min(t)
print(t)
print(s)
wp.launch(compute, dim=[64], inputs=[])
wp.launch_tiled(compute, dim=[1], inputs=[], block_dim=64)
Prints:

.. code-block:: text
tile(m=1, n=1, storage=register) = [[-10]]
tile(m=1, n=1, storage=register) = [[64 ]]
Expand All @@ -1118,23 +1119,23 @@ Tile Primitives
@wp.kernel
def compute():
t = wp.tile_arange(start=--10, stop=10, dtype=float)
s = wp.tile_min(t)
t = wp.tile_arange(64, 128)
s = wp.tile_max(t)
print(t)
print(s)
wp.launch(compute, dim=[64], inputs=[])
wp.launch_tiled(compute, dim=[1], inputs=[], block_dim=64)
Prints:

.. code-block:: text
tile(m=1, n=1, storage=register) = [[10]]
tile(m=1, n=1, storage=register) = [[127 ]]
.. py:function:: tile_reduce(op: Callable, a: Any) -> Tile
.. py:function:: tile_reduce(op: Callable, a: Tile) -> Tile
Apply a custom reduction operator across the tile.

Expand All @@ -1156,7 +1157,7 @@ Tile Primitives
print(s)
wp.launch(factorial, dim=[16], inputs=[], block_dim=16)
wp.launch_tiled(factorial, dim=[1], inputs=[], block_dim=16)
Prints:

Expand All @@ -1166,7 +1167,7 @@ Tile Primitives
.. py:function:: tile_map(op: Callable, a: Any) -> Tile
.. py:function:: tile_map(op: Callable, a: Tile) -> Tile
Apply a unary function onto the tile.

Expand All @@ -1188,7 +1189,7 @@ Tile Primitives
print(s)
wp.launch(compute, dim=[16], inputs=[])
wp.launch_tiled(compute, dim=[1], inputs=[], block_dim=16)
Prints:

Expand All @@ -1198,7 +1199,7 @@ Tile Primitives
.. py:function:: tile_map(op: Callable, a: Any, b: Any) -> Tile
.. py:function:: tile_map(op: Callable, a: Tile, b: Tile) -> Tile
:noindex:
:nocontentsentry:

Expand Down Expand Up @@ -1226,7 +1227,7 @@ Tile Primitives
print(s)
wp.launch(compute, dim=[16], inputs=[])
wp.launch_tiled(compute, dim=[1], inputs=[], block_dim=16)
Prints:

Expand Down
33 changes: 25 additions & 8 deletions docs/modules/tiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,42 @@ Inside kernels, tile operations are executed cooperatively across each block of

In the following example, we launch a grid of threads where each block is responsible for loading a row of data from a 2D array and computing its sum:

.. code:: python
.. testcode::

TILE_SIZE = wp.constant(256)
TILE_THREADS = 64

@wp.kernel
def compute(a: array2d(dtype=float))
def compute(a: wp.array2d(dtype=float), b: wp.array2d(dtype=float)):

# obtain our block index
i = wp.tid()

# load a row from global memory
t = wp.tile_load(array[i], i, TILE_SIZE)
t = wp.tile_load(a[i], 0, TILE_SIZE)

# cooperatively compute the sum of the tile elements; s is a 1x1 tile
s = wp.tile_sum(t)
...

wp.launch_tiled(compute, dim=[a.shape[0]], inputs=[a], block_dim=TILE_THREADS)
# store s in global memory
wp.tile_store(b[0], i, s)

N = 10

a_np = np.arange(N).reshape(-1, 1) * np.ones((1, 256), dtype=float)
a = wp.array(a_np, dtype=float)
b = wp.zeros((1,N), dtype=float)

wp.launch_tiled(compute, dim=[a.shape[0]], inputs=[a, b], block_dim=TILE_THREADS)

print(f"b = {b}")

.. testoutput::

b = [[ 0. 256. 512. 768. 1024. 1280. 1536. 1792. 2048. 2304.]]

Here, we have used the new :func:`warp.launch_tiled` function which assigns ``TILE_THREADS`` threads to each of the elements in the launch grid. Each block of ``TILE_THREADS`` threads then loads an entire row of 256 values from the global memory array and computes its sum (cooperatively).
Note that we loaded the row by writing ``t = wp.tile_load(a[i], 0, TILE_SIZE)`` but we could have used the equivalent statement ``t = wp.tile_load(a[0], i, TILE_SIZE)`` instead.


Tile Properties
Expand All @@ -55,7 +72,7 @@ In Warp, tile objects are 2D arrays of data where the tile elements may be scala
TILE_THREADS = 64
@wp.kernel
def compute(a: array2d(dtype=float))
def compute(a: array2d(dtype=float)):
# obtain our 2d block index
i, j = wp.tid()
Expand Down Expand Up @@ -213,7 +230,7 @@ Traditionally, Warp kernels are primarily written in the SIMT programming model,
TILE_THREADS = 64
@wp.kernel
def compute()
def compute():
i = wp.tid()
# perform some per-thread computation
Expand Down
2 changes: 1 addition & 1 deletion exts/omni.warp.core/config/extension.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
# Semantic Versioning is used: https://semver.org/
version = "1.5.1-rc.2"
version = "1.5.1"
authors = ["NVIDIA"]
title = "Warp Core"
description="The core Warp Python module"
Expand Down
2 changes: 1 addition & 1 deletion exts/omni.warp.core/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CHANGELOG

## [1.5.1-rc.2] - 2025-01-02
## [1.5.1] - 2025-01-02

### Added

Expand Down
4 changes: 2 additions & 2 deletions exts/omni.warp/config/extension.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
# Semantic Versioning is used: https://semver.org/
version = "1.5.1-rc.2"
version = "1.5.1"
authors = ["NVIDIA"]
title = "Warp"
description="Warp OmniGraph Nodes and Sample Scenes"
Expand Down Expand Up @@ -35,7 +35,7 @@ exclude = ["Ogn*Database.py", "*/ogn*"]
"omni.timeline" = {}
"omni.ui" = {optional = true}
"omni.usd" = {}
"omni.warp.core" = {version = "1.5.1-rc.2", exact = true}
"omni.warp.core" = {version = "1.5.1", exact = true}

[[python.module]]
name = "omni.warp._extension"
Expand Down
2 changes: 1 addition & 1 deletion exts/omni.warp/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CHANGELOG

## [1.5.1-rc.2] - 2025-01-02
## [1.5.1] - 2025-01-02

### Added

Expand Down
Loading

0 comments on commit 2961bd0

Please sign in to comment.