Skip to content

Commit 2d165ee

Browse files
authored
conversions: remove timing functionality (#2394)
Remove the test timing functionality from the conversions test, because it - is not advertised in the help, - is not supported on all platforms, triggering warnings during the build, - goes beyond the core purpose of the conformance test suite. Signed-off-by: Sven van Haastregt <[email protected]>
1 parent f30a191 commit 2d165ee

File tree

3 files changed

+0
-108
lines changed

3 files changed

+0
-108
lines changed

test_conformance/conversions/basic_test_conversions.cpp

Lines changed: 0 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,6 @@ cl_context gContext = NULL;
6868
cl_command_queue gQueue = NULL;
6969
int gStartTestNumber = -1;
7070
int gEndTestNumber = 0;
71-
#if defined(__APPLE__)
72-
int gTimeResults = 1;
73-
#else
74-
int gTimeResults = 0;
75-
#endif
76-
int gReportAverageTimes = 0;
7771
void *gIn = NULL;
7872
void *gRef = NULL;
7973
void *gAllowZ = NULL;
@@ -103,8 +97,6 @@ const char **argList = NULL;
10397
int argCount = 0;
10498

10599

106-
double SubtractTime(uint64_t endTime, uint64_t startTime);
107-
108100
cl_half_rounding_mode DataInitInfo::halfRoundingMode = CL_HALF_RTE;
109101
cl_half_rounding_mode ConversionsTest::defaultHalfRoundingMode = CL_HALF_RTE;
110102

@@ -904,61 +896,6 @@ int ConversionsTest::DoTest(Type outType, Type inType, SaturationMode sat,
904896

905897
log_info("done.\n");
906898

907-
if (gTimeResults)
908-
{
909-
// Kick off tests for the various vector lengths
910-
for (vectorSize = gMinVectorSize; vectorSize < gMaxVectorSize;
911-
vectorSize++)
912-
{
913-
size_t workItemCount = blockCount / vectorSizes[vectorSize];
914-
if (vectorSizes[vectorSize] * gTypeSizes[outType] < 4)
915-
workItemCount /=
916-
4 / (vectorSizes[vectorSize] * gTypeSizes[outType]);
917-
918-
double sum = 0.0;
919-
double bestTime = INFINITY;
920-
cl_uint k;
921-
for (k = 0; k < PERF_LOOP_COUNT; k++)
922-
{
923-
uint64_t startTime = conv_test::GetTime();
924-
if ((error = conv_test::RunKernel(
925-
writeInputBufferInfo.calcInfo[vectorSize]->kernel,
926-
gInBuffer, gOutBuffers[vectorSize], workItemCount)))
927-
{
928-
gFailCount++;
929-
return error;
930-
}
931-
932-
// Make sure OpenCL is done
933-
if ((error = clFinish(gQueue)))
934-
{
935-
vlog_error("Error %d at clFinish\n", error);
936-
return error;
937-
}
938-
939-
uint64_t endTime = conv_test::GetTime();
940-
double time = SubtractTime(endTime, startTime);
941-
sum += time;
942-
if (time < bestTime) bestTime = time;
943-
}
944-
945-
if (gReportAverageTimes) bestTime = sum / PERF_LOOP_COUNT;
946-
double clocksPerOp = bestTime * (double)gDeviceFrequency
947-
* gComputeDevices * gSimdSize * 1e6
948-
/ (workItemCount * vectorSizes[vectorSize]);
949-
if (0 == vectorSize)
950-
vlog_perf(clocksPerOp, LOWER_IS_BETTER, "clocks / element",
951-
"implicit convert %s -> %s", gTypeNames[inType],
952-
gTypeNames[outType]);
953-
else
954-
vlog_perf(clocksPerOp, LOWER_IS_BETTER, "clocks / element",
955-
"convert_%s%s%s%s( %s%s )", gTypeNames[outType],
956-
sizeNames[vectorSize], gSaturationNames[sat],
957-
gRoundingModeNames[round], gTypeNames[inType],
958-
sizeNames[vectorSize]);
959-
}
960-
}
961-
962899
if (gWimpyMode)
963900
vlog("\tWimp pass");
964901
else
@@ -978,33 +915,6 @@ int ConversionsTest::DoTest(Type outType, Type inType, SaturationMode sat,
978915
void memset_pattern4(void *dest, const void *src_pattern, size_t bytes);
979916
#endif
980917

981-
#if defined(_MSC_VER)
982-
/* function is defined in "compat.h" */
983-
#else
984-
double SubtractTime(uint64_t endTime, uint64_t startTime)
985-
{
986-
uint64_t diff = endTime - startTime;
987-
static double conversion = 0.0;
988-
989-
if (0.0 == conversion)
990-
{
991-
#if defined(__APPLE__)
992-
mach_timebase_info_data_t info = { 0, 0 };
993-
kern_return_t err = mach_timebase_info(&info);
994-
if (0 == err)
995-
conversion = 1e-9 * (double)info.numer / (double)info.denom;
996-
#else
997-
// This function consumes output from GetTime() above, and converts the
998-
// time to secionds.
999-
#warning need accurate ticks to seconds conversion factor here. Times are invalid.
1000-
#endif
1001-
}
1002-
1003-
// strictly speaking we should also be subtracting out timer latency here
1004-
return conversion * (double)diff;
1005-
}
1006-
#endif
1007-
1008918
void MapResultValuesComplete(const std::unique_ptr<CalcRefValsBase> &ptr);
1009919

1010920
void CL_CALLBACK CalcReferenceValuesComplete(cl_event e, cl_int status,
@@ -1352,20 +1262,6 @@ cl_int PrepareReference(cl_uint job_id, cl_uint thread_id, void *p)
13521262
return CL_SUCCESS;
13531263
}
13541264

1355-
uint64_t GetTime(void)
1356-
{
1357-
#if defined(__APPLE__)
1358-
return mach_absolute_time();
1359-
#elif defined(_MSC_VER)
1360-
return ReadTime();
1361-
#else
1362-
// mach_absolute_time is a high precision timer with precision < 1
1363-
// microsecond.
1364-
#warning need accurate clock here. Times are invalid.
1365-
return 0;
1366-
#endif
1367-
}
1368-
13691265
// Note: not called reentrantly
13701266
void WriteInputBufferComplete(void *data)
13711267
{

test_conformance/conversions/basic_test_conversions.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ extern int gSkipTesting;
8686
extern int gMinVectorSize;
8787
extern int gMaxVectorSize;
8888
extern int gForceFTZ;
89-
extern int gTimeResults;
90-
extern int gReportAverageTimes;
9189
extern int gStartTestNumber;
9290
extern int gEndTestNumber;
9391
extern int gIsRTZ;

test_conformance/conversions/test_conversions.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,6 @@ static int ParseArgs(int argc, const char **argv)
226226
gForceFTZ ^= 1;
227227
gForceHalfFTZ ^= 1;
228228
break;
229-
case 't': gTimeResults ^= 1; break;
230-
case 'a': gReportAverageTimes ^= 1; break;
231229
case '1':
232230
if (arg[1] == '6')
233231
{

0 commit comments

Comments
 (0)