I'm writing a CUDA kernel and want to __restrict__ some of my parameters. I'm getting the error message:

"restrict" is not allowed

Is it not allowed for some variable types? For some combinations of parameters? Because of some compiler flags? Because I've been naughty?

Simplified kernel signature:

template <typename T> foo(
    const T a[],
    __restrict__ SomeType b[],
    const T c
) {
    /* etc. */
}
有帮助吗?

解决方案

You can only use __restrict__ on a pointer type. That is also the only context in which __restrict__ makes sense.

其他提示

This can also happen if you used __restrict__ on a pointer parameter to a function, but got the order wrong, e.g.:

__device__ int bar(float * __restrict__ x);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top