occa
occa copied to clipboard
Kernel arguments silently dropped during source translation when semicolon present in argument list
I fat-fingered the keyboard when writing the argument list to an OCCA kernel and typed a semicolon where I meant to put a comma, cf.:
@kernel void whatever(dfloat *foo,
dfloat *bar;
dfloat *baz)
Remarkably, this did NOT trigger a syntax error. Instead, OCCA just deleted the semicoloned argument when translating the source, giving:
extern "C" __global__ void whatever(dfloat *foo,
dfloat *baz)
Now, even after this has happened, you can still do
whateverKernel(o_foo,
o_bar,
o_baz)
in your code and OCCA will silently drop the extra third argument.
This resulted in a great amount of confusion on my part, as my kernel wrote to an argument whose position in the list was effectively implicitly shifted by this behavior, and it looked like the write wasn't taking place. (It was, but it was being done to the next pointer in the list.)