Skip to content
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

Investigate recent test failures, concurrent with upgrade of DPC++ to 2025.0.1 #1901

Closed
oleksandr-pavlyk opened this issue Nov 20, 2024 · 4 comments · Fixed by #1902
Closed

Comments

@oleksandr-pavlyk
Copy link
Collaborator

Consider snippet:

import dpctl.tensor as dpt

def test(n):
    x = dpt.arange(n*n, dtype="f4")
    m = dpt.ones(n*n, dtype="?")
    return dpt.all(x[m] == x)

Then

In [38]: [n for n in range(2, 265) if not test(n)]
Out[38]: [260, 261, 262, 263, 264]

In [39]: [n for n in range(2, 265) if not test(n)]
Out[39]: [256, 258, 259, 260, 261, 262, 263, 264]

In [40]: [n for n in range(2, 265) if not test(n)]
Out[40]: [257, 258, 259, 261, 262, 263]

The result is always empty for dpctl compiled with DPC++ 2025.0.0

@oleksandr-pavlyk
Copy link
Collaborator Author

With

def test4(n):
    m = dpt.ones(n*n, dtype="?")
    cumsum = dpt.zeros(n*n, dtype="i8")
    q = cumsum.sycl_queue
    q.wait()
    num = dpt._tensor_impl.mask_positions(mask=m, cumsum=cumsum, sycl_queue=q)
    return dpt.asnumpy(cumsum - dpt.arange(1, n*n+1, dtype=cumsum.dtype))

I get

In [87]: np.nonzero(test4(257))
Out[87]: (array([513, 514, 515]),)

In [88]: np.nonzero(test4(256))
Out[88]: (array([0, 1, 2, 3]),)

In [89]: np.nonzero(test4(255))
Out[89]: (array([], dtype=int64),)

In [90]: np.nonzero(test4(258))
Out[90]: (array([1028, 1029, 1030, 1031]),)

@oleksandr-pavlyk
Copy link
Collaborator Author

The same thing with

def test5(n):
    m = dpt.ones(n*n, dtype="i8")
    cumsum = dpt.cumulative_sum(m)
    return dpt.asnumpy(cumsum) - np.arange(1, n*n+1, dtype=cumsum.dtype)

v = test5(257)
ind, = np.nonzero(v)
print(ind, v[ind])  # outputs [513 514 515] [-514 -515 -516]

@oleksandr-pavlyk
Copy link
Collaborator Author

Seem to affect all data types:


In [10]: def test5(n, dt):
    ...:     x = dpt.ones(n*n, dtype=dt)
    ...:     cs = dpt.cumulative_sum(x)
    ...:     return dpt.asnumpy(cs) - np.arange(1, n*n+1, dtype=cs.dtype)
    ...:

In [11]: np.nonzero(test5(257, np.float32))
Out[11]: (array([513, 514, 515]),)

In [12]: np.nonzero(test5(257, np.uint64))
Out[12]: (array([513, 514, 515]),)

In [13]: np.nonzero(test5(257, np.int64))
Out[13]: (array([513, 514, 515]),)

@oleksandr-pavlyk oleksandr-pavlyk changed the title Investigate test failures with DPC++ 2025.0.1 Investigate recent test failures, concurrent with upgrade of DPC++ to 2025.0.1 Nov 20, 2024
@oleksandr-pavlyk
Copy link
Collaborator Author

This failure is not related to the upgrade in the compiler, rather I introduced it recently by a code change during code maintenance: #1896

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant