Coder Social home page Coder Social logo

Build failure on G++13.2 about hlslpp HOT 11 CLOSED

kokulshan avatar kokulshan commented on September 26, 2024
Build failure on G++13.2

from hlslpp.

Comments (11)

redorav avatar redorav commented on September 26, 2024

Could you try -std=C++20 instead of GNU? Or even some other version of C++. The code in question is the swizzle code, which contains the copy assignment operator inside a union. In the past I've had some issues but this is essential to supporting swizzles, at least the way they work at the moment. For reference, this is the bit of code it's complaining about (and other similar code)

HLSLPP_WARNING_ANONYMOUS_STRUCT_UNION_BEGIN
struct
{
	union 
	{
		#include "swizzle/hlsl++_matrix_row0_1.h"
		#include "swizzle/hlsl++_matrix_row0_2.h"
		#include "swizzle/hlsl++_matrix_row0_3.h"
		#include "swizzle/hlsl++_matrix_row0_4.h"
	};

	union
	{
		#include "swizzle/hlsl++_matrix_row1_1.h"
		#include "swizzle/hlsl++_matrix_row1_2.h"
		#include "swizzle/hlsl++_matrix_row1_3.h"
		#include "swizzle/hlsl++_matrix_row1_4.h"
	};
};
HLSLPP_WARNING_ANONYMOUS_STRUCT_UNION_END

from hlslpp.

kokulshan avatar kokulshan commented on September 26, 2024

Setting it to -std=c++20 doesn't seem to change the error. It is still there. I have been searching the G++ docs to see if there is a way I can force G++ to just accept it because MSVC 17.8 and Clang 17 all accept it.

from hlslpp.

redorav avatar redorav commented on September 26, 2024

I also have a GCC automated build going so not entirely sure what might be tripping it up. I don't know what version AppVeyor uses though, I could take a look. I've also noticed I named it GGC

from hlslpp.

kokulshan avatar kokulshan commented on September 26, 2024

It is also an issue on g++ 11.4.0 which is the OS compiler for Ubuntu 22.04:

g++ -v

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.4.0-1ubuntu122.04' --with --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1
22.04)

from hlslpp.

redorav avatar redorav commented on September 26, 2024

Can you give something a try locally? Run ./Linux.sh in the main hlsl++repo, then go to workspace/gmake2 and run make all in there. I'd be curious to see what you get. I have run that locally in Ubuntu and it seems to all compile fine. My version of gcc is 11.4.0 there too

from hlslpp.

kokulshan avatar kokulshan commented on September 26, 2024

Okay that worked. I am now suspecting that CMake is doing something somewhere. I will investigate deeper and get back to you.

from hlslpp.

kokulshan avatar kokulshan commented on September 26, 2024

Okay I figured it out. It was not actually g++, it was CMake outputting a cppcheck complaint about the header but making it look like it was g++ outputting it. I apologize for the confusion.

from hlslpp.

kokulshan avatar kokulshan commented on September 26, 2024

Actually it was not cppcheck. I narrowed it down to one flag I was using: -mavx2 because I was targeting AVX2 CPUs with my code. Removing makes the error go away. Is there a way for me to use this flag without it triggering this error?

from hlslpp.

redorav avatar redorav commented on September 26, 2024

I see what's going on, this isn't being tested in the build matrix, it's a bit unexpected and I'm not sure how to fix it. Apparently, while GCC is happy to have members with constructors inside an anonymous union, it cannot have members with constructors inside an anonymous struct for some reason.

The reason this only fails with AVX is that we don't use anonymous structs with swizzles inside anywhere else, but this is needed to ensure the swizzles align with the m256 data inside the matrix, i.e.

union
{
    m256 data;
    struct
    {
        swizzle0;
        swizzle1;
    }:
}

I don't really know in what other way to express what I need to happen other than that. Giving the struct a name defeats the entire purpose of this which is to access the swizzles. Do you want to use the AVX2 capabilities of hlsl++ or just use the flag in general? It should be possible to add a define to disable this and force hlsl++ to not use AVX, thereby avoiding the problem. It's a bit sad but perhaps an acceptable workaround.

from hlslpp.

kokulshan avatar kokulshan commented on September 26, 2024

I think I am okay with HLSL++ not using AVX2. GCC is used as just another compiler to verify our code, we build our production code with clang. I will just enable the scalar implementation for HLSL++ for GCC.

from hlslpp.

redorav avatar redorav commented on September 26, 2024

I want to test an alternate solution to the problem in any case, as you're happy with your solution I'll consider this closed. Let me know if there's any other issues with it, thanks!

from hlslpp.

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.