Git Product home page Git Product logo

Comments (13)

AgnerF avatar AgnerF commented on July 17, 2024

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.

ndesh26 avatar ndesh26 commented on July 17, 2024

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.

AgnerF avatar AgnerF commented on July 17, 2024

I have fixed _Float16 constants everywhere. Does it work now?

from version2.

ndesh26 avatar ndesh26 commented on July 17, 2024

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.

AgnerF avatar AgnerF commented on July 17, 2024

I don't understande the note: initializing argument 1 of ‘Vec8h::Vec8h(Float16)’
I have fixed the other warnings.

from version2.

ndesh26 avatar ndesh26 commented on July 17, 2024

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.

AgnerF avatar AgnerF commented on July 17, 2024

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.

AgnerF avatar AgnerF commented on July 17, 2024

I have submitted a bug report to gcc:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111897

from version2.

ndesh26 avatar ndesh26 commented on July 17, 2024

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.

AgnerF avatar AgnerF commented on July 17, 2024

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.

ndesh26 avatar ndesh26 commented on July 17, 2024

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.

AgnerF avatar AgnerF commented on July 17, 2024

Fixed. Thank you. Is everything working now?

from version2.

ndesh26 avatar ndesh26 commented on July 17, 2024

Fixed. Thank you. Is everything working now?

Yes. Thanks for the help!

from version2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.