mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-25 16:29:03 +00:00
cl22: Reuse test harness code in half (#192)
Some of the setup functionality is already there in the test harness, so use that and remove the duplicated code from within the suite. Signed-off-by: Radek Szymanski <radek.szymanski@arm.com>
This commit is contained in:
committed by
Kévin Petit
parent
2c9ba4b352
commit
8a8ebf29b0
@@ -18,7 +18,7 @@
|
|||||||
#include "tests.h"
|
#include "tests.h"
|
||||||
#include "../../test_common/harness/testHarness.h"
|
#include "../../test_common/harness/testHarness.h"
|
||||||
|
|
||||||
int test_roundTrip( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
int test_roundTrip( cl_device_id device, cl_context context, cl_command_queue queue, int num_elements )
|
||||||
{
|
{
|
||||||
int vectorSize, error;
|
int vectorSize, error;
|
||||||
uint64_t i, j;
|
uint64_t i, j;
|
||||||
@@ -107,7 +107,7 @@ int test_roundTrip( cl_device_id deviceID, cl_context context, cl_command_queue
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if(g_arrVecSizes[vectorSize] == 3) {
|
if(g_arrVecSizes[vectorSize] == 3) {
|
||||||
programs[vectorSize] = MakeProgram( sourceV3, sizeof( sourceV3) / sizeof( sourceV3[0]) );
|
programs[vectorSize] = MakeProgram( device, sourceV3, sizeof( sourceV3) / sizeof( sourceV3[0]) );
|
||||||
if( NULL == programs[ vectorSize ] )
|
if( NULL == programs[ vectorSize ] )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
@@ -115,7 +115,7 @@ int test_roundTrip( cl_device_id deviceID, cl_context context, cl_command_queue
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
programs[vectorSize] = MakeProgram( source, sizeof( source) / sizeof( source[0]) );
|
programs[vectorSize] = MakeProgram( device, source, sizeof( source) / sizeof( source[0]) );
|
||||||
if( NULL == programs[ vectorSize ] )
|
if( NULL == programs[ vectorSize ] )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
@@ -134,15 +134,15 @@ int test_roundTrip( cl_device_id deviceID, cl_context context, cl_command_queue
|
|||||||
if( gTestDouble )
|
if( gTestDouble )
|
||||||
{
|
{
|
||||||
if(g_arrVecSizes[vectorSize] == 3) {
|
if(g_arrVecSizes[vectorSize] == 3) {
|
||||||
doublePrograms[vectorSize] = MakeProgram( doubleSourceV3, sizeof( doubleSourceV3) / sizeof( doubleSourceV3[0]) );
|
doublePrograms[vectorSize] = MakeProgram( device, doubleSourceV3, sizeof( doubleSourceV3) / sizeof( doubleSourceV3[0]) );
|
||||||
if( NULL == programs[ vectorSize ] )
|
if( NULL == doublePrograms[ vectorSize ] )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
doublePrograms[vectorSize] = MakeProgram( doubleSource, sizeof( doubleSource) / sizeof( doubleSource[0]) );
|
doublePrograms[vectorSize] = MakeProgram( device, doubleSource, sizeof( doubleSource) / sizeof( doubleSource[0]) );
|
||||||
if( NULL == programs[ vectorSize ] )
|
if( NULL == doublePrograms[ vectorSize ] )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
return -1;
|
return -1;
|
||||||
@@ -150,7 +150,7 @@ int test_roundTrip( cl_device_id deviceID, cl_context context, cl_command_queue
|
|||||||
}
|
}
|
||||||
|
|
||||||
doubleKernels[ vectorSize ] = clCreateKernel( doublePrograms[ vectorSize ], "test", &error );
|
doubleKernels[ vectorSize ] = clCreateKernel( doublePrograms[ vectorSize ], "test", &error );
|
||||||
if( NULL == kernels[vectorSize] )
|
if( NULL == doubleKernels[vectorSize] )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
vlog_error( "\t\tFAILED -- Failed to create kernel. (%d)\n", error );
|
vlog_error( "\t\tFAILED -- Failed to create kernel. (%d)\n", error );
|
||||||
@@ -161,7 +161,7 @@ int test_roundTrip( cl_device_id deviceID, cl_context context, cl_command_queue
|
|||||||
|
|
||||||
// Figure out how many elements are in a work block
|
// Figure out how many elements are in a work block
|
||||||
size_t elementSize = MAX( sizeof(cl_half), sizeof(cl_float));
|
size_t elementSize = MAX( sizeof(cl_half), sizeof(cl_float));
|
||||||
size_t blockCount = (size_t)gBufferSize / elementSize; //elementSize is a power of two
|
size_t blockCount = (size_t)getBufferSize(device) / elementSize; //elementSize is a power of two
|
||||||
uint64_t lastCase = 1ULL << (8*sizeof(cl_half)); // number of cl_half
|
uint64_t lastCase = 1ULL << (8*sizeof(cl_half)); // number of cl_half
|
||||||
size_t stride = blockCount;
|
size_t stride = blockCount;
|
||||||
|
|
||||||
@@ -190,7 +190,7 @@ int test_roundTrip( cl_device_id deviceID, cl_context context, cl_command_queue
|
|||||||
for( vectorSize = kMinVectorSize; vectorSize < kLastVectorSizeToTest; vectorSize++)
|
for( vectorSize = kMinVectorSize; vectorSize < kLastVectorSizeToTest; vectorSize++)
|
||||||
{ // here we loop through vector sizes -- 3 is last.
|
{ // here we loop through vector sizes -- 3 is last.
|
||||||
uint32_t pattern = 0xdeaddead;
|
uint32_t pattern = 0xdeaddead;
|
||||||
memset_pattern4( gOut_half, &pattern, (size_t)getBufferSize(gDevice)/2);
|
memset_pattern4( gOut_half, &pattern, (size_t)getBufferSize(device)/2);
|
||||||
|
|
||||||
if( (error = clEnqueueWriteBuffer(gQueue, gOutBuffer_half, CL_TRUE, 0, count * sizeof(cl_half), gOut_half, 0, NULL, NULL)) )
|
if( (error = clEnqueueWriteBuffer(gQueue, gOutBuffer_half, CL_TRUE, 0, count * sizeof(cl_half), gOut_half, 0, NULL, NULL)) )
|
||||||
{
|
{
|
||||||
@@ -201,7 +201,7 @@ int test_roundTrip( cl_device_id deviceID, cl_context context, cl_command_queue
|
|||||||
|
|
||||||
|
|
||||||
// here is where "3" starts to cause problems.
|
// here is where "3" starts to cause problems.
|
||||||
error = RunKernel( kernels[vectorSize], gInBuffer_half, gOutBuffer_half, numVecs(count, vectorSize, false) ,
|
error = RunKernel(device, kernels[vectorSize], gInBuffer_half, gOutBuffer_half, numVecs(count, vectorSize, false) ,
|
||||||
runsOverBy(count, vectorSize, false) );
|
runsOverBy(count, vectorSize, false) );
|
||||||
if(error)
|
if(error)
|
||||||
{
|
{
|
||||||
@@ -243,7 +243,7 @@ int test_roundTrip( cl_device_id deviceID, cl_context context, cl_command_queue
|
|||||||
|
|
||||||
if( gTestDouble )
|
if( gTestDouble )
|
||||||
{
|
{
|
||||||
memset_pattern4( gOut_half, &pattern, (size_t)getBufferSize(gDevice)/2);
|
memset_pattern4( gOut_half, &pattern, (size_t)getBufferSize(device)/2);
|
||||||
if( (error = clEnqueueWriteBuffer(gQueue, gOutBuffer_half, CL_TRUE, 0, count * sizeof(cl_half), gOut_half, 0, NULL, NULL)) )
|
if( (error = clEnqueueWriteBuffer(gQueue, gOutBuffer_half, CL_TRUE, 0, count * sizeof(cl_half), gOut_half, 0, NULL, NULL)) )
|
||||||
{
|
{
|
||||||
vlog_error( "Failure in clWriteArray\n" );
|
vlog_error( "Failure in clWriteArray\n" );
|
||||||
@@ -252,7 +252,7 @@ int test_roundTrip( cl_device_id deviceID, cl_context context, cl_command_queue
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if( (error = RunKernel( doubleKernels[vectorSize], gInBuffer_half, gOutBuffer_half, numVecs(count, vectorSize, false) ,
|
if( (error = RunKernel(device, doubleKernels[vectorSize], gInBuffer_half, gOutBuffer_half, numVecs(count, vectorSize, false) ,
|
||||||
runsOverBy(count, vectorSize, false) ) ) )
|
runsOverBy(count, vectorSize, false) ) ) )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
@@ -313,7 +313,7 @@ int test_roundTrip( cl_device_id deviceID, cl_context context, cl_command_queue
|
|||||||
for( j = 0; j < loopCount; j++ )
|
for( j = 0; j < loopCount; j++ )
|
||||||
{
|
{
|
||||||
uint64_t startTime = ReadTime();
|
uint64_t startTime = ReadTime();
|
||||||
if( (error = RunKernel( kernels[vectorSize], gInBuffer_half, gOutBuffer_half,numVecs(count, vectorSize, false) ,
|
if( (error = RunKernel(device, kernels[vectorSize], gInBuffer_half, gOutBuffer_half,numVecs(count, vectorSize, false) ,
|
||||||
runsOverBy(count, vectorSize, false)) ) )
|
runsOverBy(count, vectorSize, false)) ) )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
@@ -340,7 +340,7 @@ int test_roundTrip( cl_device_id deviceID, cl_context context, cl_command_queue
|
|||||||
for( j = 0; j < loopCount; j++ )
|
for( j = 0; j < loopCount; j++ )
|
||||||
{
|
{
|
||||||
uint64_t startTime = ReadTime();
|
uint64_t startTime = ReadTime();
|
||||||
if( (error = RunKernel( doubleKernels[vectorSize], gInBuffer_half, gOutBuffer_half, numVecs(count, vectorSize, false) ,
|
if( (error = RunKernel(device, doubleKernels[vectorSize], gInBuffer_half, gOutBuffer_half, numVecs(count, vectorSize, false) ,
|
||||||
runsOverBy(count, vectorSize, false)) ) )
|
runsOverBy(count, vectorSize, false)) ) )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
|
|||||||
@@ -61,9 +61,7 @@ static inline float half2float( cl_ushort us )
|
|||||||
return uu.f;
|
return uu.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Test_vLoadHalf_private( bool aligned );
|
int Test_vLoadHalf_private( cl_device_id device, bool aligned )
|
||||||
|
|
||||||
int Test_vLoadHalf_private( bool aligned )
|
|
||||||
{
|
{
|
||||||
cl_int error;
|
cl_int error;
|
||||||
int vectorSize;
|
int vectorSize;
|
||||||
@@ -303,7 +301,7 @@ int Test_vLoadHalf_private( bool aligned )
|
|||||||
|
|
||||||
|
|
||||||
if(g_arrVecSizes[vectorSize] != 3) {
|
if(g_arrVecSizes[vectorSize] != 3) {
|
||||||
programs[vectorSize][0] = MakeProgram( source, sizeof( source) / sizeof( source[0]) );
|
programs[vectorSize][0] = MakeProgram( device, source, sizeof( source) / sizeof( source[0]) );
|
||||||
if( NULL == programs[ vectorSize ][0] ) {
|
if( NULL == programs[ vectorSize ][0] ) {
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
vlog_error( "\t\tFAILED -- Failed to create program.\n" );
|
vlog_error( "\t\tFAILED -- Failed to create program.\n" );
|
||||||
@@ -313,7 +311,7 @@ int Test_vLoadHalf_private( bool aligned )
|
|||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
} else if(aligned) {
|
} else if(aligned) {
|
||||||
programs[vectorSize][0] = MakeProgram( sourceV3aligned, sizeof( sourceV3aligned) / sizeof( sourceV3aligned[0]) );
|
programs[vectorSize][0] = MakeProgram( device, sourceV3aligned, sizeof( sourceV3aligned) / sizeof( sourceV3aligned[0]) );
|
||||||
if( NULL == programs[ vectorSize ][0] ) {
|
if( NULL == programs[ vectorSize ][0] ) {
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
vlog_error( "\t\tFAILED -- Failed to create program.\n" );
|
vlog_error( "\t\tFAILED -- Failed to create program.\n" );
|
||||||
@@ -323,7 +321,7 @@ int Test_vLoadHalf_private( bool aligned )
|
|||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
programs[vectorSize][0] = MakeProgram( sourceV3, sizeof( sourceV3) / sizeof( sourceV3[0]) );
|
programs[vectorSize][0] = MakeProgram( device, sourceV3, sizeof( sourceV3) / sizeof( sourceV3[0]) );
|
||||||
if( NULL == programs[ vectorSize ][0] ) {
|
if( NULL == programs[ vectorSize ][0] ) {
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
vlog_error( "\t\tFAILED -- Failed to create program.\n" );
|
vlog_error( "\t\tFAILED -- Failed to create program.\n" );
|
||||||
@@ -358,7 +356,7 @@ int Test_vLoadHalf_private( bool aligned )
|
|||||||
source_ptr = source_private2;
|
source_ptr = source_private2;
|
||||||
source_size = sizeof( source_private2) / sizeof( source_private2[0]);
|
source_size = sizeof( source_private2) / sizeof( source_private2[0]);
|
||||||
}
|
}
|
||||||
programs[vectorSize][1] = MakeProgram( source_ptr, source_size );
|
programs[vectorSize][1] = MakeProgram( device, source_ptr, source_size );
|
||||||
if( NULL == programs[ vectorSize ][1] )
|
if( NULL == programs[ vectorSize ][1] )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
@@ -391,7 +389,7 @@ int Test_vLoadHalf_private( bool aligned )
|
|||||||
source_ptr = source_local2;
|
source_ptr = source_local2;
|
||||||
source_size = sizeof( source_local2) / sizeof( source_local2[0]);
|
source_size = sizeof( source_local2) / sizeof( source_local2[0]);
|
||||||
}
|
}
|
||||||
programs[vectorSize][2] = MakeProgram( source_ptr, source_size );
|
programs[vectorSize][2] = MakeProgram( device, source_ptr, source_size );
|
||||||
if( NULL == programs[ vectorSize ][2] )
|
if( NULL == programs[ vectorSize ][2] )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
@@ -411,7 +409,7 @@ int Test_vLoadHalf_private( bool aligned )
|
|||||||
|
|
||||||
if(g_arrVecSizes[vectorSize] == 3) {
|
if(g_arrVecSizes[vectorSize] == 3) {
|
||||||
if(aligned) {
|
if(aligned) {
|
||||||
programs[vectorSize][3] = MakeProgram( source_constantV3aligned, sizeof(source_constantV3aligned) / sizeof( source_constantV3aligned[0]) );
|
programs[vectorSize][3] = MakeProgram( device, source_constantV3aligned, sizeof(source_constantV3aligned) / sizeof( source_constantV3aligned[0]) );
|
||||||
if( NULL == programs[ vectorSize ][3] )
|
if( NULL == programs[ vectorSize ][3] )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
@@ -421,7 +419,7 @@ int Test_vLoadHalf_private( bool aligned )
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
programs[vectorSize][3] = MakeProgram( source_constantV3, sizeof(source_constantV3) / sizeof( source_constantV3[0]) );
|
programs[vectorSize][3] = MakeProgram( device, source_constantV3, sizeof(source_constantV3) / sizeof( source_constantV3[0]) );
|
||||||
if( NULL == programs[ vectorSize ][3] )
|
if( NULL == programs[ vectorSize ][3] )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
@@ -432,7 +430,7 @@ int Test_vLoadHalf_private( bool aligned )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
programs[vectorSize][3] = MakeProgram( source_constant, sizeof(source_constant) / sizeof( source_constant[0]) );
|
programs[vectorSize][3] = MakeProgram( device, source_constant, sizeof(source_constant) / sizeof( source_constant[0]) );
|
||||||
if( NULL == programs[ vectorSize ][3] )
|
if( NULL == programs[ vectorSize ][3] )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
@@ -454,7 +452,7 @@ int Test_vLoadHalf_private( bool aligned )
|
|||||||
|
|
||||||
// Figure out how many elements are in a work block
|
// Figure out how many elements are in a work block
|
||||||
size_t elementSize = MAX( sizeof(cl_half), sizeof(cl_float));
|
size_t elementSize = MAX( sizeof(cl_half), sizeof(cl_float));
|
||||||
size_t blockCount = gBufferSize / elementSize; // elementSize is power of 2
|
size_t blockCount = getBufferSize(device) / elementSize; // elementSize is power of 2
|
||||||
uint64_t lastCase = 1ULL << (8*sizeof(cl_half)); // number of things of size cl_half
|
uint64_t lastCase = 1ULL << (8*sizeof(cl_half)); // number of things of size cl_half
|
||||||
|
|
||||||
// we handle 64-bit types a bit differently.
|
// we handle 64-bit types a bit differently.
|
||||||
@@ -504,7 +502,7 @@ int Test_vLoadHalf_private( bool aligned )
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
memset_pattern4( gOut_single, &pattern, gBufferSize);
|
memset_pattern4( gOut_single, &pattern, getBufferSize(device));
|
||||||
if( (error = clEnqueueWriteBuffer(gQueue, gOutBuffer_single, CL_TRUE, 0, count * sizeof( float ), gOut_single, 0, NULL, NULL)) )
|
if( (error = clEnqueueWriteBuffer(gQueue, gOutBuffer_single, CL_TRUE, 0, count * sizeof( float ), gOut_single, 0, NULL, NULL)) )
|
||||||
{
|
{
|
||||||
vlog_error( "Failure in clWriteArray\n" );
|
vlog_error( "Failure in clWriteArray\n" );
|
||||||
@@ -518,7 +516,7 @@ int Test_vLoadHalf_private( bool aligned )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// okay, here is where we have to be careful
|
// okay, here is where we have to be careful
|
||||||
if( (error = RunKernel( kernels[vectorSize][addressSpace], gInBuffer_half, gOutBuffer_single, numVecs(count, vectorSize, aligned) ,
|
if( (error = RunKernel(device, kernels[vectorSize][addressSpace], gInBuffer_half, gOutBuffer_single, numVecs(count, vectorSize, aligned) ,
|
||||||
runsOverBy(count, vectorSize, aligned) ) ) )
|
runsOverBy(count, vectorSize, aligned) ) ) )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
@@ -562,7 +560,7 @@ int Test_vLoadHalf_private( bool aligned )
|
|||||||
{
|
{
|
||||||
uint64_t startTime = ReadTime();
|
uint64_t startTime = ReadTime();
|
||||||
error =
|
error =
|
||||||
RunKernel( kernels[vectorSize][addressSpace], gInBuffer_half, gOutBuffer_single, numVecs(count, vectorSize, aligned) ,
|
RunKernel(device, kernels[vectorSize][addressSpace], gInBuffer_half, gOutBuffer_single, numVecs(count, vectorSize, aligned) ,
|
||||||
runsOverBy(count, vectorSize, aligned));
|
runsOverBy(count, vectorSize, aligned));
|
||||||
if(error)
|
if(error)
|
||||||
{
|
{
|
||||||
@@ -617,13 +615,13 @@ exit:
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_vload_half( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
int test_vload_half( cl_device_id device, cl_context context, cl_command_queue queue, int num_elements )
|
||||||
{
|
{
|
||||||
return Test_vLoadHalf_private( false );
|
return Test_vLoadHalf_private( device, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_vloada_half( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
int test_vloada_half( cl_device_id device, cl_context context, cl_command_queue queue, int num_elements )
|
||||||
{
|
{
|
||||||
return Test_vLoadHalf_private( true );
|
return Test_vLoadHalf_private( device, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -614,73 +614,73 @@ double2half_rtn( double f )
|
|||||||
|
|
||||||
int test_vstore_half( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
int test_vstore_half( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
||||||
{
|
{
|
||||||
switch (get_default_rounding_mode(gDevice))
|
switch (get_default_rounding_mode(deviceID))
|
||||||
{
|
{
|
||||||
case CL_FP_ROUND_TO_ZERO:
|
case CL_FP_ROUND_TO_ZERO:
|
||||||
return Test_vStoreHalf_private(float2half_rtz, double2half_rte, "");
|
return Test_vStoreHalf_private(deviceID, float2half_rtz, double2half_rte, "");
|
||||||
case 0:
|
case 0:
|
||||||
return -1;
|
return -1;
|
||||||
default:
|
default:
|
||||||
return Test_vStoreHalf_private(float2half_rte, double2half_rte, "");
|
return Test_vStoreHalf_private(deviceID, float2half_rte, double2half_rte, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_vstore_half_rte( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
int test_vstore_half_rte( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
||||||
{
|
{
|
||||||
return Test_vStoreHalf_private(float2half_rte, double2half_rte, "_rte");
|
return Test_vStoreHalf_private(deviceID, float2half_rte, double2half_rte, "_rte");
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_vstore_half_rtz( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
int test_vstore_half_rtz( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
||||||
{
|
{
|
||||||
return Test_vStoreHalf_private(float2half_rtz, double2half_rtz, "_rtz");
|
return Test_vStoreHalf_private(deviceID, float2half_rtz, double2half_rtz, "_rtz");
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_vstore_half_rtp( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
int test_vstore_half_rtp( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
||||||
{
|
{
|
||||||
return Test_vStoreHalf_private(float2half_rtp, double2half_rtp, "_rtp");
|
return Test_vStoreHalf_private(deviceID, float2half_rtp, double2half_rtp, "_rtp");
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_vstore_half_rtn( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
int test_vstore_half_rtn( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
||||||
{
|
{
|
||||||
return Test_vStoreHalf_private(float2half_rtn, double2half_rtn, "_rtn");
|
return Test_vStoreHalf_private(deviceID, float2half_rtn, double2half_rtn, "_rtn");
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_vstorea_half( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
int test_vstorea_half( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
||||||
{
|
{
|
||||||
switch (get_default_rounding_mode(gDevice))
|
switch (get_default_rounding_mode(deviceID))
|
||||||
{
|
{
|
||||||
case CL_FP_ROUND_TO_ZERO:
|
case CL_FP_ROUND_TO_ZERO:
|
||||||
return Test_vStoreaHalf_private(float2half_rtz, double2half_rte, "");
|
return Test_vStoreaHalf_private(deviceID,float2half_rtz, double2half_rte, "");
|
||||||
case 0:
|
case 0:
|
||||||
return -1;
|
return -1;
|
||||||
default:
|
default:
|
||||||
return Test_vStoreaHalf_private(float2half_rte, double2half_rte, "");
|
return Test_vStoreaHalf_private(deviceID, float2half_rte, double2half_rte, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_vstorea_half_rte( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
int test_vstorea_half_rte( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
||||||
{
|
{
|
||||||
return Test_vStoreaHalf_private(float2half_rte, double2half_rte, "_rte");
|
return Test_vStoreaHalf_private(deviceID, float2half_rte, double2half_rte, "_rte");
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_vstorea_half_rtz( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
int test_vstorea_half_rtz( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
||||||
{
|
{
|
||||||
return Test_vStoreaHalf_private(float2half_rtz, double2half_rtz, "_rtz");
|
return Test_vStoreaHalf_private(deviceID, float2half_rtz, double2half_rtz, "_rtz");
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_vstorea_half_rtp( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
int test_vstorea_half_rtp( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
||||||
{
|
{
|
||||||
return Test_vStoreaHalf_private(float2half_rtp, double2half_rtp, "_rtp");
|
return Test_vStoreaHalf_private(deviceID, float2half_rtp, double2half_rtp, "_rtp");
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_vstorea_half_rtn( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
int test_vstorea_half_rtn( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements )
|
||||||
{
|
{
|
||||||
return Test_vStoreaHalf_private(float2half_rtn, double2half_rtn, "_rtn");
|
return Test_vStoreaHalf_private(deviceID, float2half_rtn, double2half_rtn, "_rtn");
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
int Test_vStoreHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const char *roundName )
|
int Test_vStoreHalf_private( cl_device_id device, f2h referenceFunc, d2h doubleReferenceFunc, const char *roundName )
|
||||||
{
|
{
|
||||||
int vectorSize, error;
|
int vectorSize, error;
|
||||||
cl_program programs[kVectorSizeCount+kStrangeVectorSizeCount][3];
|
cl_program programs[kVectorSizeCount+kStrangeVectorSizeCount][3];
|
||||||
@@ -906,9 +906,9 @@ int Test_vStoreHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const c
|
|||||||
|
|
||||||
|
|
||||||
if(g_arrVecSizes[vectorSize] == 3) {
|
if(g_arrVecSizes[vectorSize] == 3) {
|
||||||
programs[vectorSize][0] = MakeProgram( source_v3, sizeof(source_v3) / sizeof( source_v3[0]) );
|
programs[vectorSize][0] = MakeProgram( device, source_v3, sizeof(source_v3) / sizeof( source_v3[0]) );
|
||||||
} else {
|
} else {
|
||||||
programs[vectorSize][0] = MakeProgram( source, sizeof(source) / sizeof( source[0]) );
|
programs[vectorSize][0] = MakeProgram( device, source, sizeof(source) / sizeof( source[0]) );
|
||||||
}
|
}
|
||||||
if( NULL == programs[ vectorSize ][0] )
|
if( NULL == programs[ vectorSize ][0] )
|
||||||
{
|
{
|
||||||
@@ -925,9 +925,9 @@ int Test_vStoreHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const c
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(g_arrVecSizes[vectorSize] == 3) {
|
if(g_arrVecSizes[vectorSize] == 3) {
|
||||||
programs[vectorSize][1] = MakeProgram( source_private_store_v3, sizeof(source_private_store_v3) / sizeof( source_private_store_v3[0]) );
|
programs[vectorSize][1] = MakeProgram( device, source_private_store_v3, sizeof(source_private_store_v3) / sizeof( source_private_store_v3[0]) );
|
||||||
} else {
|
} else {
|
||||||
programs[vectorSize][1] = MakeProgram( source_private_store, sizeof(source_private_store) / sizeof( source_private_store[0]) );
|
programs[vectorSize][1] = MakeProgram( device, source_private_store, sizeof(source_private_store) / sizeof( source_private_store[0]) );
|
||||||
}
|
}
|
||||||
if( NULL == programs[ vectorSize ][1] )
|
if( NULL == programs[ vectorSize ][1] )
|
||||||
{
|
{
|
||||||
@@ -944,7 +944,7 @@ int Test_vStoreHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const c
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(g_arrVecSizes[vectorSize] == 3) {
|
if(g_arrVecSizes[vectorSize] == 3) {
|
||||||
programs[vectorSize][2] = MakeProgram( source_local_store_v3, sizeof(source_local_store_v3) / sizeof( source_local_store_v3[0]) );
|
programs[vectorSize][2] = MakeProgram( device, source_local_store_v3, sizeof(source_local_store_v3) / sizeof( source_local_store_v3[0]) );
|
||||||
if( NULL == programs[ vectorSize ][2] )
|
if( NULL == programs[ vectorSize ][2] )
|
||||||
{
|
{
|
||||||
unsigned q;
|
unsigned q;
|
||||||
@@ -956,7 +956,7 @@ int Test_vStoreHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const c
|
|||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
programs[vectorSize][2] = MakeProgram( source_local_store, sizeof(source_local_store) / sizeof( source_local_store[0]) );
|
programs[vectorSize][2] = MakeProgram( device, source_local_store, sizeof(source_local_store) / sizeof( source_local_store[0]) );
|
||||||
if( NULL == programs[ vectorSize ][2] )
|
if( NULL == programs[ vectorSize ][2] )
|
||||||
{
|
{
|
||||||
unsigned q;
|
unsigned q;
|
||||||
@@ -980,9 +980,9 @@ int Test_vStoreHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const c
|
|||||||
if( gTestDouble )
|
if( gTestDouble )
|
||||||
{
|
{
|
||||||
if(g_arrVecSizes[vectorSize] == 3) {
|
if(g_arrVecSizes[vectorSize] == 3) {
|
||||||
doublePrograms[vectorSize][0] = MakeProgram( double_source_v3, sizeof(double_source_v3) / sizeof( double_source_v3[0]) );
|
doublePrograms[vectorSize][0] = MakeProgram( device, double_source_v3, sizeof(double_source_v3) / sizeof( double_source_v3[0]) );
|
||||||
} else {
|
} else {
|
||||||
doublePrograms[vectorSize][0] = MakeProgram( double_source, sizeof(double_source) / sizeof( double_source[0]) );
|
doublePrograms[vectorSize][0] = MakeProgram( device, double_source, sizeof(double_source) / sizeof( double_source[0]) );
|
||||||
}
|
}
|
||||||
if( NULL == doublePrograms[ vectorSize ][0] )
|
if( NULL == doublePrograms[ vectorSize ][0] )
|
||||||
{
|
{
|
||||||
@@ -999,9 +999,9 @@ int Test_vStoreHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const c
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(g_arrVecSizes[vectorSize] == 3)
|
if(g_arrVecSizes[vectorSize] == 3)
|
||||||
doublePrograms[vectorSize][1] = MakeProgram( double_source_private_store_v3, sizeof(double_source_private_store_v3) / sizeof( double_source_private_store_v3[0]) );
|
doublePrograms[vectorSize][1] = MakeProgram( device, double_source_private_store_v3, sizeof(double_source_private_store_v3) / sizeof( double_source_private_store_v3[0]) );
|
||||||
else
|
else
|
||||||
doublePrograms[vectorSize][1] = MakeProgram( double_source_private_store, sizeof(double_source_private_store) / sizeof( double_source_private_store[0]) );
|
doublePrograms[vectorSize][1] = MakeProgram( device, double_source_private_store, sizeof(double_source_private_store) / sizeof( double_source_private_store[0]) );
|
||||||
|
|
||||||
if( NULL == doublePrograms[ vectorSize ][1] )
|
if( NULL == doublePrograms[ vectorSize ][1] )
|
||||||
{
|
{
|
||||||
@@ -1018,9 +1018,9 @@ int Test_vStoreHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const c
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(g_arrVecSizes[vectorSize] == 3) {
|
if(g_arrVecSizes[vectorSize] == 3) {
|
||||||
doublePrograms[vectorSize][2] = MakeProgram( double_source_local_store_v3, sizeof(double_source_local_store_v3) / sizeof( double_source_local_store_v3[0]) );
|
doublePrograms[vectorSize][2] = MakeProgram( device, double_source_local_store_v3, sizeof(double_source_local_store_v3) / sizeof( double_source_local_store_v3[0]) );
|
||||||
} else {
|
} else {
|
||||||
doublePrograms[vectorSize][2] = MakeProgram( double_source_local_store, sizeof(double_source_local_store) / sizeof( double_source_local_store[0]) );
|
doublePrograms[vectorSize][2] = MakeProgram( device, double_source_local_store, sizeof(double_source_local_store) / sizeof( double_source_local_store[0]) );
|
||||||
}
|
}
|
||||||
if( NULL == doublePrograms[ vectorSize ][2] )
|
if( NULL == doublePrograms[ vectorSize ][2] )
|
||||||
{
|
{
|
||||||
@@ -1136,7 +1136,7 @@ int Test_vStoreHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const c
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = RunKernel(kernels[vectorSize][addressSpace], gInBuffer_single, gOutBuffer_half,
|
error = RunKernel(device, kernels[vectorSize][addressSpace], gInBuffer_single, gOutBuffer_half,
|
||||||
numVecs(count, vectorSize, aligned) ,
|
numVecs(count, vectorSize, aligned) ,
|
||||||
runsOverBy(count, vectorSize, aligned));
|
runsOverBy(count, vectorSize, aligned));
|
||||||
if (error) {
|
if (error) {
|
||||||
@@ -1167,7 +1167,7 @@ int Test_vStoreHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const c
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = RunKernel(doubleKernels[vectorSize][addressSpace], gInBuffer_double, gOutBuffer_half,
|
error = RunKernel(device, doubleKernels[vectorSize][addressSpace], gInBuffer_double, gOutBuffer_half,
|
||||||
numVecs(count, vectorSize, aligned),
|
numVecs(count, vectorSize, aligned),
|
||||||
runsOverBy(count, vectorSize, aligned));
|
runsOverBy(count, vectorSize, aligned));
|
||||||
if (error) {
|
if (error) {
|
||||||
@@ -1237,7 +1237,7 @@ int Test_vStoreHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const c
|
|||||||
uint64_t startTime = ReadTime();
|
uint64_t startTime = ReadTime();
|
||||||
|
|
||||||
|
|
||||||
if( (error = RunKernel( kernels[vectorSize][0], gInBuffer_single, gOutBuffer_half, numVecs(count, vectorSize, aligned) ,
|
if( (error = RunKernel(device, kernels[vectorSize][0], gInBuffer_single, gOutBuffer_half, numVecs(count, vectorSize, aligned) ,
|
||||||
runsOverBy(count, vectorSize, aligned)) ) )
|
runsOverBy(count, vectorSize, aligned)) ) )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
@@ -1264,7 +1264,7 @@ int Test_vStoreHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const c
|
|||||||
for( j = 0; j < loopCount; j++ )
|
for( j = 0; j < loopCount; j++ )
|
||||||
{
|
{
|
||||||
uint64_t startTime = ReadTime();
|
uint64_t startTime = ReadTime();
|
||||||
if( (error = RunKernel( doubleKernels[vectorSize][0], gInBuffer_double, gOutBuffer_half, numVecs(count, vectorSize, aligned) ,
|
if( (error = RunKernel(device, doubleKernels[vectorSize][0], gInBuffer_double, gOutBuffer_half, numVecs(count, vectorSize, aligned) ,
|
||||||
runsOverBy(count, vectorSize, aligned)) ) )
|
runsOverBy(count, vectorSize, aligned)) ) )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
@@ -1341,7 +1341,7 @@ exit:
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Test_vStoreaHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const char *roundName )
|
int Test_vStoreaHalf_private( cl_device_id device, f2h referenceFunc, d2h doubleReferenceFunc, const char *roundName )
|
||||||
{
|
{
|
||||||
int vectorSize, error;
|
int vectorSize, error;
|
||||||
cl_program programs[kVectorSizeCount+kStrangeVectorSizeCount][3];
|
cl_program programs[kVectorSizeCount+kStrangeVectorSizeCount][3];
|
||||||
@@ -1500,14 +1500,14 @@ int Test_vStoreaHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const
|
|||||||
};
|
};
|
||||||
|
|
||||||
if(g_arrVecSizes[vectorSize] == 3) {
|
if(g_arrVecSizes[vectorSize] == 3) {
|
||||||
programs[vectorSize][0] = MakeProgram( source_v3, sizeof(source_v3) / sizeof( source_v3[0]) );
|
programs[vectorSize][0] = MakeProgram( device, source_v3, sizeof(source_v3) / sizeof( source_v3[0]) );
|
||||||
if( NULL == programs[ vectorSize ][0] )
|
if( NULL == programs[ vectorSize ][0] )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
programs[vectorSize][0] = MakeProgram( source, sizeof(source) / sizeof( source[0]) );
|
programs[vectorSize][0] = MakeProgram( device, source, sizeof(source) / sizeof( source[0]) );
|
||||||
if( NULL == programs[ vectorSize ][0] )
|
if( NULL == programs[ vectorSize ][0] )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
@@ -1524,14 +1524,14 @@ int Test_vStoreaHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(g_arrVecSizes[vectorSize] == 3) {
|
if(g_arrVecSizes[vectorSize] == 3) {
|
||||||
programs[vectorSize][1] = MakeProgram( source_private_v3, sizeof(source_private_v3) / sizeof( source_private_v3[0]) );
|
programs[vectorSize][1] = MakeProgram( device, source_private_v3, sizeof(source_private_v3) / sizeof( source_private_v3[0]) );
|
||||||
if( NULL == programs[ vectorSize ][1] )
|
if( NULL == programs[ vectorSize ][1] )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
programs[vectorSize][1] = MakeProgram( source_private, sizeof(source_private) / sizeof( source_private[0]) );
|
programs[vectorSize][1] = MakeProgram( device, source_private, sizeof(source_private) / sizeof( source_private[0]) );
|
||||||
if( NULL == programs[ vectorSize ][1] )
|
if( NULL == programs[ vectorSize ][1] )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
@@ -1548,14 +1548,14 @@ int Test_vStoreaHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(g_arrVecSizes[vectorSize] == 3) {
|
if(g_arrVecSizes[vectorSize] == 3) {
|
||||||
programs[vectorSize][2] = MakeProgram( source_local_v3, sizeof(source_local_v3) / sizeof( source_local_v3[0]) );
|
programs[vectorSize][2] = MakeProgram( device, source_local_v3, sizeof(source_local_v3) / sizeof( source_local_v3[0]) );
|
||||||
if( NULL == programs[ vectorSize ][2] )
|
if( NULL == programs[ vectorSize ][2] )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
programs[vectorSize][2] = MakeProgram( source_local, sizeof(source_local) / sizeof( source_local[0]) );
|
programs[vectorSize][2] = MakeProgram( device, source_local, sizeof(source_local) / sizeof( source_local[0]) );
|
||||||
if( NULL == programs[ vectorSize ][2] )
|
if( NULL == programs[ vectorSize ][2] )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
@@ -1574,14 +1574,14 @@ int Test_vStoreaHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const
|
|||||||
if( gTestDouble )
|
if( gTestDouble )
|
||||||
{
|
{
|
||||||
if(g_arrVecSizes[vectorSize] == 3) {
|
if(g_arrVecSizes[vectorSize] == 3) {
|
||||||
doublePrograms[vectorSize][0] = MakeProgram( double_source_v3, sizeof(double_source_v3) / sizeof( double_source_v3[0]) );
|
doublePrograms[vectorSize][0] = MakeProgram( device, double_source_v3, sizeof(double_source_v3) / sizeof( double_source_v3[0]) );
|
||||||
if( NULL == doublePrograms[ vectorSize ][0] )
|
if( NULL == doublePrograms[ vectorSize ][0] )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
doublePrograms[vectorSize][0] = MakeProgram( double_source, sizeof(double_source) / sizeof( double_source[0]) );
|
doublePrograms[vectorSize][0] = MakeProgram( device, double_source, sizeof(double_source) / sizeof( double_source[0]) );
|
||||||
if( NULL == doublePrograms[ vectorSize ][0] )
|
if( NULL == doublePrograms[ vectorSize ][0] )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
@@ -1598,14 +1598,14 @@ int Test_vStoreaHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(g_arrVecSizes[vectorSize] == 3) {
|
if(g_arrVecSizes[vectorSize] == 3) {
|
||||||
doublePrograms[vectorSize][1] = MakeProgram( double_source_private_v3, sizeof(double_source_private_v3) / sizeof( double_source_private_v3[0]) );
|
doublePrograms[vectorSize][1] = MakeProgram( device, double_source_private_v3, sizeof(double_source_private_v3) / sizeof( double_source_private_v3[0]) );
|
||||||
if( NULL == doublePrograms[ vectorSize ][1] )
|
if( NULL == doublePrograms[ vectorSize ][1] )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
doublePrograms[vectorSize][1] = MakeProgram( double_source_private, sizeof(double_source_private) / sizeof( double_source_private[0]) );
|
doublePrograms[vectorSize][1] = MakeProgram( device, double_source_private, sizeof(double_source_private) / sizeof( double_source_private[0]) );
|
||||||
if( NULL == doublePrograms[ vectorSize ][1] )
|
if( NULL == doublePrograms[ vectorSize ][1] )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
@@ -1622,14 +1622,14 @@ int Test_vStoreaHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(g_arrVecSizes[vectorSize] == 3) {
|
if(g_arrVecSizes[vectorSize] == 3) {
|
||||||
doublePrograms[vectorSize][2] = MakeProgram( double_source_local_v3, sizeof(double_source_local_v3) / sizeof( double_source_local_v3[0]) );
|
doublePrograms[vectorSize][2] = MakeProgram( device, double_source_local_v3, sizeof(double_source_local_v3) / sizeof( double_source_local_v3[0]) );
|
||||||
if( NULL == doublePrograms[ vectorSize ][2] )
|
if( NULL == doublePrograms[ vectorSize ][2] )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
doublePrograms[vectorSize][2] = MakeProgram( double_source_local, sizeof(double_source_local) / sizeof( double_source_local[0]) );
|
doublePrograms[vectorSize][2] = MakeProgram( device, double_source_local, sizeof(double_source_local) / sizeof( double_source_local[0]) );
|
||||||
if( NULL == doublePrograms[ vectorSize ][2] )
|
if( NULL == doublePrograms[ vectorSize ][2] )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
@@ -1744,7 +1744,7 @@ int Test_vStoreaHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = RunKernel(kernels[vectorSize][addressSpace], gInBuffer_single, gOutBuffer_half,
|
error = RunKernel(device, kernels[vectorSize][addressSpace], gInBuffer_single, gOutBuffer_half,
|
||||||
numVecs(count, vectorSize, aligned),
|
numVecs(count, vectorSize, aligned),
|
||||||
runsOverBy(count, vectorSize, aligned));
|
runsOverBy(count, vectorSize, aligned));
|
||||||
if (error) {
|
if (error) {
|
||||||
@@ -1775,7 +1775,7 @@ int Test_vStoreaHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = RunKernel(doubleKernels[vectorSize][addressSpace], gInBuffer_double, gOutBuffer_half,
|
error = RunKernel(device, doubleKernels[vectorSize][addressSpace], gInBuffer_double, gOutBuffer_half,
|
||||||
numVecs(count, vectorSize, aligned),
|
numVecs(count, vectorSize, aligned),
|
||||||
runsOverBy(count, vectorSize, aligned));
|
runsOverBy(count, vectorSize, aligned));
|
||||||
if (error) {
|
if (error) {
|
||||||
@@ -1842,7 +1842,7 @@ int Test_vStoreaHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const
|
|||||||
for( j = 0; j < loopCount; j++ )
|
for( j = 0; j < loopCount; j++ )
|
||||||
{
|
{
|
||||||
uint64_t startTime = ReadTime();
|
uint64_t startTime = ReadTime();
|
||||||
if( (error = RunKernel( kernels[vectorSize][0], gInBuffer_single, gOutBuffer_half, numVecs(count, vectorSize, aligned) ,
|
if( (error = RunKernel(device, kernels[vectorSize][0], gInBuffer_single, gOutBuffer_half, numVecs(count, vectorSize, aligned) ,
|
||||||
runsOverBy(count, vectorSize, aligned)) ) )
|
runsOverBy(count, vectorSize, aligned)) ) )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
@@ -1869,7 +1869,7 @@ int Test_vStoreaHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const
|
|||||||
for( j = 0; j < loopCount; j++ )
|
for( j = 0; j < loopCount; j++ )
|
||||||
{
|
{
|
||||||
uint64_t startTime = ReadTime();
|
uint64_t startTime = ReadTime();
|
||||||
if( (error = RunKernel( doubleKernels[vectorSize][0], gInBuffer_double, gOutBuffer_half, numVecs(count, vectorSize, aligned) ,
|
if( (error = RunKernel(device, doubleKernels[vectorSize][0], gInBuffer_double, gOutBuffer_half, numVecs(count, vectorSize, aligned) ,
|
||||||
runsOverBy(count, vectorSize, aligned)) ) )
|
runsOverBy(count, vectorSize, aligned)) ) )
|
||||||
{
|
{
|
||||||
gFailCount++;
|
gFailCount++;
|
||||||
|
|||||||
@@ -52,8 +52,6 @@ cl_mem gOutBuffer_single = NULL;
|
|||||||
cl_mem gInBuffer_double = NULL;
|
cl_mem gInBuffer_double = NULL;
|
||||||
// cl_mem gOutBuffer_double = NULL;
|
// cl_mem gOutBuffer_double = NULL;
|
||||||
|
|
||||||
cl_device_type gDeviceType = CL_DEVICE_TYPE_DEFAULT;
|
|
||||||
cl_device_id gDevice = NULL;
|
|
||||||
cl_context gContext = NULL;
|
cl_context gContext = NULL;
|
||||||
cl_command_queue gQueue = NULL;
|
cl_command_queue gQueue = NULL;
|
||||||
uint32_t gDeviceFrequency = 0;
|
uint32_t gDeviceFrequency = 0;
|
||||||
@@ -64,8 +62,6 @@ int gFailCount = 0;
|
|||||||
bool gWimpyMode = false;
|
bool gWimpyMode = false;
|
||||||
int gWimpyReductionFactor = 512;
|
int gWimpyReductionFactor = 512;
|
||||||
int gTestDouble = 0;
|
int gTestDouble = 0;
|
||||||
uint32_t gDeviceIndex = 0;
|
|
||||||
size_t gBufferSize = 0;
|
|
||||||
|
|
||||||
#if defined( __APPLE__ )
|
#if defined( __APPLE__ )
|
||||||
int gReportTimes = 1;
|
int gReportTimes = 1;
|
||||||
@@ -75,43 +71,18 @@ int gReportTimes = 0;
|
|||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
int InitCL( void )
|
test_status InitCL( cl_device_id device )
|
||||||
{
|
{
|
||||||
cl_platform_id platform = NULL;
|
|
||||||
size_t configSize = sizeof( gComputeDevices );
|
size_t configSize = sizeof( gComputeDevices );
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if( (error = clGetPlatformIDs(1, &platform, NULL) ) )
|
|
||||||
return error;
|
|
||||||
|
|
||||||
// gDeviceType & gDeviceIndex are globals set in ParseArgs
|
|
||||||
|
|
||||||
cl_uint ndevices;
|
|
||||||
if ( (error = clGetDeviceIDs(platform, gDeviceType, 0, NULL, &ndevices)) )
|
|
||||||
return error;
|
|
||||||
|
|
||||||
cl_device_id *gDeviceList = (cl_device_id *)malloc(ndevices*sizeof( cl_device_id ));
|
|
||||||
if ( gDeviceList == 0 )
|
|
||||||
{
|
|
||||||
log_error("Unable to allocate memory for devices\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if( (error = clGetDeviceIDs(platform, gDeviceType, ndevices, gDeviceList, NULL )) )
|
|
||||||
{
|
|
||||||
free( gDeviceList );
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
gDevice = gDeviceList[gDeviceIndex];
|
|
||||||
free( gDeviceList );
|
|
||||||
|
|
||||||
#if MULTITHREAD
|
#if MULTITHREAD
|
||||||
if( (error = clGetDeviceInfo( gDevice, CL_DEVICE_MAX_COMPUTE_UNITS, configSize, &gComputeDevices, NULL )) )
|
if( (error = clGetDeviceInfo( device, CL_DEVICE_MAX_COMPUTE_UNITS, configSize, &gComputeDevices, NULL )) )
|
||||||
#endif
|
#endif
|
||||||
gComputeDevices = 1;
|
gComputeDevices = 1;
|
||||||
|
|
||||||
configSize = sizeof( gMaxThreadGroupSize );
|
configSize = sizeof( gMaxThreadGroupSize );
|
||||||
if( (error = clGetDeviceInfo( gDevice, CL_DEVICE_MAX_WORK_GROUP_SIZE, configSize, &gMaxThreadGroupSize, NULL )) )
|
if( (error = clGetDeviceInfo( device, CL_DEVICE_MAX_WORK_GROUP_SIZE, configSize, &gMaxThreadGroupSize, NULL )) )
|
||||||
gMaxThreadGroupSize = 1;
|
gMaxThreadGroupSize = 1;
|
||||||
|
|
||||||
// Use only one-eighth the work group size
|
// Use only one-eighth the work group size
|
||||||
@@ -121,13 +92,13 @@ int InitCL( void )
|
|||||||
gWorkGroupSize = gMaxThreadGroupSize;
|
gWorkGroupSize = gMaxThreadGroupSize;
|
||||||
|
|
||||||
configSize = sizeof( gDeviceFrequency );
|
configSize = sizeof( gDeviceFrequency );
|
||||||
if( (error = clGetDeviceInfo( gDevice, CL_DEVICE_MAX_CLOCK_FREQUENCY, configSize, &gDeviceFrequency, NULL )) )
|
if( (error = clGetDeviceInfo( device, CL_DEVICE_MAX_CLOCK_FREQUENCY, configSize, &gDeviceFrequency, NULL )) )
|
||||||
gDeviceFrequency = 1;
|
gDeviceFrequency = 1;
|
||||||
|
|
||||||
// Check extensions
|
// Check extensions
|
||||||
size_t extSize = 0;
|
size_t extSize = 0;
|
||||||
int hasDouble = 0;
|
int hasDouble = 0;
|
||||||
if((error = clGetDeviceInfo( gDevice, CL_DEVICE_EXTENSIONS, 0, NULL, &extSize)))
|
if((error = clGetDeviceInfo( device, CL_DEVICE_EXTENSIONS, 0, NULL, &extSize)))
|
||||||
{ vlog_error( "Unable to get device extension string to see if double present. (%d) \n", error ); }
|
{ vlog_error( "Unable to get device extension string to see if double present. (%d) \n", error ); }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -136,7 +107,7 @@ int InitCL( void )
|
|||||||
{ vlog_error( "malloc failed at %s:%d\nUnable to determine if double present.\n", __FILE__, __LINE__ ); }
|
{ vlog_error( "malloc failed at %s:%d\nUnable to determine if double present.\n", __FILE__, __LINE__ ); }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if((error = clGetDeviceInfo( gDevice, CL_DEVICE_EXTENSIONS, extSize, ext, NULL)))
|
if((error = clGetDeviceInfo( device, CL_DEVICE_EXTENSIONS, extSize, ext, NULL)))
|
||||||
{ vlog_error( "Unable to get device extension string to see if double present. (%d) \n", error ); }
|
{ vlog_error( "Unable to get device extension string to see if double present. (%d) \n", error ); }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -152,7 +123,7 @@ int InitCL( void )
|
|||||||
|
|
||||||
//detect whether profile of the device is embedded
|
//detect whether profile of the device is embedded
|
||||||
char profile[64] = "";
|
char profile[64] = "";
|
||||||
if( (error = clGetDeviceInfo( gDevice, CL_DEVICE_PROFILE, sizeof(profile), profile, NULL ) ) )
|
if( (error = clGetDeviceInfo( device, CL_DEVICE_PROFILE, sizeof(profile), profile, NULL ) ) )
|
||||||
{
|
{
|
||||||
vlog_error( "Unable to get device CL DEVICE PROFILE string. (%d) \n", error );
|
vlog_error( "Unable to get device CL DEVICE PROFILE string. (%d) \n", error );
|
||||||
}
|
}
|
||||||
@@ -164,36 +135,34 @@ int InitCL( void )
|
|||||||
vlog( "%d compute devices at %f GHz\n", gComputeDevices, (double) gDeviceFrequency / 1000. );
|
vlog( "%d compute devices at %f GHz\n", gComputeDevices, (double) gDeviceFrequency / 1000. );
|
||||||
vlog( "Max thread group size is %lld.\n", (uint64_t) gMaxThreadGroupSize );
|
vlog( "Max thread group size is %lld.\n", (uint64_t) gMaxThreadGroupSize );
|
||||||
|
|
||||||
gContext = clCreateContext( NULL, 1, &gDevice, notify_callback, NULL, &error );
|
gContext = clCreateContext( NULL, 1, &device, notify_callback, NULL, &error );
|
||||||
if( NULL == gContext )
|
if( NULL == gContext )
|
||||||
{
|
{
|
||||||
vlog_error( "clCreateDeviceGroup failed. (%d)\n", error );
|
vlog_error( "clCreateDeviceGroup failed. (%d)\n", error );
|
||||||
return -1;
|
return TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gQueue = clCreateCommandQueueWithProperties(gContext, gDevice, 0, &error);
|
gQueue = clCreateCommandQueueWithProperties(gContext, device, 0, &error);
|
||||||
if( NULL == gQueue )
|
if( NULL == gQueue )
|
||||||
{
|
{
|
||||||
vlog_error( "clCreateContext failed. (%d)\n", error );
|
vlog_error( "clCreateContext failed. (%d)\n", error );
|
||||||
return -2;
|
return TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined( __APPLE__ )
|
#if defined( __APPLE__ )
|
||||||
// FIXME: use clProtectedArray
|
// FIXME: use clProtectedArray
|
||||||
#endif
|
#endif
|
||||||
gBufferSize = getBufferSize(gDevice);
|
|
||||||
|
|
||||||
//Allocate buffers
|
//Allocate buffers
|
||||||
gIn_half = malloc( gBufferSize/2 );
|
gIn_half = malloc( getBufferSize(device)/2 );
|
||||||
gOut_half = malloc( BUFFER_SIZE/2 );
|
gOut_half = malloc( BUFFER_SIZE/2 );
|
||||||
gOut_half_reference = malloc( BUFFER_SIZE/2 );
|
gOut_half_reference = malloc( BUFFER_SIZE/2 );
|
||||||
gOut_half_reference_double = malloc( BUFFER_SIZE/2 );
|
gOut_half_reference_double = malloc( BUFFER_SIZE/2 );
|
||||||
gIn_single = malloc( BUFFER_SIZE );
|
gIn_single = malloc( BUFFER_SIZE );
|
||||||
gOut_single = malloc( gBufferSize );
|
gOut_single = malloc( getBufferSize(device) );
|
||||||
gOut_single_reference = malloc( gBufferSize );
|
gOut_single_reference = malloc( getBufferSize(device) );
|
||||||
gIn_double = malloc( 2*BUFFER_SIZE );
|
gIn_double = malloc( 2*BUFFER_SIZE );
|
||||||
// gOut_double = malloc( (2*gBufferSize) );
|
// gOut_double = malloc( (2*getBufferSize(device)) );
|
||||||
// gOut_double_reference = malloc( (2*gBufferSize) );
|
// gOut_double_reference = malloc( (2*getBufferSize(device)) );
|
||||||
|
|
||||||
if ( NULL == gIn_half ||
|
if ( NULL == gIn_half ||
|
||||||
NULL == gOut_half ||
|
NULL == gOut_half ||
|
||||||
@@ -204,73 +173,73 @@ int InitCL( void )
|
|||||||
NULL == gOut_single_reference ||
|
NULL == gOut_single_reference ||
|
||||||
NULL == gIn_double // || NULL == gOut_double || NULL == gOut_double_reference
|
NULL == gIn_double // || NULL == gOut_double || NULL == gOut_double_reference
|
||||||
)
|
)
|
||||||
return -3;
|
return TEST_FAIL;
|
||||||
|
|
||||||
gInBuffer_half = clCreateBuffer(gContext, CL_MEM_READ_ONLY, gBufferSize / 2, NULL, &error);
|
gInBuffer_half = clCreateBuffer(gContext, CL_MEM_READ_ONLY, getBufferSize(device) / 2, NULL, &error);
|
||||||
if( gInBuffer_half == NULL )
|
if( gInBuffer_half == NULL )
|
||||||
{
|
{
|
||||||
vlog_error( "clCreateArray failed for input (%d)\n", error );
|
vlog_error( "clCreateArray failed for input (%d)\n", error );
|
||||||
return -4;
|
return TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gInBuffer_single = clCreateBuffer(gContext, CL_MEM_READ_ONLY, BUFFER_SIZE, NULL, &error );
|
gInBuffer_single = clCreateBuffer(gContext, CL_MEM_READ_ONLY, BUFFER_SIZE, NULL, &error );
|
||||||
if( gInBuffer_single == NULL )
|
if( gInBuffer_single == NULL )
|
||||||
{
|
{
|
||||||
vlog_error( "clCreateArray failed for input (%d)\n", error );
|
vlog_error( "clCreateArray failed for input (%d)\n", error );
|
||||||
return -4;
|
return TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gInBuffer_double = clCreateBuffer(gContext, CL_MEM_READ_ONLY, BUFFER_SIZE*2, NULL, &error );
|
gInBuffer_double = clCreateBuffer(gContext, CL_MEM_READ_ONLY, BUFFER_SIZE*2, NULL, &error );
|
||||||
if( gInBuffer_double == NULL )
|
if( gInBuffer_double == NULL )
|
||||||
{
|
{
|
||||||
vlog_error( "clCreateArray failed for input (%d)\n", error );
|
vlog_error( "clCreateArray failed for input (%d)\n", error );
|
||||||
return -4;
|
return TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gOutBuffer_half = clCreateBuffer(gContext, CL_MEM_WRITE_ONLY, BUFFER_SIZE/2, NULL, &error );
|
gOutBuffer_half = clCreateBuffer(gContext, CL_MEM_WRITE_ONLY, BUFFER_SIZE/2, NULL, &error );
|
||||||
if( gOutBuffer_half == NULL )
|
if( gOutBuffer_half == NULL )
|
||||||
{
|
{
|
||||||
vlog_error( "clCreateArray failed for output (%d)\n", error );
|
vlog_error( "clCreateArray failed for output (%d)\n", error );
|
||||||
return -5;
|
return TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gOutBuffer_single = clCreateBuffer(gContext, CL_MEM_WRITE_ONLY, gBufferSize, NULL, &error );
|
gOutBuffer_single = clCreateBuffer(gContext, CL_MEM_WRITE_ONLY, getBufferSize(device), NULL, &error );
|
||||||
if( gOutBuffer_single == NULL )
|
if( gOutBuffer_single == NULL )
|
||||||
{
|
{
|
||||||
vlog_error( "clCreateArray failed for output (%d)\n", error );
|
vlog_error( "clCreateArray failed for output (%d)\n", error );
|
||||||
return -5;
|
return TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
gOutBuffer_double = clCreateBuffer(gContext, CL_MEM_WRITE_ONLY, (size_t)(2*gBufferSize), NULL, &error );
|
gOutBuffer_double = clCreateBuffer(gContext, CL_MEM_WRITE_ONLY, (size_t)(2*getBufferSize(device)), NULL, &error );
|
||||||
if( gOutBuffer_double == NULL )
|
if( gOutBuffer_double == NULL )
|
||||||
{
|
{
|
||||||
vlog_error( "clCreateArray failed for output (%d)\n", error );
|
vlog_error( "clCreateArray failed for output (%d)\n", error );
|
||||||
return -5;
|
return TEST_FAIL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char string[16384];
|
char string[16384];
|
||||||
vlog( "\nCompute Device info:\n" );
|
vlog( "\nCompute Device info:\n" );
|
||||||
error = clGetDeviceInfo(gDevice, CL_DEVICE_NAME, sizeof(string), string, NULL);
|
error = clGetDeviceInfo(device, CL_DEVICE_NAME, sizeof(string), string, NULL);
|
||||||
vlog( "\tDevice Name: %s\n", string );
|
vlog( "\tDevice Name: %s\n", string );
|
||||||
error = clGetDeviceInfo(gDevice, CL_DEVICE_VENDOR, sizeof(string), string, NULL);
|
error = clGetDeviceInfo(device, CL_DEVICE_VENDOR, sizeof(string), string, NULL);
|
||||||
vlog( "\tVendor: %s\n", string );
|
vlog( "\tVendor: %s\n", string );
|
||||||
error = clGetDeviceInfo(gDevice, CL_DEVICE_VERSION, sizeof(string), string, NULL);
|
error = clGetDeviceInfo(device, CL_DEVICE_VERSION, sizeof(string), string, NULL);
|
||||||
vlog( "\tDevice Version: %s\n", string );
|
vlog( "\tDevice Version: %s\n", string );
|
||||||
error = clGetDeviceInfo(gDevice, CL_DEVICE_OPENCL_C_VERSION, sizeof(string), string, NULL);
|
error = clGetDeviceInfo(device, CL_DEVICE_OPENCL_C_VERSION, sizeof(string), string, NULL);
|
||||||
vlog( "\tOpenCL C Version: %s\n", string );
|
vlog( "\tOpenCL C Version: %s\n", string );
|
||||||
error = clGetDeviceInfo(gDevice, CL_DRIVER_VERSION, sizeof(string), string, NULL);
|
error = clGetDeviceInfo(device, CL_DRIVER_VERSION, sizeof(string), string, NULL);
|
||||||
vlog( "\tDriver Version: %s\n", string );
|
vlog( "\tDriver Version: %s\n", string );
|
||||||
vlog( "\tProcessing with %d devices\n", gComputeDevices );
|
vlog( "\tProcessing with %d devices\n", gComputeDevices );
|
||||||
vlog( "\tDevice Frequency: %d MHz\n", gDeviceFrequency );
|
vlog( "\tDevice Frequency: %d MHz\n", gDeviceFrequency );
|
||||||
vlog( "\tHas double? %s\n", hasDouble ? "YES" : "NO" );
|
vlog( "\tHas double? %s\n", hasDouble ? "YES" : "NO" );
|
||||||
vlog( "\tTest double? %s\n", gTestDouble ? "YES" : "NO" );
|
vlog( "\tTest double? %s\n", gTestDouble ? "YES" : "NO" );
|
||||||
|
|
||||||
return 0;
|
return TEST_PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
cl_program MakeProgram( const char *source[], int count )
|
cl_program MakeProgram( cl_device_id device, const char *source[], int count )
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
int i;
|
int i;
|
||||||
@@ -285,13 +254,13 @@ cl_program MakeProgram( const char *source[], int count )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// build it
|
// build it
|
||||||
if( (error = clBuildProgram( program, 1, &gDevice, NULL, NULL, NULL )) )
|
if( (error = clBuildProgram( program, 1, &device, NULL, NULL, NULL )) )
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
char buffer[16384];
|
char buffer[16384];
|
||||||
|
|
||||||
vlog_error("\t\tFAILED -- clBuildProgramExecutable() failed:\n");
|
vlog_error("\t\tFAILED -- clBuildProgramExecutable() failed:\n");
|
||||||
clGetProgramBuildInfo(program, gDevice, CL_PROGRAM_BUILD_LOG, sizeof(buffer), buffer, &len);
|
clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, sizeof(buffer), buffer, &len);
|
||||||
vlog_error("Log: %s\n", buffer);
|
vlog_error("Log: %s\n", buffer);
|
||||||
vlog_error("Source :\n");
|
vlog_error("Source :\n");
|
||||||
for(i = 0; i < count; ++i) {
|
for(i = 0; i < count; ++i) {
|
||||||
@@ -347,7 +316,7 @@ void printSource(const char * src[], int len) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int RunKernel( cl_kernel kernel, void *inBuf, void *outBuf, uint32_t blockCount , int extraArg)
|
int RunKernel( cl_device_id device, cl_kernel kernel, void *inBuf, void *outBuf, uint32_t blockCount , int extraArg)
|
||||||
{
|
{
|
||||||
size_t localCount = blockCount;
|
size_t localCount = blockCount;
|
||||||
size_t wg_size;
|
size_t wg_size;
|
||||||
@@ -366,7 +335,7 @@ int RunKernel( cl_kernel kernel, void *inBuf, void *outBuf, uint32_t blockCount
|
|||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = clGetKernelWorkGroupInfo(kernel, gDevice, CL_KERNEL_WORK_GROUP_SIZE, sizeof( wg_size ), &wg_size, NULL);
|
error = clGetKernelWorkGroupInfo(kernel, device, CL_KERNEL_WORK_GROUP_SIZE, sizeof( wg_size ), &wg_size, NULL);
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
vlog_error( "FAILED -- could not get kernel work group info\n" );
|
vlog_error( "FAILED -- could not get kernel work group info\n" );
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#ifndef CL_UTILS_H
|
#ifndef CL_UTILS_H
|
||||||
#define CL_UTILS_H
|
#define CL_UTILS_H
|
||||||
|
|
||||||
|
#include "../../test_common/harness/testHarness.h"
|
||||||
#include "../../test_common/harness/compat.h"
|
#include "../../test_common/harness/compat.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -59,9 +60,6 @@ extern cl_mem gOutBuffer_single;
|
|||||||
extern cl_mem gInBuffer_double;
|
extern cl_mem gInBuffer_double;
|
||||||
// extern cl_mem gOutBuffer_double;
|
// extern cl_mem gOutBuffer_double;
|
||||||
|
|
||||||
extern uint32_t gDeviceIndex;
|
|
||||||
extern cl_device_type gDeviceType;
|
|
||||||
extern cl_device_id gDevice;
|
|
||||||
extern cl_context gContext;
|
extern cl_context gContext;
|
||||||
extern cl_command_queue gQueue;
|
extern cl_command_queue gQueue;
|
||||||
extern uint32_t gDeviceFrequency;
|
extern uint32_t gDeviceFrequency;
|
||||||
@@ -71,7 +69,6 @@ extern size_t gWorkGroupSize;
|
|||||||
extern int gFailCount;
|
extern int gFailCount;
|
||||||
extern int gTestDouble;
|
extern int gTestDouble;
|
||||||
extern int gReportTimes;
|
extern int gReportTimes;
|
||||||
extern size_t gBufferSize;
|
|
||||||
|
|
||||||
// gWimpyMode indicates if we run the test in wimpy mode where we limit the
|
// 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
|
// size of 32 bit ranges to a much smaller set. This is meant to be used
|
||||||
@@ -92,10 +89,10 @@ extern const char *vector_size_strings[kVectorSizeCount+kStrangeVectorSizeCount]
|
|||||||
extern const char *align_divisors[kVectorSizeCount+kStrangeVectorSizeCount];
|
extern const char *align_divisors[kVectorSizeCount+kStrangeVectorSizeCount];
|
||||||
extern const char *align_types[kVectorSizeCount+kStrangeVectorSizeCount];
|
extern const char *align_types[kVectorSizeCount+kStrangeVectorSizeCount];
|
||||||
|
|
||||||
int InitCL( void );
|
test_status InitCL( cl_device_id device );
|
||||||
void ReleaseCL( void );
|
void ReleaseCL( void );
|
||||||
int RunKernel( cl_kernel kernel, void *inBuf, void *outBuf, uint32_t blockCount , int extraArg);
|
int RunKernel( cl_device_id device, cl_kernel kernel, void *inBuf, void *outBuf, uint32_t blockCount , int extraArg);
|
||||||
cl_program MakeProgram( const char *source[], int count );
|
cl_program MakeProgram( cl_device_id device, const char *source[], int count );
|
||||||
|
|
||||||
#define STRING( _x ) STRINGIFY( _x )
|
#define STRING( _x ) STRINGIFY( _x )
|
||||||
#define STRINGIFY(x) #x
|
#define STRINGIFY(x) #x
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ const char *addressSpaceNames[] = {"global", "private", "local", "constant"};
|
|||||||
static int ParseArgs( int argc, const char **argv );
|
static int ParseArgs( int argc, const char **argv );
|
||||||
static void PrintUsage( void );
|
static void PrintUsage( void );
|
||||||
static void PrintArch(void);
|
static void PrintArch(void);
|
||||||
static void PrintDevice(void);
|
|
||||||
|
|
||||||
|
|
||||||
int g_arrVecSizes[kVectorSizeCount+kStrangeVectorSizeCount];
|
int g_arrVecSizes[kVectorSizeCount+kStrangeVectorSizeCount];
|
||||||
@@ -94,8 +93,6 @@ int main (int argc, const char **argv )
|
|||||||
g_arrVecAligns[i] = alignbound;
|
g_arrVecAligns[i] = alignbound;
|
||||||
}
|
}
|
||||||
|
|
||||||
test_start();
|
|
||||||
|
|
||||||
argc = parseCustomParam(argc, argv);
|
argc = parseCustomParam(argc, argv);
|
||||||
if (argc == -1)
|
if (argc == -1)
|
||||||
{
|
{
|
||||||
@@ -106,9 +103,6 @@ int main (int argc, const char **argv )
|
|||||||
if( (error = ParseArgs( argc, argv )) )
|
if( (error = ParseArgs( argc, argv )) )
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
if( (error = InitCL()) )
|
|
||||||
goto exit;
|
|
||||||
|
|
||||||
if (gIsEmbedded) {
|
if (gIsEmbedded) {
|
||||||
vlog( "\tProfile: Embedded\n" );
|
vlog( "\tProfile: Embedded\n" );
|
||||||
}else
|
}else
|
||||||
@@ -117,7 +111,7 @@ int main (int argc, const char **argv )
|
|||||||
}
|
}
|
||||||
|
|
||||||
fflush( stdout );
|
fflush( stdout );
|
||||||
error = parseAndCallCommandLineTests( argCount, argList, NULL, test_num, test_list, true, 0, 0 );
|
error = runTestHarnessWithCheck( argCount, argList, test_num, test_list, false, true, 0, InitCL );
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
if(gQueue)
|
if(gQueue)
|
||||||
@@ -135,8 +129,6 @@ exit:
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReleaseCL();
|
ReleaseCL();
|
||||||
test_finish();
|
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,43 +175,6 @@ static int ParseArgs( int argc, const char **argv )
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Check for environment variable to set device type */
|
|
||||||
char *env_mode = getenv( "CL_DEVICE_TYPE" );
|
|
||||||
if( env_mode != NULL )
|
|
||||||
{
|
|
||||||
if( strcmp( env_mode, "gpu" ) == 0 || strcmp( env_mode, "CL_DEVICE_TYPE_GPU" ) == 0 )
|
|
||||||
gDeviceType = CL_DEVICE_TYPE_GPU;
|
|
||||||
else if( strcmp( env_mode, "cpu" ) == 0 || strcmp( env_mode, "CL_DEVICE_TYPE_CPU" ) == 0 )
|
|
||||||
gDeviceType = CL_DEVICE_TYPE_CPU;
|
|
||||||
else if( strcmp( env_mode, "accelerator" ) == 0 || strcmp( env_mode, "CL_DEVICE_TYPE_ACCELERATOR" ) == 0 )
|
|
||||||
gDeviceType = CL_DEVICE_TYPE_ACCELERATOR;
|
|
||||||
else if( strcmp( env_mode, "default" ) == 0 || strcmp( env_mode, "CL_DEVICE_TYPE_DEFAULT" ) == 0 )
|
|
||||||
gDeviceType = CL_DEVICE_TYPE_DEFAULT;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
vlog_error( "Unknown CL_DEVICE_TYPE env variable setting: %s.\nAborting...\n", env_mode );
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int num_devices;
|
|
||||||
cl_platform_id platform = NULL;
|
|
||||||
clGetPlatformIDs(1, &platform, NULL);
|
|
||||||
clGetDeviceIDs(platform, gDeviceType, 0, NULL, &num_devices);
|
|
||||||
|
|
||||||
const char* device_index_env = getenv("CL_DEVICE_INDEX");
|
|
||||||
if (device_index_env) {
|
|
||||||
if (device_index_env) {
|
|
||||||
gDeviceIndex = atoi(device_index_env);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gDeviceIndex >= num_devices) {
|
|
||||||
vlog("Specified CL_DEVICE_INDEX=%d out of range, using index 0.\n",
|
|
||||||
gDeviceIndex);
|
|
||||||
gDeviceIndex = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vlog( "\n%s", appName );
|
vlog( "\n%s", appName );
|
||||||
for( i = 1; i < argc; i++ )
|
for( i = 1; i < argc; i++ )
|
||||||
{
|
{
|
||||||
@@ -262,22 +217,11 @@ static int ParseArgs( int argc, const char **argv )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if( 0 == strcmp( arg, "CL_DEVICE_TYPE_CPU" ) )
|
|
||||||
gDeviceType = CL_DEVICE_TYPE_CPU;
|
|
||||||
else if( 0 == strcmp( arg, "CL_DEVICE_TYPE_GPU" ) )
|
|
||||||
gDeviceType = CL_DEVICE_TYPE_GPU;
|
|
||||||
else if( 0 == strcmp( arg, "CL_DEVICE_TYPE_ACCELERATOR" ) )
|
|
||||||
gDeviceType = CL_DEVICE_TYPE_ACCELERATOR;
|
|
||||||
else if( 0 == strcmp( arg, "CL_DEVICE_TYPE_DEFAULT" ) )
|
|
||||||
gDeviceType = CL_DEVICE_TYPE_DEFAULT;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
argList[ argCount ] = arg;
|
argList[ argCount ] = arg;
|
||||||
argCount++;
|
argCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (getenv("CL_WIMPY_MODE")) {
|
if (getenv("CL_WIMPY_MODE")) {
|
||||||
vlog( "\n" );
|
vlog( "\n" );
|
||||||
@@ -287,7 +231,6 @@ static int ParseArgs( int argc, const char **argv )
|
|||||||
|
|
||||||
vlog( "Test binary built %s %s\n", __DATE__, __TIME__ );
|
vlog( "Test binary built %s %s\n", __DATE__, __TIME__ );
|
||||||
PrintArch();
|
PrintArch();
|
||||||
PrintDevice();
|
|
||||||
if( gWimpyMode )
|
if( gWimpyMode )
|
||||||
{
|
{
|
||||||
vlog( "\n" );
|
vlog( "\n" );
|
||||||
@@ -343,21 +286,3 @@ static void PrintArch( void )
|
|||||||
vlog( "cpu subtype:\t%d\n", type );
|
vlog( "cpu subtype:\t%d\n", type );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PrintDevice( void)
|
|
||||||
{
|
|
||||||
switch(gDeviceType) {
|
|
||||||
case CL_DEVICE_TYPE_CPU:
|
|
||||||
vlog( "DEVICE:\tcpu\n" );
|
|
||||||
break;
|
|
||||||
case CL_DEVICE_TYPE_GPU:
|
|
||||||
vlog( "DEVICE:\tgpu\n" );
|
|
||||||
break;
|
|
||||||
case CL_DEVICE_TYPE_ACCELERATOR:
|
|
||||||
vlog( "DEVICE:\taccelerator\n" );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
vlog_error( "DEVICE:\tunknown\n" );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ int test_roundTrip( cl_device_id deviceID, cl_context context, cl_command_queue
|
|||||||
|
|
||||||
typedef cl_ushort (*f2h)( float );
|
typedef cl_ushort (*f2h)( float );
|
||||||
typedef cl_ushort (*d2h)( double );
|
typedef cl_ushort (*d2h)( double );
|
||||||
int Test_vStoreHalf_private( f2h referenceFunc, d2h referenceDoubleFunc, const char *roundName );
|
int Test_vStoreHalf_private( cl_device_id device, f2h referenceFunc, d2h referenceDoubleFunc, const char *roundName );
|
||||||
int Test_vStoreaHalf_private( f2h referenceFunc, d2h referenceDoubleFunc, const char *roundName );
|
int Test_vStoreaHalf_private( cl_device_id device, f2h referenceFunc, d2h referenceDoubleFunc, const char *roundName );
|
||||||
|
|
||||||
#endif /* TESTS_H */
|
#endif /* TESTS_H */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user