intel / intel/llvm

Use of undeclared identifier 'tex2D' when compile SYCL code using Interoperability Mode

Open
#15,951 0 comments 0 reactions 0 assignees View on GitHub
bug cuda
Dominant language
LLVM
Stars
1.5k
Forks
854
Avg merge
3d 17h
Merged PRs (30d)
137

Description

### Describe the bug

I tried to use SYCL's Interoperability Mode to compile sycl code that contains some CUDA API with following command:
```bash
icpx -fsycl -fsycl-targets=nvptx64-nvidia-cuda tex2d.cpp -o tex2d_sycl -I/usr/local/cuda/include -L/usr/local/cuda/lib64 -lcudart
```
everything works fine except it cannot find tex2D.
```bash
error: use of undeclared identifier 'tex2D'
```

### To reproduce

```cpp
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include

int main() {

cudaArray_t cuArray;
cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc();
cudaMallocArray(&cuArray, &channelDesc, 2, 2);

cudaTextureObject_t textureObj{0L};
cudaResourceDesc resDesc{};

resDesc.resType = cudaResourceTypeArray;
resDesc.res.array.array = cuArray;

cudaTextureDesc texDesc{};
texDesc.addressMode[0] = cudaAddressModeClamp;
texDesc.addressMode[1] = cudaAddressModeClamp;
texDesc.filterMode = cudaFilterModePoint;
texDesc.normalizedCoords = false;
texDesc.readMode = cudaReadModeElementType;

cudaTextureObject_t tex = cudaCreateTextureObject(&textureObj, &resDesc, &texDesc, nullptr);

float result = tex2D(tex, 0.0f, 0.0f);
return 0;
}
```

### Environment

- OS: Ubuntu 22.04.5 LTS
- Target device and vendor: Nvidia GPU
- DPC++ version: Intel(R) oneAPI DPC++/C++ Compiler 2024.2.0 (2024.2.0.20240602)
- Dependencies version:
NVIDIA-SMI 535.183.06 Driver Version: 535.183.06 CUDA Version: 12.2
Version : CUDA 12.2
Name : NVIDIA CUDA BACKEND
Vendor : NVIDIA Corporation
Devices : 1
Device [#0]:
Type : gpu
Version : 5.2
Name : NVIDIA GeForce GTX 980 Ti
Vendor : NVIDIA Corporation
Driver : CUDA 12.2

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.