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::is_compatible is declared but not defined #5561

Closed
al42and opened this issue Feb 12, 2022 · 1 comment
Closed

sycl::is_compatible is declared but not defined #5561

al42and opened this issue Feb 12, 2022 · 1 comment
Labels
bug Something isn't working confirmed

Comments

@al42and
Copy link
Contributor

al42and commented Feb 12, 2022

Describe the bug

The following function is declared in sycl/include/CL/sycl/kernel_bundle.hpp but is does not seem to be defined anywhere:

bool is_compatible(const std::vector<kernel_id> &kernelIds, const device &dev);

To Reproduce

Check IntelLLVM repo:

$ git grep -C2 is_compatible 
mlir/lib/Bindings/Python/DialectQuant.cpp-      "The bitwidth of the storage type of this quantized type.");
mlir/lib/Bindings/Python/DialectQuant.cpp-  quantizedType.def(
mlir/lib/Bindings/Python/DialectQuant.cpp:      "is_compatible_expressed_type",
mlir/lib/Bindings/Python/DialectQuant.cpp-      [](MlirType type, MlirType candidate) {
mlir/lib/Bindings/Python/DialectQuant.cpp-        return mlirQuantizedTypeIsCompatibleExpressedType(type, candidate);
--
mlir/python/mlir/_mlir_libs/_mlir/dialects/quant.pyi-  def storage_type_integral_width(self) -> int: ...
mlir/python/mlir/_mlir_libs/_mlir/dialects/quant.pyi-
mlir/python/mlir/_mlir_libs/_mlir/dialects/quant.pyi:  def is_compatible_expressed_type(self, candidate: Type) -> bool: ...
mlir/python/mlir/_mlir_libs/_mlir/dialects/quant.pyi-
mlir/python/mlir/_mlir_libs/_mlir/dialects/quant.pyi-  @property
--
sycl/include/CL/sycl/kernel_bundle.hpp-
sycl/include/CL/sycl/kernel_bundle.hpp-/////////////////////////
sycl/include/CL/sycl/kernel_bundle.hpp:// is_compatible API
sycl/include/CL/sycl/kernel_bundle.hpp-/////////////////////////
sycl/include/CL/sycl/kernel_bundle.hpp-
sycl/include/CL/sycl/kernel_bundle.hpp-/// \returns true if all of the kernels identified by KernelIDs are compatible
sycl/include/CL/sycl/kernel_bundle.hpp-/// with the device Dev.
sycl/include/CL/sycl/kernel_bundle.hpp:bool is_compatible(const std::vector<kernel_id> &KernelIDs, const device &Dev);
sycl/include/CL/sycl/kernel_bundle.hpp-
sycl/include/CL/sycl/kernel_bundle.hpp:template <typename KernelName> bool is_compatible(const device &Dev) {
sycl/include/CL/sycl/kernel_bundle.hpp:  return is_compatible({get_kernel_id<KernelName>()}, Dev);
sycl/include/CL/sycl/kernel_bundle.hpp-}
sycl/include/CL/sycl/kernel_bundle.hpp-

Try to compile a simple program:

#include <CL/sycl.hpp>

class Kernel;

int main() {
  for (const auto &dev : sycl::device::get_devices()) {
    bool deviceOk = sycl::is_compatible<Kernel>(dev);
    if (deviceOk) {
      sycl::queue q{dev};
      q.submit([&](sycl::handler &cgh) {
         cgh.parallel_for<Kernel>(sycl::range<1>{1}, [=](sycl::id<1> threadId) {
           int x = threadId[0];
         });
       }).wait_and_throw();
    }
  } 
  return 0;
} 
$ clang++ -fsycl is_compatible.cpp -o is_compatible
/usr/bin/ld: /tmp/iscompat-b856de.o: in function `bool cl::sycl::is_compatible<Kernel>(cl::sycl::device const&)':
iscompat-892a28.cpp:(.text._ZN2cl4sycl13is_compatibleI6KernelEEbRKNS0_6deviceE[_ZN2cl4sycl13is_compatibleI6KernelEEbRKNS0_6deviceE]+0x65): undefined reference to `cl::sycl::is_compatible(std::vector<cl::sycl::kernel_id, std::allocator<cl::sycl::kernel_id> > const&, cl::sycl::device const&)'
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)

Environment (please complete the following information):

  • OS: Ubuntu Linux 20.04.3
  • Target device and vendor: Intel GPU
  • DPC++ version: e211d73

Additional context

SYCL2020 reference: https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html#sec:interfaces.bundles.overview.synopsis

@al42and al42and added the bug Something isn't working label Feb 12, 2022
@AlexeySachkov AlexeySachkov self-assigned this Feb 14, 2022
@AlexeySachkov AlexeySachkov removed their assignment Feb 14, 2022
@al42and
Copy link
Contributor Author

al42and commented Nov 28, 2022

#7510 added the implementation. Some follow-up complaints in #7561 :)

@al42and al42and closed this as completed Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed
Projects
None yet
Development

No branches or pull requests

2 participants