krrishnarraj / clpeak

A tool which profiles OpenCL devices to find their peak capacities
Apache License 2.0
404 stars 113 forks source link

Wrong definitions for MIN/MAX macros #71

Closed haraldservat closed 3 years ago

haraldservat commented 3 years ago

The MIN and MAX definitions in include/common.h should be fixed. With current approach, when used in compute_sp.cpp, for instance, the code

uint64_t t = MIN((globalWIs * sizeof(cl_float)), devInfo.maxAllocSize) / sizeof(cl_float);

leads to the following pre-processed code

uint64_t t = ((globalWIs * sizeof(cl_float)) < devInfo.maxAllocSize)? (globalWIs * sizeof(cl_float)): devInfo.maxAllocSize / sizeof(cl_float);

in which the division only affects to devInfo.maxAllocSize.

Possible workarounds are: