Use of undeclared identifier 'tex2D' when compile SYCL code using Interoperability Mode
Opened this issue · 0 comments
ArberSephirotheca commented
Describe the bug
I tried to use SYCL's Interoperability Mode to compile sycl code that contains some CUDA API with following command:
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.
error: use of undeclared identifier 'tex2D'
To reproduce
#include <sycl/sycl.hpp>
#include <dpct/dpct.hpp>
#include <cstdint>
#include <iostream>
#include <cassert>
#include <cuda_runtime.h>
#include <cmath>
#include <cuda.h>
#include <texture_indirect_functions.h>
#include <cuda_texture_types.h>
#include <texture_fetch_functions.h>
int main() {
cudaArray_t cuArray;
cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc<float>();
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<float>(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