Comments (6)
Internally, @abduld mentioned "we do not support fp16 one it". He likely meant to post that comment in the spot on Linear so the comment would get synced externally/be visible here.
from mojo.
@abduld Why closing this?
from mojo.
This bug is only triggered if two (or more) floating point types other than float64
are used.
The nextafter
function is implemented roughly as follows:
fn nextafter(arg0: SIMD[type], arg1: SIMD[type]) -> SIMD[type]:
fn _float32_dispatch[...](...) -> ...: ...
fn _float64_dispatch[...](...) -> ...: ...
constrained[type.is_floating_point(), "input type must be floating point"]()
@parameter
if type is DType.float64:
return _simd_apply[_float64_dispatch](arg0, arg1)
else:
return _simd_apply[_float32_dispatch](arg0, arg1)
Types other than float32
fall into the else branch. This design pattern is prevalent in the standard library (e.g., math.mojo
), and we should fix it everywhere.
We could either cast other float types to f32
or f64
as a fallback or forbid them altogether using the constrained
function. I'm not sure which approach is preferred. CC: @abduld
from mojo.
Using test_nextafterDType.float16 alone seems to work fine. So neither falling back to float32 nor adding constrains sounds like the right solution to me.
from mojo.
I don't mean to ban them literally, rather we need to make clear in the implementation which one of the dispatches actually exists. If it does work, I suspect it works accidentally. For instance, atan2[float16]
produces the wrong result.
Again, it's hardly nextafter
's problem.
from mojo.
Good to know that. Any reasons for only two dispatches exist for now?
from mojo.
Related Issues (20)
- [Modular CLI] modular update mojo ends up in a segmentation fault HOT 1
- [Feature Request] [stdlib] [proposal] Unicode Indexing for `String` and buffer idx for `StringSlice` in `__getitem__` and `__setitem__` HOT 2
- [BUG] Get segmentation fault when build mojo and run it but don't get segmentation fault when run directly with mojo
- [BUG] stack_allocation fails HOT 1
- [Feature Request] Where clause alternative: "Composite Traits" `TraitVariant` (`|`) and `TraitUnion` (`&`)
- [BUG] Numpy imported into Mojo has inconsistent benchmarking results
- [Feature Request] Add benchmark for `Dict` and explore swiss table algorithm with SIMD probing HOT 6
- [Docs] Update Tensor docs
- [BUG] Cannot fold `__floordiv__` for `Int`
- [BUG] Python import not working - Linux|Conda HOT 1
- [Modular CLI][Documentation] modular --h and modular install -h do not list --install-version option
- Ability to Link to C Libraries
- [Docs] __new__ is not mentioned outside of the Change Log. HOT 1
- [stdlib] Allow `!r` in `String.format` HOT 1
- [stdlib][BUG] `InlineArray.__init__(inout self: Self, fill: ElementType)` compile-time SIGTERM when `size` parameter exceeds indeterministic value HOT 8
- [Feature Request] Rename `bit_ceil` and `bit_floor` to `closest_pow_2_ge` and `closest_pow_2_le`
- [Feature Request] Let `Variant` call methods without unwrapping the element when constrained on a trait
- [BUG][Compiler] Benchmark.Report does not calculate
- [BUG] Compiler seg fault (recursion related?) HOT 4
- [BUG] Parser accepts single `main` function without body
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mojo.