Skip to content

[SYCL] Target ordering breaks compilation  #3631

@Michoumichmich

Description

@Michoumichmich

Describe the bug
When build for CUDA and CPU targets with -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice,nvptx64-nvidia-cuda-sycldevice everything works fine. But when targets are swapped there's an error.

To Reproduce

With SPIR64 first, it works

clang++ -fsycl -fsycl-unnamed-lambda  -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice,nvptx64-nvidia-cuda-sycldevice matrix_mult.dp.cpp
clang-13: warning: Unknown CUDA version. cuda.h: CUDA_VERSION=11030. Assuming the latest supported version 10.1 [-Wunknown-cuda-version]
Platform name: Intel(R) OpenCL
[...]
OpenCL program binary file was successfully created: /tmp/matrix_mult-242693.out

But with CUDA first it does not find the library.

clang++ -fsycl -fsycl-unnamed-lambda  -fsycl-targets=nvptx64-nvidia-cuda-sycldevice,spir64_x86_64-unknown-unknown-sycldevice matrix_mult.dp.cpp           
clang-13: warning: Unknown CUDA version. cuda.h: CUDA_VERSION=11030. Assuming the latest supported version 10.1 [-Wunknown-cuda-version]
clang-13: error: cannot find libdevice for . Provide path to different CUDA installation via --cuda-path, or pass -nocudalib to build without linking with libdevice.

I'm aware that I'm using an unsupported version of CUDA, but still think the behaviour is strange. Especially a week ago this same swap was causing the compiler to crash.

Environment:

  • OS: RHEL 8-3
  • Target device and vendor: Intel CPU, Nvidia GTX 1660 Ti (sm_75)
  • DPC++ version: clang version 13.0.0 (https://github.com/intel/llvm b52f203)
  • Dependencies version:
    [opencl:0] CPU : Intel(R) OpenCL 2.1 [2021.11.3.0.17_160000]
    [cuda:0] GPU : NVIDIA CUDA BACKEND 0.0 [CUDA 11.3]
    [host:0] HOST: SYCL host platform 1.2 [1.2]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcompilerCompiler related issuecudaCUDA back-end

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions