* Added on-device reset for half

* run clang-format.

* test_half - Reset buffer with ushort rather than half type

* Half - update type in secondary reset kernel src

* Remove useless memset() calls.

* Add an option to still perform buffer resets on the host

* Check for program generation failure before attempting to create the kernel

* Don't exceed the range of a ushort when storing

* Appease clang-format

Co-authored-by: Joshua Luceno <joshualuceno@gmail.com>
Co-authored-by: taetenp <taet@holochip.com>
Co-authored-by: Chip Davis <chip@holochip.com>
This commit is contained in:
Steven Winston
2023-01-24 08:48:53 -08:00
committed by GitHub
parent 487dbd292e
commit 77e4fe5588
4 changed files with 1047 additions and 561 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -35,37 +35,38 @@ const char *align_divisors[kVectorSizeCount+kStrangeVectorSizeCount] = { "1", "2
const char *align_types[kVectorSizeCount+kStrangeVectorSizeCount] = { "half", "int", "int2", "int4", "int8", "int2" };
void *gIn_half = NULL;
void *gOut_half = NULL;
void *gOut_half_reference = NULL;
void *gOut_half_reference_double = NULL;
void *gIn_single = NULL;
void *gOut_single = NULL;
void *gOut_single_reference = NULL;
void *gIn_double = NULL;
// void *gOut_double = NULL;
// void *gOut_double_reference = NULL;
cl_mem gInBuffer_half = NULL;
cl_mem gOutBuffer_half = NULL;
cl_mem gInBuffer_single = NULL;
cl_mem gOutBuffer_single = NULL;
cl_mem gInBuffer_double = NULL;
// cl_mem gOutBuffer_double = NULL;
void *gIn_half = NULL;
void *gOut_half = NULL;
void *gOut_half_reference = NULL;
void *gOut_half_reference_double = NULL;
void *gIn_single = NULL;
void *gOut_single = NULL;
void *gOut_single_reference = NULL;
void *gIn_double = NULL;
// void *gOut_double = NULL;
// void *gOut_double_reference = NULL;
cl_mem gInBuffer_half = NULL;
cl_mem gOutBuffer_half = NULL;
cl_mem gInBuffer_single = NULL;
cl_mem gOutBuffer_single = NULL;
cl_mem gInBuffer_double = NULL;
// cl_mem gOutBuffer_double = NULL;
cl_context gContext = NULL;
cl_context gContext = NULL;
cl_command_queue gQueue = NULL;
uint32_t gDeviceFrequency = 0;
uint32_t gComputeDevices = 0;
size_t gMaxThreadGroupSize = 0;
size_t gWorkGroupSize = 0;
bool gWimpyMode = false;
int gWimpyReductionFactor = 512;
int gTestDouble = 0;
uint32_t gDeviceFrequency = 0;
uint32_t gComputeDevices = 0;
size_t gMaxThreadGroupSize = 0;
size_t gWorkGroupSize = 0;
bool gWimpyMode = false;
int gWimpyReductionFactor = 512;
int gTestDouble = 0;
bool gHostReset = false;
#if defined( __APPLE__ )
int gReportTimes = 1;
int gReportTimes = 1;
#else
int gReportTimes = 0;
int gReportTimes = 0;
#endif
#pragma mark -

View File

@@ -44,37 +44,38 @@
#include <CL/opencl.h>
#endif
extern void *gIn_half;
extern void *gOut_half;
extern void *gOut_half_reference;
extern void *gOut_half_reference_double;
extern void *gIn_single;
extern void *gOut_single;
extern void *gOut_single_reference;
extern void *gIn_double;
// extern void *gOut_double;
// extern void *gOut_double_reference;
extern cl_mem gInBuffer_half;
extern cl_mem gOutBuffer_half;
extern cl_mem gInBuffer_single;
extern cl_mem gOutBuffer_single;
extern cl_mem gInBuffer_double;
// extern cl_mem gOutBuffer_double;
extern void *gIn_half;
extern void *gOut_half;
extern void *gOut_half_reference;
extern void *gOut_half_reference_double;
extern void *gIn_single;
extern void *gOut_single;
extern void *gOut_single_reference;
extern void *gIn_double;
// extern void *gOut_double;
// extern void *gOut_double_reference;
extern cl_mem gInBuffer_half;
extern cl_mem gOutBuffer_half;
extern cl_mem gInBuffer_single;
extern cl_mem gOutBuffer_single;
extern cl_mem gInBuffer_double;
// extern cl_mem gOutBuffer_double;
extern cl_context gContext;
extern cl_context gContext;
extern cl_command_queue gQueue;
extern uint32_t gDeviceFrequency;
extern uint32_t gComputeDevices;
extern size_t gMaxThreadGroupSize;
extern size_t gWorkGroupSize;
extern int gTestDouble;
extern int gReportTimes;
extern uint32_t gDeviceFrequency;
extern uint32_t gComputeDevices;
extern size_t gMaxThreadGroupSize;
extern size_t gWorkGroupSize;
extern int gTestDouble;
extern int gReportTimes;
extern bool gHostReset;
// gWimpyMode indicates if we run the test in wimpy mode where we limit the
// size of 32 bit ranges to a much smaller set. This is meant to be used
// as a smoke test
extern bool gWimpyMode;
extern int gWimpyReductionFactor;
extern bool gWimpyMode;
extern int gWimpyReductionFactor;
uint64_t ReadTime( void );
double SubtractTime( uint64_t endTime, uint64_t startTime );

View File

@@ -194,6 +194,8 @@ static int ParseArgs( int argc, const char **argv )
gReportTimes ^= 1;
break;
case 'r': gHostReset = true; break;
case 'w': // Wimpy mode
gWimpyMode = true;
break;
@@ -235,13 +237,17 @@ static int ParseArgs( int argc, const char **argv )
static void PrintUsage( void )
{
vlog( "%s [-dthw]: <optional: test names>\n", appName );
vlog( "\t\t-d\tToggle double precision testing (default: on if double supported)\n" );
vlog( "\t\t-t\tToggle reporting performance data.\n" );
vlog( "\t\t-w\tRun in wimpy mode\n" );
vlog( "\t\t-[2^n]\tSet wimpy reduction factor, recommended range of n is 1-12, default factor(%u)\n", gWimpyReductionFactor);
vlog( "\t\t-h\tHelp\n" );
for( int i = 0; i < test_num; i++ )
vlog("%s [-dthw]: <optional: test names>\n", appName);
vlog("\t\t-d\tToggle double precision testing (default: on if double "
"supported)\n");
vlog("\t\t-t\tToggle reporting performance data.\n");
vlog("\t\t-r\tReset buffers on host instead of on device.\n");
vlog("\t\t-w\tRun in wimpy mode\n");
vlog("\t\t-[2^n]\tSet wimpy reduction factor, recommended range of n is "
"1-12, default factor(%u)\n",
gWimpyReductionFactor);
vlog("\t\t-h\tHelp\n");
for (int i = 0; i < test_num; i++)
{
vlog("\t\t%s\n", test_list[i].name );
}