chipStar icon indicating copy to clipboard operation
chipStar copied to clipboard

HIP/tests/catch/unit/deviceLib/{Single,Double}PrecisionMathFunctions tests are not very useful

Open franz opened this issue 1 year ago • 3 comments

grep GENERATE HIP/tests/catch/unit/deviceLib/SinglePrecisionMathFunctions/*

acosf.cc:GENERATE_KERNEL_FLOAT(acosf, acosf(1.0f));
acoshf.cc:GENERATE_KERNEL_FLOAT(acoshf, acoshf(1.0f));
asinf.cc:GENERATE_KERNEL_FLOAT(asinf, asinf(1.0f));
asinhf.cc:GENERATE_KERNEL_FLOAT(asinhf, asinhf(1.0f));
atan2f.cc:GENERATE_KERNEL_FLOAT(atan2f, atan2f(1.0f, 1.0f));
atanf.cc:GENERATE_KERNEL_FLOAT(atanf, atanf(1.0f));
atanhf.cc:GENERATE_KERNEL_FLOAT(atanhf, atanhf(1.0f));
....

Almost all of the tests call a function with a constant argument, and do not use the function's result:

#define GENERATE_KERNEL_DOUBLE(FUNCNAME, FUNC)                                                     \
  __global__ void testKernel_##FUNCNAME(double* a) {                                               \
    FUNC;                                                                                          \
  }                                                                                                \

When chipStar is compiled with anything but -O0, this gets optimized to ret void. If chipStar is run with -O0, the code is generated, but is then optimized away by the OpenCL/Level0 driver at runtime.

franz avatar Sep 21 '23 10:09 franz