Skip to content

Instantiating a CUDA kernel with a type predicated on __CUDA_ARCH__ causes cudaErrorSymbolNotFound #121942

@OgnianM

Description

@OgnianM

Example:

#include <iostream>
#include <typeinfo>
#include <cxxabi.h>

template<typename T>
__global__ void SomeKernel(T) {}

template<int>
struct SomeType { };

int main() {
#ifdef __CUDA_ARCH__
    using T = SomeType<0>;
#else
    using T = SomeType<1>;
#endif
    SomeKernel<T><<<1,1>>>({});

    if (cudaGetLastError() == cudaErrorSymbolNotFound) {
        std::cout << abi::__cxa_demangle(typeid(SomeKernel<T>).name(),0,0,0) << " not found!" << std::endl;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    cudaquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions