Skip to content
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

ODR violation issue in 24.26.30049.6 #763

Open
bl4ckb0ne opened this issue Sep 10, 2024 · 9 comments
Open

ODR violation issue in 24.26.30049.6 #763

bl4ckb0ne opened this issue Sep 10, 2024 · 9 comments

Comments

@bl4ckb0ne
Copy link

Hi,

I'm currently packaging the project for Alpine Linux (see 1) and I'm encountering ODR violation issue at the end of the build. I picked this version because of issue with BMG and LUNARLAKE in the latest version.

Here's the logs:

ninja: job failed: : && /usr/bin/ccache /usr/lib/ccache/bin/g++ -fPIC -Os -fstack-clash-protection -Wformat -Werror=format-security -D_GLIBCXX_ASSERTIONS=1 -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -D_LIBCPP_ENABLE_HARDENED_MODE=1 -fno-plt -flto=auto -ffat-lto-objects -mindirect-branch=thunk -mfunction-return=thunk -mindirect-branch-register -ftemplate-depth=1024 -mclflushopt -mwaitpkg -Wall -Wempty-body -Wignored-qualifiers -Wtype-limits -Wuninitialized -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Winvalid-pch -Wno-unknown-pragmas -Wno-unused-local-typedefs -Wno-unused-but-set-variable -Wclobbered -Wimplicit-fallthrough=4 -Wno-noexcept-type -Werror -Werror=vla  -Wl,--as-needed,-O1,--sort-common -Wl,-z,pack-relative-relocs   -Wl,--version-script=/home/simon/aports/testing/intel-opencl-icd/src/compute-runtime-24.26.30049.6/build/igdrcl_lib_release/ocl.exports -Wl,-Bsymbolic -shared -Wl,-soname,libigdrcl.so -o bin/libigdrcl.so @CMakeFiles/igdrcl_dll.rsp && :
/usr/include/igdgmm/inc/umKmInc/../common/sku_wa.h:187:16: error: type 'struct _WA_TABLE' violates the C++ One Definition Rule [-Werror=odr]
  187 | typedef struct _WA_TABLE
      |                ^
/usr/include/igdgmm/inc/umKmInc/../common/sku_wa.h:187:16: note: a different type is defined in another translation unit
  187 | typedef struct _WA_TABLE
      |                ^
/usr/include/igdgmm/inc/umKmInc/../common/sku_wa.h:190:24: note: the first difference of corresponding definitions is field '<anonymous>'
  190 |         unsigned int : 0;
      |                        ^
/usr/include/igdgmm/inc/umKmInc/../common/sku_wa.h:190:24: note: a field of same name but different type is defined in another translation unit
  190 |         unsigned int : 0;
      |                        ^
/usr/include/igdgmm/GmmLib/inc/External/Common/GmmInfo.h:79:29: error: type 'struct Context' violates the C++ One Definition Rule [-Werror=odr]
   79 |     class NON_PAGED_SECTION Context : public GmmMemAllocator
      |                             ^
/usr/include/igdgmm/GmmLib/inc/External/Common/GmmInfo.h:79:29: note: a different type is defined in another translation unit
   79 |     class NON_PAGED_SECTION Context : public GmmMemAllocator
      |                             ^
/usr/include/igdgmm/GmmLib/inc/External/Common/GmmInfo.h:93:42: note: the first difference of corresponding definitions is field 'WaTable'
   93 |         WA_TABLE                         WaTable;
      |                                          ^
/usr/include/igdgmm/GmmLib/inc/External/Common/GmmInfo.h:93:42: note: a field of same name but different type is defined in another translation unit
   93 |         WA_TABLE                         WaTable;
      |                                          ^
/usr/include/igdgmm/GmmLib/inc/External/Common/GmmInfo.h:79:29: note: type 'struct WA_TABLE' itself violates the C++ One Definition Rule
   79 |     class NON_PAGED_SECTION Context : public GmmMemAllocator
      |                             ^
