[CUDA 11.3] tex2DLod causes an internal compiler error with "-std=c++17"

Hello,

I was going to move the CUDA environment to 11.3 from 11.2 but I met an internal compiler error for tex2DLod().

Internal Compiler Error (codegen): unexpected operand in tex/surf handler

I tried to identify the root of cause and found that removing “-std=c++17” flag makes the code compilable. However I need this flag to compile the code to use C++ metaprogramming feature like folding expression.

This is the minimum code to reproduce the issue.

#include <cuda.h>

template <typename T>
__device__ __forceinline__ constexpr size_t getNumDwords() {
    return (sizeof(T) + 3) / 4;
}

template <typename... Types>
__device__ __forceinline__ constexpr size_t calcSumDwords() {
    return (0 + ... + getNumDwords<Types>());
}

extern "C" __global__ void test(CUtexObject texture) {
    calcSumDwords<int32_t>(); // requires -std=c++17 to be compiled with MSVC 16.9.4 as the host compiler.
    float4 color = tex2DLod<float4>(texture, 0.0f, 0.0f, 0.0f); // -std=c++17 causes the error with CUDA 11.3.
}

I also uploaded the VS solution for this repro here:

ICE disappers by removing “-std=c++17” from the project’s property but folding expression starts to cause an error.

With CUDA 11.2 the code above was fine.

Thanks,

Windows 10 20H2
CUDA 11.3
NVIDIA Driver 466.11
Visual Studio 2019 Community 16.9.4

1 Like

I suggest filing a bug. The instructions are linked to a sticky post at the top of this sub-forum.

Thanks for guiding.
I filed the bug.

Where is the bug report on this filed by shocker.0x15? This is still happening to us on May 3, 2020 on CUDA 11.3 and Ubuntu 20.04 unless we go down to c++11

The bug number is 3295173. The issue should be fixed in the next CUDA release after 11.3

Suggestions are to go back to CUDA 11.2 or use c++11

I don’t have any further information. Subsequent questions like “when will the next release be available” I will be unable to answer.

This issues seems to be fixed with CTK 11.3U1.