You can only use __restrict__
on a pointer type. That is also the only context in which __restrict__
makes sense.
Why am I getting the error message: "restrict" not allowed?
-
29-08-2022 - |
Question
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. */
}
Solution
OTHER TIPS
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);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow