acts-project / vecmem

Vectorised data model base and helper classes.
https://acts-project.github.io/vecmem/
Mozilla Public License 2.0
19 stars 13 forks source link

SYCL Symbol Visibility Issue on Windows, main branch (2024.08.03.) #289

Open krasznaa opened 3 months ago

krasznaa commented 3 months ago

While doing some tests on Windows with the latest version of the code, I ran into the following warnings during the build:

...
[ 70%] Building SYCL object sycl/CMakeFiles/vecmem_sycl.dir/src/memory/memory_resource_base.sycl.obj
icx-cl: warning: unknown argument ignored in clang-cl: '-fvisibility-ms-compat' [-Wunknown-argument]
[ 71%] Building SYCL object sycl/CMakeFiles/vecmem_sycl.dir/src/memory/device_memory_resource.sycl.obj
icx-cl: warning: unknown argument ignored in clang-cl: '-fvisibility-ms-compat' [-Wunknown-argument]
[ 71%] Building SYCL object sycl/CMakeFiles/vecmem_sycl.dir/src/memory/host_memory_resource.sycl.obj
icx-cl: warning: unknown argument ignored in clang-cl: '-fvisibility-ms-compat' [-Wunknown-argument]
[ 71%] Building SYCL object sycl/CMakeFiles/vecmem_sycl.dir/src/memory/shared_memory_resource.sycl.obj
icx-cl: warning: unknown argument ignored in clang-cl: '-fvisibility-ms-compat' [-Wunknown-argument]
[ 72%] Building SYCL object sycl/CMakeFiles/vecmem_sycl.dir/src/utils/sycl/copy.sycl.obj
icx-cl: warning: unknown argument ignored in clang-cl: '-fvisibility-ms-compat' [-Wunknown-argument]
[ 72%] Building SYCL object sycl/CMakeFiles/vecmem_sycl.dir/src/utils/sycl/async_copy.sycl.obj
icx-cl: warning: unknown argument ignored in clang-cl: '-fvisibility-ms-compat' [-Wunknown-argument]
[ 73%] Building SYCL object sycl/CMakeFiles/vecmem_sycl.dir/src/utils/sycl/queue_wrapper.sycl.obj
icx-cl: warning: unknown argument ignored in clang-cl: '-fvisibility-ms-compat' [-Wunknown-argument]
[ 73%] Building SYCL object sycl/CMakeFiles/vecmem_sycl.dir/src/utils/sycl/get_queue.sycl.obj
icx-cl: warning: unknown argument ignored in clang-cl: '-fvisibility-ms-compat' [-Wunknown-argument]
[ 73%] Linking SYCL shared library ..\bin\vecmem_sycl.dll
...

So, #282's setup is not working perfectly with this combination of compilers. (MSVC + oneAPI) The failure is not fatal, but it would be nice to get rid of these warnings... šŸ¤”

krasznaa commented 3 months ago

Unfortunately I don't have any good ideas about this right now. šŸ˜¦

The issue is that icx-cl.exe on Windows treats unrecognized command line options as warnings. So the VECMEM_HAVE_SYCL_VISIBILITY_MS_COMPAT test succeeds.

When settings -DVECMEM_FAIL_ON_WARNINGS=TRUE, the VECMEM_HAVE_SYCL_VISIBILITY_MS_COMPAT test fails all of a sudden, as it should. So the build in the end succeeds with both -DVECMEM_FAIL_ON_WARNINGS=TRUE and -DVECMEM_FAIL_ON_WARNINGS=FALSE. We "just" get some pesky warnings in one case.

If we're willing to require a newer CMake version as a minimum, it could be possible to make this code behave a bit better. But with the current minimum I can just not find the right incantation of testing the usage of -fvisibility-ms-compat and -Werror at the same time with try_compile(...). šŸ˜¦

So I'll let this one go to sleep for now...