warp
warp copied to clipboard
[BUG] isfinite(), isnan(), and isinf() should only accept float types
Bug Description
Currently wp.isfinite(), wp.isnan(), and isinf() accept integer scalars and vectors, which arguably does not produce useful results.
Arguments pro accepting integer arguments:
- Python does accept scalar integers for these math functions, but this appears to involve an implicit conversion, which Warp kernels do not support. Type safety is an exception to supporting Pythonic syntax and semantics in kernels, to facilitate translation to CUDA and preserve performance.
Arguments against accepting integer arguments:
- It requires ~100 function signatures which serve no practical purpose and slow down compilation.
- Other floating-point math functions (e.g.
wp.sqrt()) just acceptFloatarguments, even when Python (implicitly) also accepts integers.
@mmacklin any thoughts on this since it affects kernel syntax? I don't think there's a need for a deprecation warning since I doubt anyone was relying on this and it's trivial to work around.
Agree they seem to serve no real purpose - compatibility with Python may be useful though.
Would be good to know what 100 functions does to compile times before making a decision based on that though.