Giter VIP home page Giter VIP logo

Comments (4)

kobalicek avatar kobalicek commented on July 22, 2024

Thanks for this report!

I think this is not about the file, but it's about the flags, from the command line:

-ftree-vectorize true -mavx512bw

I think this is caused by running cmake with:

 -DBLEND2D_CFLAGS_AVX512=true

BLEND2D_CFLAGS_AVX512 cannot actually be a boolean value, it's internally set to contain compiler flags that enable AVX-512 compilation. You should not need to set that manually.

If you want to force Blend2D to be built with AVX-512 flags by default (which would imply it would not be able to run on machines without AVX-512), you would have to use the actual flags, like:

cmake <options> -DCMAKE_CXX_FLAGS=-mavx512vl

Can you retry?

from blend2d.

squrky avatar squrky commented on July 22, 2024

Ah yes, I see my mistake. For the benefit of people skimming this issue, the following error message was confusing (to me):

c++.exe: warning: true: linker input file unused because linking not done

The "true" in this error, as you pointed out @kobalicek, is relating to the bad cmake argument -DBLEND2D_CFLAGS_AVX512=true making it all the way to the build line.

The build works perfectly fine without this flag 👍. My initial motivation was to ensure that we get all the nice SIMD/AVX codepaths when compiling under MinGW-w64, and I wasn't sure if that would be the case by default. Looking again at CMakeLists.txt it seems that you have dedicated logic for this in the fallback case when the compiler isn't MSVC.

MinGW-w64 support is vital for people like me who want to build their projects for Windows, Linux (and Mac) while also targetting a single compiler like GCC or Clang. Targetting GCC/Clang as well as MSVC in a single codebase leads to some highly unpleasant workaraounds for the differences in C++ dialect supported by each compiler. Would you be persuaded to explicitly support MinGW-w64, and to make a note to this effect in your build instructions?

Thanks for this epic library, I'm looking forward to really getting stuck in!

from blend2d.

kobalicek avatar kobalicek commented on July 22, 2024

@squrky The build system has two cases - MSVC and GCC/Clang, but there is no preference in terms of which compiler to use (I prefer clang, but you can use any of GCC, clang, and MSVC). So GCC should be perfectly fine across platforms and you should get all the optimizations that Blend2D provides with GCC. In your case the flags detection works:

-- Performing Test __CxxFlag__mavx
-- Performing Test __CxxFlag__mavx - Success
-- Performing Test __CxxFlag__mavx2
-- Performing Test __CxxFlag__mavx2 - Success
-- Performing Test __CxxFlag__mavx512bw__mavx512dq__mavx512cd__mavx512vl
-- Performing Test __CxxFlag__mavx512bw__mavx512dq__mavx512cd__mavx512vl - Success

These will be used by SIMD accelerated functions, but these only affect C++ code. JIT always uses the best extensions, so even if C++ code is not compiled with AVX-512 support, JIT will still use it if detected.

So, this leads to my question - what is currently not supported when using MinGW? Or maybe, what do you think should be added to build instructions?

I agree that when compiling with GCC there is a bunch of warnings that I don't like. In master branch I have disabled loop annotations when compiling with GCC so you won't get the "warning: ignoring loop annotation" (this warning for some reason cannot be just turned off). The other warnings look like GCC has a problem in diagnostics in this case as the code is not using uninitialized values (and clang doesn't report these).

I think the best would be to add MINGW to CI, but I didn't want to spend much time on that myself.

from blend2d.

squrky avatar squrky commented on July 22, 2024

So, this leads to my question - what is currently not supported when using MinGW? Or maybe, what do you think should be added to build instructions?

I have a better understanding of how the build logic works now: You lump MinGW in with any other Clang/GCC platform and thus it should work without any special handling. That sounds like the right approach 👍. It wasn't totally clear from the build instructions when SIMD/AVX acceleration would be compiled in, I assumed (incorrectly) that I would need to explicitly enable those so that I would get the best possible performance out of the box. Thanks for clarifying.

I agree that when compiling with GCC there is a bunch of warnings that I don't like

This was just for reference, I didn't see anything nasty in the code.

I think the best would be to add MINGW to CI, but I didn't want to spend much time on that myself.

Totally fair. I have no idea what that entails, maybe someone will come along and submit a PR for that, maybe I will one day 🤷

I'm taking the liberty to close this issue because you have completely explained the problem I was having. Thanks again.

from blend2d.

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.