You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FEM first-sample interpolation returns zero gradients with triplet construction #1978
fem.interpolate() with reduction="first" and triplet construction produces the correct matrix but returns zero gradients, even with backward generation and gradient tracking enabled.
Minimal reproduction
Save as repro.py and run uv run repro.py from a built Warp checkout. This uses CPU only and requires no assets.
Triplet-based sparse FEM interpolation with reduction="first" now propagates gradients through the selected sample. Temporary triplet values inherit the destination matrix’s gradient requirement, and sample selection is completed before evaluation so backward replay reaches the selected contribution. The reporter authored the fix, so this issue can be closed.
Public API behavior
The existing Python fem.interpolate() API now produces the expected gradients when interpolating a trial field into a gradient-enabled sparse matrix with reduction="first" and triplet construction. No function signature or kernel-only API changed.
Test coverage
warp/tests/fem/test_fem_integrate.py::test_interpolate_first_gradient covers CPU and CUDA, triplet and row-compressed construction, compact and padded output, ordinary trial spaces, sparse point trials, skipped ineligible neighbors, and empty eligible slots.
Behavioral verification
The reported reproduction now returns loss=8.0 and gradient=4.0 on CPU, and the same targeted check passes on CUDA.
Activity
Link the FEM gradient fix to its issue (NVIDIAGH-1978)
hemnath-hub commentedon Sep 22, 2026
/assign
Link the FEM gradient fix to its issue (NVIDIAGH-1978)
Speed up BSR transpose and first-sample FEM construction [NVIDIAGH-1970…
shi-eric commentedon Sep 23, 2026
This is addressed by 85e3eea.
Triplet-based sparse FEM interpolation with
reduction="first"now propagates gradients through the selected sample. Temporary triplet values inherit the destination matrix’s gradient requirement, and sample selection is completed before evaluation so backward replay reaches the selected contribution. The reporter authored the fix, so this issue can be closed.Public API behavior
fem.interpolate()API now produces the expected gradients when interpolating a trial field into a gradient-enabled sparse matrix withreduction="first"and triplet construction. No function signature or kernel-only API changed.Test coverage
warp/tests/fem/test_fem_integrate.py::test_interpolate_first_gradientcovers CPU and CUDA, triplet and row-compressed construction, compact and padded output, ordinary trial spaces, sparse point trials, skipped ineligible neighbors, and empty eligible slots.Behavioral verification
The reported reproduction now returns
loss=8.0andgradient=4.0on CPU, and the same targeted check passes on CUDA.