Dear CUDPP developers,
My name is Wei-Fan Chiang, and I am currently a PhD student of School of Computing at University of Utah.
We (my colleague and me) are currently interesting in unsafe type casting detection for GPU programs.
I suspect that there are some potential unsafe type castings (specifically, floating-point to unsigned int casting) in file rand_gold.cpp
In functions FF, GG, HH, and II,
there are type castings shown as follows.
float = sin((float)(i)) * p;
unsigned int trigFunc = (unsigned int)(t);
To my best knowledge, such floating-point-to-unsigned-int casting is unsafe: the casting result is undefined when t is negative or greater than the maximum value of unsigned int.
In contrast,
float t = sin(__int_as_float(i))* p;
unsigned int trigFunc = __float2uint_rd(t);
I wonder that whether rand_gold.cpp is used in any routines provided by CUDPP or it is just for testing CUDPP?
Thanks.
Regards,
- Wei-Fan