Skip to content

[BUG] wp.svd2 returns NaN in U and V #679

Closed

Description

@akrivx

Bug Description

There seems to be an issue with the wp.svd2 function, which consistently returns NaN values in the U and V matrices. Even for a simple diagonal input, U and V are filled with NaNs, although singular values appear correctly computed.

Minimal Reproducible Example

import warp as wp
wp.init()

@wp.kernel
def test_svd2(U: wp.array(dtype=wp.mat22), s: wp.array(dtype=wp.vec2), V: wp.array(dtype=wp.mat22)):
    U2 = wp.mat22()
    V2 = wp.mat22()
    s2 = wp.vec2()
    wp.svd2(wp.diag(wp.vec2(2.0)), U2, s2, V2)
    U[0] = U2
    s[0] = s2
    V[0] = V2

U = wp.zeros(1, dtype=wp.mat22)
V = wp.zeros(1, dtype=wp.mat22)
s = wp.zeros(1, dtype=wp.vec2)

wp.launch(kernel=test_svd2, dim=1, inputs=[U, s, V])

print("U:", U)
print("V:", V)
print("s:", s)

Observed Output

U: [[[nan nan]
     [nan nan]]]
V: [[[nan nan]
     [nan nan]]]
s: [[2. 2.]]

Expected Behaviour

U and V should contain valid orthogonal matrices (no NaNs) resulting from the decomposition of a simple diagonal matrix.

System Information

  • NVIDIA Warp Version: 1.6.2
  • CUDA Version: CUDA Toolkit 12.8, Driver 12.9
  • GPU Model: NVIDIA GeForce RTX 5080
  • Python Version: 3.12.

Activity

  1. added
    bug
    on Apr 24, 2025
  2. added theissue type on Apr 30, 2025
  3. added this to the 1.7.2 milestone on May 5, 2025
  4. added 2 commits that reference this issue on May 6, 2025
    6f0b1c2
    93e3dd1
  5. shi-eric commented on May 7, 2025

    @shi-eric
    Contributor

    @gdaviet added improvements to wp.svd2 which should address the issue reported here. It's available in the main branch already and will be available in future nightly builds. See 6f0b1c2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions