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

cbrt ufuncs does not work for dpnp #1295

Open
ZzEeKkAa opened this issue Jan 24, 2024 · 0 comments
Open

cbrt ufuncs does not work for dpnp #1295

ZzEeKkAa opened this issue Jan 24, 2024 · 0 comments
Labels
bug Something isn't working enhancement New feature or request kernel API About @numba_dpex.kernel decorator

Comments

@ZzEeKkAa
Copy link
Contributor

ZzEeKkAa commented Jan 24, 2024

Reproduction

  1. Add these lines to the end at numba_dpex/tests/dpjit_tests/parfors/test_dpnp_ufuncs.py:
if __name__ == "__main__":
    test_unary_ops("cbrt",dpnp.float32)
  1. Comment out cbrt from _unsupported at numba_dpex/core/typing/dpnpdecl.py
  2. Run
ONEAPI_DEVICE_SELECTOR=opencl:cpu python -m numba_dpex.tests.dpjit_tests.parfors.test_dpnp_ufuncs
  1. Output:
numba.core.errors.TypingError: Failed in dpex_kernel_nopython mode pipeline (step: numba_dpex qualified name disambiguation)
Failed in nopython mode pipeline (step: nopython frontend)
No implementation of function Function(<function np_real_cbrt_impl.<locals>.cbrt at 0x7f0f545c1940>) found for signature:

 >>> cbrt(float32)

There are 2 candidate implementations:
  - Of which 2 did not match due to:
  Overload in function 'register_jitable.<locals>.wrap.<locals>.ov_wrap': File: numba/core/extending.py: Line 161.
    With argument(s): '(float64)':
   Rejected as the implementation raised a specific error:
     KeyError: <class 'numba_dpex.core.targets.kernel_target.SyclDevice'>
  raised from /home/yevhenii/Projects/numba/numba/core/registry.py:100

During: resolving callee type: Function(<function np_real_cbrt_impl.<locals>.cbrt at 0x7f6e67bd9300>)
During: typing of call at /home/yevhenii/Projects/numba/numba/np/npyfuncs.py (839)


File "../numba/numba/np/npyfuncs.py", line 839:
    def _cbrt(x):
        <source elided>
            return np.nan
        return cbrt(x)
        ^

During: lowering "$expr_out_var.12 = call $8load_deref.1.14($arg_out_var.13, func=$8load_deref.1.14, args=[Var($arg_out_var.13, test_dpnp_ufuncs.py:169)], kws=(), vararg=None, varkwarg=None, target=None)" at /home/yevhenii/Projects/numba-dpex/numba_dpex/tests/dpjit_tests/parfors/test_dpnp_ufuncs.py (169)

Possible cause of issue

cbrt is defined with @register_jitable(fastmath=True) which may be not registered at kernel target.

Numba version

Equivalent code for numba+numpy works okay:

    import numba
    import numpy as np

    @numba.njit
    def func(a):
        return np.cbrt(a)
    
    a = np.ones(10)

    print(func(a))

Found in #1283

@ZzEeKkAa ZzEeKkAa added bug Something isn't working enhancement New feature or request kernel API About @numba_dpex.kernel decorator labels Jan 24, 2024
@ZzEeKkAa ZzEeKkAa changed the title cbrt ufuncs not working for dpnp cbrt ufuncs does not work for dpnp Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request kernel API About @numba_dpex.kernel decorator
Projects
None yet
Development

No branches or pull requests

1 participant