/home/simon/aports/testing/intel-opencl-icd/src/compute-runtime-24.26.30049.6/shared/source/os_interface/windows/sharedata_wrapper.h:102: error: type 'struct WA_TABLE_KMD' violates the C++ One Definition Rule [-Werror=odr]
  102 | struct WA_TABLE_KMD : WA_TABLE_GMM { // NOLINT(readability-identifier-naming)
/home/simon/aports/testing/intel-opencl-icd/src/compute-runtime-24.26.30049.6/shared/source/os_interface/windows/sharedata_wrapper.h:102: note: a type with different bases is defined in another translation unit
  102 | struct WA_TABLE_KMD : WA_TABLE_GMM { // NOLINT(readability-identifier-naming)
/usr/include/igdgmm/inc/umKmInc/sharedata.h:166: error: type 'struct _ADAPTER_INFO' violates the C++ One Definition Rule [-Werror=odr]
  166 | typedef struct _ADAPTER_INFO
/usr/include/igdgmm/inc/umKmInc/sharedata.h:166: note: a different type is defined in another translation unit
  166 | typedef struct _ADAPTER_INFO
/usr/include/igdgmm/inc/umKmInc/sharedata.h:172: note: the first difference of corresponding definitions is field 'WaTable'
  172 |     WA_TABLE                    WaTable;                // WA table
/usr/include/igdgmm/inc/umKmInc/sharedata.h:172: note: a field of same name but different type is defined in another translation unit
  172 |     WA_TABLE                    WaTable;                // WA table
/usr/include/igdgmm/inc/umKmInc/sharedata.h:166: note: type 'struct WA_TABLE' itself violates the C++ One Definition Rule
  166 | typedef struct _ADAPTER_INFO
/home/simon/aports/testing/intel-opencl-icd/src/compute-runtime-24.26.30049.6/shared/source/os_interface/windows/sharedata_wrapper.h:179: error: type 'struct ADAPTER_INFO_KMD' violates the C++ One Definition Rule [-Werror=odr]
  179 | struct ADAPTER_INFO_KMD : ADAPTER_INFO_GMM { // NOLINT(readability-identifier-naming)
/home/simon/aports/testing/intel-opencl-icd/src/compute-runtime-24.26.30049.6/shared/source/os_interface/windows/sharedata_wrapper.h:179: note: a type with different bases is defined in another translation unit
  179 | struct ADAPTER_INFO_KMD : ADAPTER_INFO_GMM { // NOLINT(readability-identifier-naming)
lto1: all warnings being treated as errors
lto-wrapper: fatal error: /usr/bin/g++ returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
ninja: subcommand failed

I noticed it's coming from the windows part but I'm building on Linux, is this caused by an error somewhere in CMake? The error also occurs with 24.22.29735.20, intel-gmmlib version is 22.5.1.

Thanks

@JablonskiMateusz
Copy link
Contributor

Hi @bl4ckb0ne
Windows part here may be related to WSL support. You may disable that by setting cmake flag DISABLE_WDDM_LINUX=1

@JablonskiMateusz
Copy link
Contributor

could you narrow-down which cpp files causes the definition mismatch ?

@bl4ckb0ne
Copy link
Author

@JablonskiMateusz still failing with -DDISABLE_WDDM_LINUX=ON, same error.

ninja: job failed: : && /usr/bin/ccache /usr/lib/ccache/bin/g++ -fPIC -Os -fstack-clash-protection -Wformat -Werror=format-security -D_GLIBCXX_ASSERTIONS=1 -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -D_LIBCPP_ENABLE_HARDENED_MODE=1 -fno-plt -flto=auto -ffat-lto-objects -mindirect-branch=thunk -mfunction-return=thunk -mindirect-branch-register -ftemplate-depth=1024 -mclflushopt -mwaitpkg -Wall -Wempty-body -Wignored-qualifiers -Wtype-limits -Wuninitialized -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Winvalid-pch -Wno-unknown-pragmas -Wno-unused-local-typedefs -Wno-unused-but-set-variable -Wclobbered -Wimplicit-fallthrough=4 -Wno-noexcept-type -Werror -Werror=vla  -Wl,--as-needed,-O1,--sort-common -Wl,-z,pack-relative-relocs   -Wl,--version-script=/home/simon/aports/testing/intel-opencl-icd/src/compute-runtime-24.26.30049.6/build/igdrcl_lib_release/ocl.exports -Wl,-Bsymbolic -shared -Wl,-soname,libigdrcl.so -o bin/libigdrcl.so @CMakeFiles/igdrcl_dll.rsp && :
/usr/include/igdgmm/GmmLib/inc/../../inc/umKmInc/../common/sku_wa.h:187:16: error: type 'struct _WA_TABLE' violates the C++ One Definition Rule [-Werror=odr]
  187 | typedef struct _WA_TABLE
      |                ^
/usr/include/igdgmm/GmmLib/inc/../../inc/umKmInc/../common/sku_wa.h:187:16: note: a different type is defined in another translation unit
  187 | typedef struct _WA_TABLE
      |                ^
/usr/include/igdgmm/GmmLib/inc/../../inc/umKmInc/../common/sku_wa.h:190:24: note: the first difference of corresponding definitions is field '<anonymous>'
  190 |         unsigned int : 0;
      |                        ^
/usr/include/igdgmm/GmmLib/inc/../../inc/umKmInc/../common/sku_wa.h:190:24: note: a field of same name but different type is defined in another translation unit
  190 |         unsigned int : 0;
      |                        ^
/usr/include/igdgmm/GmmLib/inc/External/Common/GmmInfo.h:79:29: error: type 'struct Context' violates the C++ One Definition Rule [-Werror=odr]
   79 |     class NON_PAGED_SECTION Context : public GmmMemAllocator
      |                             ^
/usr/include/igdgmm/GmmLib/inc/External/Common/GmmInfo.h:79:29: note: a different type is defined in another translation unit
   79 |     class NON_PAGED_SECTION Context : public GmmMemAllocator
      |                             ^
/usr/include/igdgmm/GmmLib/inc/External/Common/GmmInfo.h:93:42: note: the first difference of corresponding definitions is field 'WaTable'
   93 |         WA_TABLE                         WaTable;
      |                                          ^
/usr/include/igdgmm/GmmLib/inc/External/Common/GmmInfo.h:93:42: note: a field of same name but different type is defined in another translation unit
   93 |         WA_TABLE                         WaTable;
      |                                          ^
/usr/include/igdgmm/GmmLib/inc/External/Common/GmmInfo.h:79:29: note: type 'struct WA_TABLE' itself violates the C++ One Definition Rule
   79 |     class NON_PAGED_SECTION Context : public GmmMemAllocator
      |                             ^
lto1: all warnings being treated as errors
lto-wrapper: fatal error: /usr/bin/g++ returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
ninja: subcommand failed

Seems to happen during linking, could it be an issue with LTO?

@bl4ckb0ne
Copy link
Author

I tried the option -DNEO_DISABLE_LD_GOLD:BOOL=ON like the arch package does and got more log

ninja: job failed: : && /usr/bin/ccache /usr/lib/ccache/bin/g++ -fPIC -Os -fstack-clash-protection -Wformat -Werror=format-security -D_GLIBCXX_ASSERTIONS=1 -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -D_LIBCPP_ENABLE_HARDENED_MODE=1 -fno-plt -flto=auto -ffat-lto-objects -mindirect-branch=thunk -mfunction-return=thunk -mindirect-branch-register -ftemplate-depth=1024 -mclflushopt -mwaitpkg -Wall -Wempty-body -Wignored-qualifiers -Wtype-limits -Wuninitialized -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Winvalid-pch -Wno-unknown-pragmas -Wno-unused-local-typedefs -Wno-unused-but-set-variable -Wclobbered -Wimplicit-fallthrough=4 -Wno-noexcept-type -Werror -Werror=vla -fpermissive -fPIC  -Wl,--as-needed,-O1,--sort-common -Wl,-z,pack-relative-relocs   -Wl,--version-script=/home/simon/aports/testing/intel-opencl-icd/src/compute-runtime-24.26.30049.6/level_zero/core/source/dll/linux/ze.exports -shared -Wl,-soname,libze_intel_gpu.so.1 -o bin/libze_intel_gpu.so.1.3.30049 @CMakeFiles/ze_intel_gpu.rsp && :
lto1: fatal error: Cannot open shared/source/built_ins/CMakeFiles/builtins_binaries_bindful.dir/__/__/__/bin/built_ins/x64/gen11/bindful_copy_buffer_to_image3d_11_1_0.cpp.o
compilation terminated.
lto-wrapper: fatal error: /usr/bin/g++ returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
ninja: job failed: : && /usr/bin/ccache /usr/lib/ccache/bin/g++ -fPIC -Os -fstack-clash-protection -Wformat -Werror=format-security -D_GLIBCXX_ASSERTIONS=1 -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -D_LIBCPP_ENABLE_HARDENED_MODE=1 -fno-plt -flto=auto -ffat-lto-objects -mindirect-branch=thunk -mfunction-return=thunk -mindirect-branch-register -ftemplate-depth=1024 -mclflushopt -mwaitpkg -Wall -Wempty-body -Wignored-qualifiers -Wtype-limits -Wuninitialized -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Winvalid-pch -Wno-unknown-pragmas -Wno-unused-local-typedefs -Wno-unused-but-set-variable -Wclobbered -Wimplicit-fallthrough=4 -Wno-noexcept-type -Werror -Werror=vla  -Wl,--as-needed,-O1,--sort-common -Wl,-z,pack-relative-relocs   -Wl,--version-script=/home/simon/aports/testing/intel-opencl-icd/src/compute-runtime-24.26.30049.6/build/igdrcl_lib_release/ocl.exports -Wl,-Bsymbolic -shared -Wl,-soname,libigdrcl.so -o bin/libigdrcl.so @CMakeFiles/igdrcl_dll.rsp && :
/usr/include/igdgmm/GmmLib/inc/../../inc/umKmInc/../common/sku_wa.h:187:16: error: type 'struct _WA_TABLE' violates the C++ One Definition Rule [-Werror=odr]
  187 | typedef struct _WA_TABLE
      |                ^
/usr/include/igdgmm/GmmLib/inc/../../inc/umKmInc/../common/sku_wa.h:187:16: note: a different type is defined in another translation unit
  187 | typedef struct _WA_TABLE
      |                ^
/usr/include/igdgmm/GmmLib/inc/../../inc/umKmInc/../common/sku_wa.h:190:24: note: the first difference of corresponding definitions is field '<anonymous>'
  190 |         unsigned int : 0;
      |                        ^
/usr/include/igdgmm/GmmLib/inc/../../inc/umKmInc/../common/sku_wa.h:190:24: note: a field of same name but different type is defined in another translation unit
  190 |         unsigned int : 0;
      |                        ^
/usr/include/igdgmm/GmmLib/inc/External/Common/GmmInfo.h:79:29: error: type 'struct Context' violates the C++ One Definition Rule [-Werror=odr]
   79 |     class NON_PAGED_SECTION Context : public GmmMemAllocator
      |                             ^
/usr/include/igdgmm/GmmLib/inc/External/Common/GmmInfo.h:79:29: note: a different type is defined in another translation unit
   79 |     class NON_PAGED_SECTION Context : public GmmMemAllocator
      |                             ^
/usr/include/igdgmm/GmmLib/inc/External/Common/GmmInfo.h:93:42: note: the first difference of corresponding definitions is field 'WaTable'
   93 |         WA_TABLE                         WaTable;
      |                                          ^
/usr/include/igdgmm/GmmLib/inc/External/Common/GmmInfo.h:93:42: note: a field of same name but different type is defined in another translation unit
   93 |         WA_TABLE                        ninja: job failed: : && /usr/bin/ccache /usr/lib/ccache/bin/g++ -fPIC -Os -fstack-clash-protection -Wformat -Werror=format-security -D_GLIBCXX_ASSERTIONS=1 -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -D_LIBCPP_ENABLE_HARDENED_MODE=1 -fno-plt -flto=auto -ffat-lto-objects -mindirect-branch=thunk -mfunction-return=thunk -mindirect-branch-register -ftemplate-depth=1024 -mclflushopt -mwaitpkg -Wall -Wempty-body -Wignored-qualifiers -Wtype-limits -Wuninitialized -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Winvalid-pch -Wno-unknown-pragmas -Wno-unused-local-typedefs -Wno-unused-but-set-variable -Wclobbered -Wimplicit-fallthrough=4 -Wno-noexcept-type -Werror -Werror=vla -fpermissive -fPIC  -Wl,--as-needed,-O1,--sort-common -Wl,-z,pack-relative-relocs   -Wl,--version-script=/home/simon/aports/testing/intel-opencl-icd/src/compute-runtime-24.26.30049.6/level_zero/core/source/dll/linux/ze.exports -shared -Wl,-soname,libze_intel_gpu.so.1 -o bin/libze_intel_gpu.so.1.3.30049 @CMakeFiles/ze_intel_gpu.rsp && :
lto1: fatal error: Cannot open shared/source/built_ins/CMakeFiles/builtins_binaries_bindful.dir/__/__/__/bin/built_ins/x64/gen11/bindful_copy_buffer_to_image3d_11_1_0.cpp.o
compilation terminated.
lto-wrapper: fatal error: /usr/bin/g++ returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
ninja: job failed: : && /usr/bin/ccache /usr/lib/ccache/bin/g++ -fPIC -Os -fstack-clash-protection -Wformat -Werror=format-security -D_GLIBCXX_ASSERTIONS=1 -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -D_LIBCPP_ENABLE_HARDENED_MODE=1 -fno-plt -flto=auto -ffat-lto-objects -mindirect-branch=thunk -mfunction-return=thunk -mindirect-branch-register -ftemplate-depth=1024 -mclflushopt -mwaitpkg -Wall -Wempty-body -Wignored-qualifiers -Wtype-limits -Wuninitialized -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Winvalid-pch -Wno-unknown-pragmas -Wno-unused-local-typedefs -Wno-unused-but-set-variable -Wclobbered -Wimplicit-fallthrough=4 -Wno-noexcept-type -Werror -Werror=vla  -Wl,--as-needed,-O1,--sort-common -Wl,-z,pack-relative-relocs   -Wl,--version-script=/home/simon/aports/testing/intel-opencl-icd/src/compute-runtime-24.26.30049.6/build/igdrcl_lib_release/ocl.exports -Wl,-Bsymbolic -shared -Wl,-soname,libigdrcl.so -o bin/libigdrcl.so @CMakeFiles/igdrcl_dll.rsp && :
/usr/include/igdgmm/GmmLib/inc/../../inc/umKmInc/../common/sku_wa.h:187:16: error: type 'struct _WA_TABLE' violates the C++ One Definition Rule [-Werror=odr]
  187 | typedef struct _WA_TABLE
      |                ^
/usr/include/igdgmm/GmmLib/inc/../../inc/umKmInc/../common/sku_wa.h:187:16: note: a different type is defined in another translation unit
  187 | typedef struct _WA_TABLE
      |                ^
/usr/include/igdgmm/GmmLib/inc/../../inc/umKmInc/../common/sku_wa.h:190:24: note: the first difference of corresponding definitions is field '<anonymous>'
  190 |         unsigned int : 0;
      |                        ^
/usr/include/igdgmm/GmmLib/inc/../../inc/umKmInc/../common/sku_wa.h:190:24: note: a field of same name but different type is defined in another translation unit
  190 |         unsigned int : 0;
      |                        ^
/usr/include/igdgmm/GmmLib/inc/External/Common/GmmInfo.h:79:29: error: type 'struct Context' violates the C++ One Definition Rule [-Werror=odr]
   79 |     class NON_PAGED_SECTION Context : public GmmMemAllocator
      |                             ^
/usr/include/igdgmm/GmmLib/inc/External/Common/GmmInfo.h:79:29: note: a different type is defined in another translation unit
   79 |     class NON_PAGED_SECTION Context : public GmmMemAllocator
      |                             ^
/usr/include/igdgmm/GmmLib/inc/External/Common/GmmInfo.h:93:42: note: the first difference of corresponding definitions is field 'WaTable'
   93 |         WA_TABLE                         WaTable;
      |                                          ^
/usr/include/igdgmm/GmmLib/inc/External/Common/GmmInfo.h:93:42: note: a field of same name but different type is defined in another translation unit
   93 |         WA_TABLE                         WaTable;
      |                                          ^
/usr/include/igdgmm/GmmLib/inc/External/Common/GmmInfo.h:79:29: note: type 'struct WA_TABLE' itself violates the C++ One Definition Rule
   79 |     class NON_PAGED_SECTION Context : public GmmMemAllocator
      |                             ^
lto1: all warnings being treated as errors
lto-wrapper: fatal error: /usr/bin/g++ returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
ninja: subcommands failed WaTable;
      |                                          ^
/usr/include/igdgmm/GmmLib/inc/External/Common/GmmInfo.h:79:29: note: type 'struct WA_TABLE' itself violates the C++ One Definition Rule
   79 |     class NON_PAGED_SECTION Context : public GmmMemAllocator
      |                             ^
lto1: all warnings being treated as errors
lto-wrapper: fatal error: /usr/bin/g++ returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
ninja: subcommands failed

@bl4ckb0ne
Copy link
Author

-DNEO_DISABLE_LTO=ON worked!

@JablonskiMateusz
Copy link
Contributor

@bl4ckb0ne build with LTO is optional, can be disabled with the flag you mentioned. However I still wonder which cpp files introduced conflicting definitions. Based on the log you shared:

/usr/include/igdgmm/GmmLib/inc/../../inc/umKmInc/../common/sku_wa.h:190:24: note: the first difference of corresponding definitions is field ''
190 | unsigned int : 0;
| ^
/usr/include/igdgmm/GmmLib/inc/../../inc/umKmInc/../common/sku_wa.h:190:24: note: a field of same name but different type is defined in another translation unit
190 | unsigned int : 0;

it is difference on unsigned int definition

@JablonskiMateusz
Copy link
Contributor

could you try to patch sku_wa.h to remove unsigned int : 0; lines?

@bl4ckb0ne
Copy link
Author

@JablonskiMateusz
Copy link
Contributor

@johnmach please take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants