Repository navigation
Upgrading to Warp 1.16 #168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
massimim
wants to merge
12
commits into
Autodesk:main
Choose a base branch
from
massimim:upgrading-warp
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1d6b1fa
Port to Warp 1.16 (update4) API for Neon backend
massimim dd0674f
Port examples/tests to Warp 1.16 API; restore wp.Mesh retention
massimim 9bf1751
Fix mat33-from-vectors port: in-kernel constructor builds COLUMNS
massimim d916170
Disable Warp backward (adjoint) codegen for all Warp-using backends
massimim 1bb15fc
Add enable_backward option to xlb.init()
massimim d5f5511
Compare sharding specs to PartitionSpec, not tuples
massimim 2e3ee78
Satisfy ruff: suppress fallback device error, tidy vector call
massimim 745dc8b
Add per-backend test environment runner and Neon backend tests
massimim 64a2e86
Stop [neon] installs from pulling warp-lang
massimim 36a1655
Pin the [warp] extra to the Warp 1.16 series
massimim 907ee2c
Allow Warp 1.17 in the [warp] extra as well as 1.16
massimim 21ab989
Point [neon] extra at neon_gpu 0.5.2a5 (Warp update5 wheels)
massimim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| """ | ||
| Smoke coverage for the Neon compute backend. | ||
|
|
||
| The rest of the suite only exercises the JAX and WARP backends, and | ||
| ``tests/install/flow_past_sphere_3d_test.py`` skips Neon because the sphere's | ||
| ``HalfwayBounceBackBC`` has no Neon implementation. These tests cover the parts | ||
| of the Neon path that need no boundary condition: ``neon.init()`` registering | ||
| XLB's custom Warp types for NVRTC, grid and field allocation, the device-side | ||
| fill and host read-back, and operator kernel construction. | ||
|
|
||
| Skipped when ``neon`` is missing (an env built with the ``[warp]`` extra rather | ||
| than ``[neon]``) or when no CUDA device is available. | ||
| """ | ||
|
|
||
| import pytest | ||
|
|
||
| neon = pytest.importorskip("neon", reason="neon_gpu is not installed; install XLB with the [neon] extra") | ||
|
|
||
| import warp as wp # noqa: E402 | ||
|
|
||
| import xlb # noqa: E402 | ||
| from xlb.compute_backend import ComputeBackend # noqa: E402 | ||
| from xlb.grid import grid_factory # noqa: E402 | ||
| from xlb.precision_policy import PrecisionPolicy # noqa: E402 | ||
|
|
||
| GRID_SHAPE = (16, 16, 16) | ||
| CARDINALITY = 19 | ||
| FILL_VALUE = 2.5 | ||
|
|
||
|
|
||
| @pytest.fixture(scope="module", autouse=True) | ||
| def neon_env(): | ||
| """Initialize XLB on the Neon backend once for the module. | ||
|
|
||
| ``xlb.init`` calls ``neon.init()``, which must run before any kernel using | ||
| Neon's custom types is built, so every test here shares one initialization. | ||
| """ | ||
| wp.init() | ||
| if wp.get_cuda_device_count() == 0: | ||
| pytest.skip("the Neon backend requires a CUDA device") | ||
|
|
||
| precision_policy = PrecisionPolicy.FP32FP32 | ||
| xlb.init( | ||
| velocity_set=xlb.velocity_set.D3Q19(precision_policy=precision_policy, compute_backend=ComputeBackend.NEON), | ||
| default_backend=ComputeBackend.NEON, | ||
| default_precision_policy=precision_policy, | ||
| ) | ||
|
|
||
|
|
||
| def test_neon_grid_shape(): | ||
| grid = grid_factory(GRID_SHAPE, compute_backend=ComputeBackend.NEON) | ||
| assert grid.shape == GRID_SHAPE, "Neon grid shape is incorrect" | ||
|
|
||
|
|
||
| def test_neon_field_cardinality(): | ||
| grid = grid_factory(GRID_SHAPE, compute_backend=ComputeBackend.NEON) | ||
| f = grid.create_field(cardinality=CARDINALITY) | ||
| assert f.cardinality == CARDINALITY, "Neon field cardinality is incorrect" | ||
|
|
||
|
|
||
| def test_neon_field_fill_value(): | ||
| """Fill on the device, then read back on the host. | ||
|
|
||
| Exercises allocation, the fill kernel, and the device-to-host transfer. | ||
| """ | ||
| grid = grid_factory(GRID_SHAPE, compute_backend=ComputeBackend.NEON) | ||
| f = grid.create_field(cardinality=CARDINALITY, fill_value=FILL_VALUE) | ||
| f.update_host(0) | ||
|
|
||
| for idx in (neon.Index_3d(0, 0, 0), neon.Index_3d(1, 2, 3), neon.Index_3d(*(d - 1 for d in GRID_SHAPE))): | ||
| for card in (0, CARDINALITY // 2, CARDINALITY - 1): | ||
| assert f.read(idx, card) == pytest.approx(FILL_VALUE), "Neon field not initialized with fill_value" | ||
|
|
||
|
|
||
| def test_neon_operator_kernel_construction(): | ||
| """Operators must produce a Neon functional and container, not Warp ones.""" | ||
| from xlb.operator.equilibrium import QuadraticEquilibrium | ||
|
|
||
| op = QuadraticEquilibrium(compute_backend=ComputeBackend.NEON) | ||
| assert op.neon_functional is not None, "Neon functional was not constructed" | ||
| assert op.neon_container is not None, "Neon container was not constructed" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it wp.vector or wp.types.vector ? I see both being used to replace wp.vec ! Can you please pick one and use that throughout