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

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

Open
ArberSephirotheca opened this issue Oct 31, 2024 · 0 comments
Labels
bug Something isn't working cuda CUDA back-end

Comments

@ArberSephirotheca
Copy link

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

@ArberSephirotheca ArberSephirotheca added bug Something isn't working cuda CUDA back-end labels Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cuda CUDA back-end
Projects
None yet
Development

No branches or pull requests

1 participant