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

[SYCL] Fix compilation warnings in libdevice #1630

Merged
merged 1 commit into from
May 2, 2020

Conversation

fwyzard
Copy link
Contributor

@fwyzard fwyzard commented May 1, 2020

Apply the DEVICE_EXERNAL attribute also to the function definitions,
not only to the function declarations.

Signed-off-by: Andrea Bocci andrea.bocci@cern.ch

@fwyzard fwyzard requested review from asavonic and vzakhari as code owners May 1, 2020 21:38
@fwyzard
Copy link
Contributor Author

fwyzard commented May 1, 2020

Fixes compilation warnings like

In file included from libdevice/fallback-cassert.cpp:9:
libdevice/wrapper.h:16:1: warning: attribute declaration must precede definition [-Wignored-attributes]
DEVICE_EXTERNAL size_t __spirv_GlobalInvocationId_x();
^
libdevice/device.h:28:54: note: expanded from macro 'DEVICE_EXTERNAL'                                                                                                                                                                              
#define DEVICE_EXTERNAL SYCL_EXTERNAL __attribute__((weak))
                                                    ^
libdevice/spirv_vars.hpp:32:29: note: previous definition is here                                                                                                                                                                                  
SYCL_EXTERNAL inline size_t __spirv_GlobalInvocationId_x() {
                           ^

repeated for lines 17, 18, 20, 21, 22.

@fwyzard
Copy link
Contributor Author

fwyzard commented May 1, 2020

Passes make checl-sycl-devicelib and make check-sycl-cuda-devicelib locally.

@fwyzard
Copy link
Contributor Author

fwyzard commented May 1, 2020

On the other hand, this breaks building with make sycl-toolchain :-(

@fwyzard fwyzard changed the title [SYCL] Fix warnings in libdevice [SYCL] Fix compilation warnings in libdevice May 1, 2020
@vzakhari
Copy link
Contributor

vzakhari commented May 1, 2020

On the other hand, this breaks building with make sycl-toolchain :-(

I guess this is because spirv_vars.hpp is included before DEVICE_EXTERNAL is defined in device.h :-)

Apply the `DEVICE_EXERNAL` attribute also to the function definitions,
not only to the function declarations.

Signed-off-by: Andrea Bocci <andrea.bocci@cern.ch>
@fwyzard fwyzard force-pushed the fix_libdevice_warnings branch from e65de2f to e830bc7 Compare May 2, 2020 07:06
@fwyzard
Copy link
Contributor Author

fwyzard commented May 2, 2020

I guess this is because spirv_vars.hpp is included before DEVICE_EXTERNAL is defined in device.h :-)

Indeed, including it at the end seems to fix the compilation.

@fwyzard
Copy link
Contributor Author

fwyzard commented May 2, 2020

I am, however, a bit confused about libdevice:

  • device.h makes some check whether it is being used in a "C" or "C++" context; however it includes spirv_vars.hpp which is definitely C++ (use of templates, etc.)
  • libdevice doesn't seem to be installed by make deploy-sycl-toolchain
  • there is a different (bigger) spirv_vars.hpp under sycl/include/CL/__spirv/

Is libdevice still in fieri ?

@vzakhari
Copy link
Contributor

vzakhari commented May 2, 2020

I am, however, a bit confused about libdevice:

  • device.h makes some check whether it is being used in a "C" or "C++" context; however it includes spirv_vars.hpp which is definitely C++ (use of templates, etc.)
  • libdevice doesn't seem to be installed by make deploy-sycl-toolchain
  • there is a different (bigger) spirv_vars.hpp under sycl/include/CL/__spirv/

Is libdevice still in fieri ?

Yes, it is pretty much WIP, especially after we moved it to toplevel. I am moving spirv_vars.hpp include from device.h to wrapper.h, and making some other clean-up with the goal to minimize dependencies on SYCL. It has to be mostly SPIR library...

I will try deploy-sycl-toolchain, but from what I see here https://github.com/intel/llvm/blob/sycl/sycl/CMakeLists.txt#L292 and here https://github.com/intel/llvm/blob/sycl/libdevice/cmake/modules/SYCLLibdevice.cmake#L163 it has to be deployed.

@fwyzard
Copy link
Contributor Author

fwyzard commented May 2, 2020

from what I see here https://github.com/intel/llvm/blob/sycl/sycl/CMakeLists.txt#L292 and here https://github.com/intel/llvm/blob/sycl/libdevice/cmake/modules/SYCLLibdevice.cmake#L163 it has to be deployed.

What files should I look for in the installation directory ?

@vzakhari
Copy link
Contributor

vzakhari commented May 2, 2020

from what I see here https://github.com/intel/llvm/blob/sycl/sycl/CMakeLists.txt#L292 and here https://github.com/intel/llvm/blob/sycl/libdevice/cmake/modules/SYCLLibdevice.cmake#L163 it has to be deployed.

What files should I look for in the installation directory ?

Files like these:
install/lib/libsycl-glibc.o
install/lib/libsycl-fallback-cassert.spv

@fwyzard
Copy link
Contributor Author

fwyzard commented May 2, 2020

Files like these:
install/lib/libsycl-glibc.o
install/lib/libsycl-fallback-cassert.spv

Thanks, then yes, they are installed by make deploy-sycl-toolchain, I see

install/lib64/libsycl-cmath-fp64.o
install/lib64/libsycl-cmath.o
install/lib64/libsycl-complex-fp64.o
install/lib64/libsycl-complex.o
install/lib64/libsycl-fallback-cassert.spv
install/lib64/libsycl-fallback-cmath-fp64.spv
install/lib64/libsycl-fallback-cmath.spv
install/lib64/libsycl-fallback-complex-fp64.spv
install/lib64/libsycl-fallback-complex.spv
install/lib64/libsycl-glibc.o

@bader bader merged commit 277f315 into intel:sycl May 2, 2020
@fwyzard fwyzard deleted the fix_libdevice_warnings branch May 2, 2020 13:24
alexbatashev pushed a commit to alexbatashev/llvm that referenced this pull request May 6, 2020
…_docs

* origin/sycl: (6482 commits)
  [SYCL][NFC] Clean formatting in Markdown documents (intel#1635)
  [SYCL][Doc] Remove obsolete parens from README (intel#1637)
  [SYCL] Fix failing ABI tests when LLVM_LIBDIR_SUFFIX is set (intel#1605)
  [SYCL] Fix warnings in libdevice (intel#1630)
  [SYCL][CUDA] Triage and clean LIT (intel#1620)
  [SYCL][NFC] Fix GCC 8 compilation warnings (intel#1631)
  [SYCL] Minor fixes in LowerWGScope
  [SYCL] PI: correct default interoperability plugin selection
  [SYCL] Add faster reduction implementations using atomic or/and intel::reduce() (intel#1615)
  [SYCL] Add sycl-ls utility for listing devices discovered/selected by SYCL RT (intel#1575)
  [SYCL] Fix getDeviceFromHandler declarations (intel#1626)
  [SPIR-V] Correct/improve declaration of SPIR-V builtins (intel#1519)
  [SYCL][USM] Improve USM allocator test and fix improper behavior. (intel#1538)
  [SYCL] Fix failing ABI LITs (intel#1622)
  [SYCL] Add support for MSVC internal math functions in device library (intel#1441)
  [SYCL] Add runtime library versioning (intel#1604)
  [SYCL] Check weak symbols in ABI dumps (intel#1609)
  [NFC][SYCL] Improve kernel metadata test (intel#1610)
  Revert "[SYCL] XFAIL LIT test due to duplicate diagnostic" (intel#1460)
  [SYCL] Move the reduction command group funcs out of handler.hpp (intel#1602)
  ...
preethi-intel pushed a commit to preethi-intel/llvm that referenced this pull request Oct 5, 2022
While running OpenCL-CTS SPIR-V subtests, i found that launching llvm-spirv with arguments:

-r --spec-const=101:i64:4609589727908835759

results in error message:

Error: Invalid value for '-spec-const' option! In "101:i64:4609589727908835759": can't convert "4609589727908835759" to 64-bit integer number

However, 4609589727908835759 fits into 64bits (0x3ff88d6f544bb1af). The problem seems to be that getNumWords() returns 2 so i changed it to use getActiveBits().

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

Successfully merging this pull request may close these issues.

3 participants