-
Notifications
You must be signed in to change notification settings - Fork 20
[MOD-6775] introduce fp16 type! #462
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
Changes from all commits
6858240
ef2c719
26088bf
fce1754
55ef50f
4eb7056
8cd5673
29bbd7e
2525371
ac17793
775c41c
f94d731
db2521d
0edd29d
4369584
29c1773
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -11,8 +11,12 @@ | |||||
#include <cmath> | ||||||
|
||||||
namespace vecsim_types { | ||||||
|
||||||
using bfloat16 = unsigned short; | ||||||
struct bfloat16 { | ||||||
uint16_t val; | ||||||
bfloat16() = default; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a compiler version issue? How come it works with fp16? Can we try this option?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. declaring a default ctor as constexpr is allowed as of c++20, and this feature in particular is supported as of gcc10 |
||||||
constexpr bfloat16(uint16_t val) : val(val) {} | ||||||
operator uint16_t() const { return val; } | ||||||
}; | ||||||
|
||||||
static inline bfloat16 float_to_bf16(const float ff) { | ||||||
uint32_t *p_f32 = (uint32_t *)&ff; | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does this function get a void pointer that is always null? can we just not pass it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was part of the optimization bit map refactor
It was left mainly for testing purposes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider cleaning it now? I don't think it is needed for the test either (unless we suspect the hardware will change between calls)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we pass a specific optimization in the tests to enforce lower optimization
see test_spaces.cpp