Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

getting false negative error by SYCLomatic when migrating external CUDA host device function template

Abierto
#2,192 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
cpp
Área
compilers

Línea de trabajo

Comienza con el reproductor C++ proporcionado e inspecciona el tratamiento que hace SYCLomatic de las declaraciones de plantillas externas durante la migración de CUDA a SYCL. Compara la salida migrada con los diagnósticos del compilador indicados y el comportamiento de icpx; se considera terminado cuando el reproductor migra sin los errores de falso negativo.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug
Describe the bug

When I try to migrate the code containing extern template

#include <cuda_runtime.h>


template <typename Outtype>
class foo1{};

template <typename Out>
 __device__ __host__ foo1<Out> foo()
{

    return foo1<Out>{};
    
}


extern template foo1<float> foo();
extern template foo1<double> foo();

int main(){
    foo1<float> foo();
}

I got the following errors:

error: explicit instantiation of 'foo' does not refer to a function template, variable template, member function, member class, or static data member
   16 | extern template foo1<float> foo();
note: candidate template ignored: target attributes do not match
    8 |  __device__ __host__ foo1<Out> foo()
 error: explicit instantiation of 'foo' does not refer to a function template, variable template, member function, member class, or static data member
   17 | extern template foo1<double> foo();
 note: candidate template ignored: target attributes do not match
    8 |  __device__ __host__ foo1<Out> foo()

code after migration:

#include <sycl/sycl.hpp>
#include <dpct/dpct.hpp>

template <typename Outtype>
class foo1{};

template <typename Out>
 foo1<Out> foo()
{

    return foo1<Out>{};
    
}


extern template foo1<float> foo();
extern template foo1<double> foo();

int main(){
    foo1<float> foo();
}

However, icpx is able to compile the migrated code without any issues.

To reproduce
#include <cuda_runtime.h>


template <typename Outtype>
class foo1{};

template <typename Out>
 __device__ __host__ foo1<Out> foo()
{

    return foo1<Out>{};
    
}


extern template foo1<float> foo();
extern template foo1<double> foo();

int main(){
    foo1<float> foo();
}
Environment
  • OS: Linux
  • Target device and vendor: Nvidia GPU
  • DPC++ version: Intel(R) oneAPI DPC++/C++ Compiler 2024.2.0 (2024.2.0.20240602)
Additional context

No response

Lenguaje dominante
LLVM
Estrellas
292
Forks
99
Merge medio
5 d 5 h
PR fusionados (30 d)
1

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de oneapi-src/SYCLomatic

Todos los issues de oneapi-src/SYCLomatic

Issues similares

Más issues de Compilers

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.