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

Support libdevice.frexp #5515

Open
isuruf opened this issue Jan 2, 2025 · 0 comments
Open

Support libdevice.frexp #5515

isuruf opened this issue Jan 2, 2025 · 0 comments

Comments

@isuruf
Copy link

isuruf commented Jan 2, 2025

Describe the issue

Currently I use the following, but it is suboptimal.

@triton.jit
def frexp(x):
    y = libdevice.ilogb(x) + 1
    exponent = tl.where(x == 0, 0, y)
    mantissa = tl.where(x == 0, 0, libdevice.ldexp(x, -y))
    return  mantissa, exponent

There is a libdevice function __nv_frexp https://docs.nvidia.com/cuda/archive/10.2/libdevice-users-guide/__nv_frexp.html but it has a pointer as an argument as there are two results. However the functions in libdevice.py all have a single output, so I'm not sure how to implement this triton.

Environment details

Triton: 3.1.0

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

No branches or pull requests

1 participant