Comments (13)
Thanks for informing me. The message from gcc13 seems to contradict §5.7.3 in the referred document. It is strange that it accepts the line above, because both 1024 and 15 can be represented exactly in half precision type.
The code is intended to work whether Float16 or float16_t are supported by the compiler or not.
Can you please check which of the following solutions work:
const _Float16 bias(15);
const _Float16 bias{15};
const std::float16_t bias = 15.f;
const _Float16 bias = (_Float16)15.f;
const _Float16 bias = static_cast<_Float16 >(15.);
from version2.
All of the above solution work except for const std::float16_t bias = 15.f;
. Another solution is to use the f16
suffix: const _Float16 bias5 = 15.f16;
. You can easily check the output here.
from version2.
I have fixed _Float16 constants everywhere. Does it work now?
from version2.
Thanks for the quick updates. There is a compilation error in the current code in vectorfp16.h at line 2378 and 2464.
There are still other errors corresponding to conversions, which don't involve literals directly:
/home/ndesh/samsung/philippe/ExternalLib/vector-class-v2/vectorfp16.h: In function ‘Vec32h operator-(Vec32h, float)’:
/home/ndesh/samsung/philippe/ExternalLib/vector-class-v2/vectorfp16.h:1743:23: warning: converting to ‘_Float16’ from ‘float’ with greater conversion rank
1743 | return a - Vec32h(b);
| ^
And I also found errors in fp16e.h as well.
/home/ndesh/samsung/philippe/ExternalLib/vector-class-v2/vectorfp16e.h: In function ‘Vec8h operator-(Vec8h, float)’:
/home/ndesh/samsung/philippe/ExternalLib/vector-class-v2/vectorfp16e.h:677:22: warning: converting to ‘Float16’ {aka ‘_Float16’} from ‘float’ with greater conversion rank
677 | return a - Vec8h(b);
| ^
/home/ndesh/samsung/philippe/ExternalLib/vector-class-v2/vectorfp16e.h:256:19: note: initializing argument 1 of ‘Vec8h::Vec8h(Float16)’
256 | Vec8h(Float16 f) {
If you don't have access to gcc13 toolchain. I can create fixes for the build warnings.
from version2.
I don't understande the note: initializing argument 1 of ‘Vec8h::Vec8h(Float16)’
I have fixed the other warnings.
from version2.
The error is coming from the following function:
// vector operator - : subtract vector and scalar
static inline Vec8h operator - (Vec8h const a, float b) {
return a - Vec8h(b);
}
When calling the Vec8h constructor (which takes _Float16 as input) we are implicitly converting from float to _Float16 hence the conversion error.
from version2.
I know. I am referring to this note:
/home/ndesh/samsung/philippe/ExternalLib/vector-class-v2/vectorfp16e.h:256:19: note: initializing argument 1 of ‘Vec8h::Vec8h(Float16)’ 256 | Vec8h(Float16 f) {
from version2.
I have submitted a bug report to gcc:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111897
from version2.
I know. I am referring to this note:
/home/ndesh/samsung/philippe/ExternalLib/vector-class-v2/vectorfp16e.h:256:19: note: initializing argument 1 of ‘Vec8h::Vec8h(Float16)’ 256 | Vec8h(Float16 f) {
I think this might simply be referring to the location where the conversion happens (i.e. while initializing the first argument of the constructor). I think they need to change the working to make it more easier to understand.
from version2.
I have asked the C++ standards people, and it appears that gcc is right, but the example in the linked document is wrong.
I think everything is OK now.
from version2.
I have been waiting to get permission to contribute from the company, but it seems that it will take some time. I did have some more errors due to the use of some templated functions but the errors are too specific so I won't bother you with it anymore. I think we can close the issue.
The only thing is that there is build error with the latest code. If you can fix the build error in vectorfp16.h at line 2378 and 2464, then we can close this issue.
from version2.
Fixed. Thank you. Is everything working now?
from version2.
Fixed. Thank you. Is everything working now?
Yes. Thanks for the help!
from version2.
Related Issues (20)
- [hint] sse2neon HOT 1
- ...
- request to add horizontal_min/max without propagate NAN HOT 1
- blend16 clang jit HOT 5
- 64bit*64bit will be overflow HOT 4
- Any interest in using a build system ? HOT 2
- Vec4f SSE2 round returning incorrect values HOT 1
- Error when selecting betwen boolean vectors HOT 2
- nmul_sub and runtime gather functions HOT 2
- Issue with fmodulo on single precision with FMA/AVX2 (MSVS) HOT 2
- License terms HOT 1
- Lot of warning HOT 4
- Problem with optimization HOT 10
- vs2022 compilation error HOT 2
- Is better gather support possible? HOT 2
- Proposal - add CMake / Colcon support HOT 1
- Missing "static inline" on some half-precision functions HOT 1
- Save 2 instructions in vec32cb &load_bits(uint32_t) & co.
- Different set of instructions for non AV512 `extract` method for `Vec4f` HOT 3
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 version2.