Skip to content

[SYCL][RT] cpuid.h assumed but missing on non-x86 #2304

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

Closed
jeffhammond opened this issue Aug 12, 2020 · 2 comments
Closed

[SYCL][RT] cpuid.h assumed but missing on non-x86 #2304

jeffhammond opened this issue Aug 12, 2020 · 2 comments

Comments

@jeffhammond
Copy link
Contributor

cpuid.h is assumed to exist in sycl/source/detail/platform_util.cpp and that file in general assumes x86 features.

Given that LLVM supports "all the architectures", I wonder if there is a way to reuse code from other LLVM components to make the SYCL RT architecture agnostic.

Source

sycl/source/detail/platform_util.cpp

#if defined(SYCL_RT_OS_LINUX)
#include <cpuid.h>
#elif defined(SYCL_RT_OS_WINDOWS)
#include <intrin.h>
#endif

Build error

FAILED: tools/sycl/source/CMakeFiles/sycl_object.dir/detail/platform_util.cpp.o 
/usr/bin/c++  -DCL_TARGET_OPENCL_VERSION=220 -DXPTI_ENABLE_INSTRUMENTATION -DXPTI_STATIC_LIBRARY -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/sycl/source -I/home/ubuntu/ISYCL/llvm/sycl/source -Iinclude -I/home/ubuntu/ISYCL/llvm/llvm/include -I/home/ubuntu/ISYCL/llvm/xpti/include -I/home/ubuntu/ISYCL/llvm/sycl/include -Itools/sycl/OpenCL/inc -fPIC -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -Wextra -Wno-deprecated-declarations -O3    -UNDEBUG -fvisibility=hidden -fvisibility-inlines-hidden -std=c++14 -MD -MT tools/sycl/source/CMakeFiles/sycl_object.dir/detail/platform_util.cpp.o -MF tools/sycl/source/CMakeFiles/sycl_object.dir/detail/platform_util.cpp.o.d -o tools/sycl/source/CMakeFiles/sycl_object.dir/detail/platform_util.cpp.o -c /home/ubuntu/ISYCL/llvm/sycl/source/detail/platform_util.cpp
/home/ubuntu/ISYCL/llvm/sycl/source/detail/platform_util.cpp:14:10: fatal error: cpuid.h: No such file or directory
   14 | #include <cpuid.h>
      |          ^~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "../llvm/buildbot/compile.py", line 65, in <module>
    ret = main()
  File "../llvm/buildbot/compile.py", line 61, in main
    return do_compile(args)
  File "../llvm/buildbot/compile.py", line 39, in do_compile
    subprocess.check_call(cmake_cmd, cwd=abs_obj_dir)
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '/home/ubuntu/ISYCL/llvm/build', '--', 'deploy-sycl-toolchain', 'deploy-opencl-aot', '-j', '1']' returned non-zero exit status 1.
@jeffhammond
Copy link
Contributor Author

I am working on this, but it's slow-going, given that I can do one LLVM build a day.

@jbrodman
Copy link
Contributor

Relevant to #4 and #5

bader pushed a commit that referenced this issue Aug 17, 2020
This has been tested on Raspberry Pi 4 and Cavium ThunderX2 running Ubuntu AArch64.  The build also depends on my fixes for #2304, but those are not ready.  Nonetheless, this fix is independent of that one and can be merged without side effects.

There is a clearly a more general solution here, but it seems imprudent to add architectures to the buildbot testing until they have actually been tested somewhere.  Once I have a chance to test on PowerPC, I'll see about adding that as an explicit target, or provide a more general solution (e.g. `--arch=..`).

Signed-off-by: Jeff R. Hammond <[email protected]>
jsji pushed a commit that referenced this issue Feb 1, 2024
The goal of the PR is to add API to SPIR-V LLVM Translator to query error message by an error code as discussed in #2298

A need and possible application is a way to generate human-readable error info by error codes returned by other SPIRV Translator API calls, including getSpirvReport().

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@afe1971
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