mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Use memcmp for select verification. (#1084)
* Use memcmp for select verification. If memcmp fails, fall back to looping through the result buffer to find the incorrect result. * Removed extra prints for check_int.
This commit is contained in:
@@ -561,13 +561,18 @@ size_t check_uchar(void *test, void *correct, size_t count, size_t vector_size)
|
|||||||
const cl_uchar *c = (const cl_uchar *) correct;
|
const cl_uchar *c = (const cl_uchar *) correct;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for(i = 0; i < count; i++)
|
if (memcmp(t, c, count * sizeof(c[0])) != 0)
|
||||||
if (t[i] != c[i]) {
|
{
|
||||||
log_error("\n(check_uchar) Error for vector size %ld found at 0x%8.8lx (of 0x%8.8lx): "
|
for (i = 0; i < count; i++)
|
||||||
"*0x%2.2x vs 0x%2.2x\n", vector_size, i, count, c[i], t[i]);
|
if (t[i] != c[i])
|
||||||
return i + 1;
|
{
|
||||||
}
|
log_error("\n(check_uchar) Error for vector size %ld found at "
|
||||||
|
"0x%8.8lx (of 0x%8.8lx): "
|
||||||
|
"*0x%2.2x vs 0x%2.2x\n",
|
||||||
|
vector_size, i, count, c[i], t[i]);
|
||||||
|
return i + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -576,13 +581,18 @@ size_t check_char(void *test, void *correct, size_t count, size_t vector_size) {
|
|||||||
const cl_char *c = (const cl_char *) correct;
|
const cl_char *c = (const cl_char *) correct;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
if (memcmp(t, c, count * sizeof(c[0])) != 0)
|
||||||
for( i = 0; i < count; i++ )
|
{
|
||||||
if( t[i] != c[i] ) {
|
for (i = 0; i < count; i++)
|
||||||
log_error("\n(check_char) Error for vector size %ld found at 0x%8.8lx (of 0x%8.8lx): "
|
if (t[i] != c[i])
|
||||||
"*0x%2.2x vs 0x%2.2x\n", vector_size, i, count, c[i], t[i] );
|
{
|
||||||
return i + 1;
|
log_error("\n(check_char) Error for vector size %ld found at "
|
||||||
}
|
"0x%8.8lx (of 0x%8.8lx): "
|
||||||
|
"*0x%2.2x vs 0x%2.2x\n",
|
||||||
|
vector_size, i, count, c[i], t[i]);
|
||||||
|
return i + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -592,13 +602,18 @@ size_t check_ushort(void *test, void *correct, size_t count, size_t vector_size)
|
|||||||
const cl_ushort *c = (const cl_ushort *) correct;
|
const cl_ushort *c = (const cl_ushort *) correct;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
if (memcmp(t, c, count * sizeof(c[0])) != 0)
|
||||||
for( i = 0; i < count; i++ )
|
{
|
||||||
if(t[i] != c[i]) {
|
for (i = 0; i < count; i++)
|
||||||
log_error("\n(check_ushort) Error for vector size %ld found at 0x%8.8lx (of 0x%8.8lx): "
|
if (t[i] != c[i])
|
||||||
"*0x%4.4x vs 0x%4.4x\n", vector_size, i, count, c[i], t[i] );
|
{
|
||||||
return i + 1;
|
log_error("\n(check_ushort) Error for vector size %ld found at "
|
||||||
}
|
"0x%8.8lx (of 0x%8.8lx): "
|
||||||
|
"*0x%4.4x vs 0x%4.4x\n",
|
||||||
|
vector_size, i, count, c[i], t[i]);
|
||||||
|
return i + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -608,13 +623,18 @@ size_t check_short(void *test, void *correct, size_t count, size_t vector_size)
|
|||||||
const cl_short *c = (const cl_short *) correct;
|
const cl_short *c = (const cl_short *) correct;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
if (memcmp(t, c, count * sizeof(c[0])) != 0)
|
||||||
for (i = 0; i < count; i++)
|
{
|
||||||
if(t[i] != c[i]) {
|
for (i = 0; i < count; i++)
|
||||||
log_error("\n(check_short) Error for vector size %ld found at 0x%8.8lx (of 0x%8.8lx): "
|
if (t[i] != c[i])
|
||||||
"*0x%8.8x vs 0x%8.8x\n", vector_size, i, count, c[i], t[i] );
|
{
|
||||||
return i + 1;
|
log_error("\n(check_short) Error for vector size %ld found at "
|
||||||
}
|
"0x%8.8lx (of 0x%8.8lx): "
|
||||||
|
"*0x%8.8x vs 0x%8.8x\n",
|
||||||
|
vector_size, i, count, c[i], t[i]);
|
||||||
|
return i + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -624,14 +644,18 @@ size_t check_uint(void *test, void *correct, size_t count, size_t vector_size) {
|
|||||||
const cl_uint *c = (const cl_uint *) correct;
|
const cl_uint *c = (const cl_uint *) correct;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
if (memcmp(t, c, count * sizeof(c[0])) != 0)
|
||||||
|
{
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
if(t[i] != c[i]) {
|
if (t[i] != c[i])
|
||||||
log_error("\n(check_uint) Error for vector size %ld found at 0x%8.8lx (of 0x%8.8lx): "
|
{
|
||||||
"*0x%8.8x vs 0x%8.8x\n", vector_size, i, count, c[i], t[i] );
|
log_error("\n(check_uint) Error for vector size %ld found at "
|
||||||
return i + 1;
|
"0x%8.8lx (of 0x%8.8lx): "
|
||||||
}
|
"*0x%8.8x vs 0x%8.8x\n",
|
||||||
|
vector_size, i, count, c[i], t[i]);
|
||||||
|
return i + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -641,24 +665,19 @@ size_t check_int(void *test, void *correct, size_t count, size_t vector_size) {
|
|||||||
const cl_int *c = (const cl_int *) correct;
|
const cl_int *c = (const cl_int *) correct;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
if (memcmp(t, c, count * sizeof(c[0])) != 0)
|
||||||
|
{
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
if (t[i] != c[i])
|
||||||
|
{
|
||||||
|
|
||||||
for(i = 0; i < count; i++)
|
log_error("\n(check_int) Error for vector size %ld found at "
|
||||||
if( t[i] != c[i] ) {
|
"0x%8.8lx (of 0x%8.8lx): "
|
||||||
|
"*0x%8.8x vs 0x%8.8x\n",
|
||||||
log_error("\n(check_int) Error for vector size %ld found at 0x%8.8lx (of 0x%8.8lx): "
|
vector_size, i, count, c[i], t[i]);
|
||||||
"*0x%8.8x vs 0x%8.8x\n", vector_size, i, count, c[i], t[i]);
|
return i + 1;
|
||||||
log_error("\n(check_int) Error for vector size %ld found at 0x%8.8lx (of 0x%8.8lx): "
|
|
||||||
"*0x%8.8x vs 0x%8.8x\n", vector_size, i+1, count,c[i+1], t[i+1]);
|
|
||||||
log_error("\n(check_int) Error for vector size %ld found at 0x%8.8lx (of 0x%8.8lx): "
|
|
||||||
"*0x%8.8x vs 0x%8.8x\n", vector_size, i+2, count,c[i+2], t[i+2]);
|
|
||||||
log_error("\n(check_int) Error for vector size %ld found at 0x%8.8lx (of 0x%8.8lx): "
|
|
||||||
"*0x%8.8x vs 0x%8.8x\n", vector_size, i+3, count,c[i+3], t[i+3]);
|
|
||||||
if(i) {
|
|
||||||
log_error("\n(check_int) Error for vector size %ld found just after 0x%8.8lx: "
|
|
||||||
"*0x%8.8x vs 0x%8.8x\n", vector_size, i-1, c[i-1], t[i-1]);
|
|
||||||
}
|
}
|
||||||
return i + 1;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -668,13 +687,18 @@ size_t check_ulong(void *test, void *correct, size_t count, size_t vector_size)
|
|||||||
const cl_ulong *c = (const cl_ulong *) correct;
|
const cl_ulong *c = (const cl_ulong *) correct;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
if (memcmp(t, c, count * sizeof(c[0])) != 0)
|
||||||
for( i = 0; i < count; i++ )
|
{
|
||||||
if( t[i] != c[i] ) {
|
for (i = 0; i < count; i++)
|
||||||
log_error("\n(check_ulong) Error for vector size %ld found at 0x%8.8lx (of 0x%8.8lx): "
|
if (t[i] != c[i])
|
||||||
"*0x%16.16llx vs 0x%16.16llx\n", vector_size, i, count, c[i], t[i] );
|
{
|
||||||
return i + 1;
|
log_error("\n(check_ulong) Error for vector size %ld found at "
|
||||||
}
|
"0x%8.8lx (of 0x%8.8lx): "
|
||||||
|
"*0x%16.16llx vs 0x%16.16llx\n",
|
||||||
|
vector_size, i, count, c[i], t[i]);
|
||||||
|
return i + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -684,13 +708,18 @@ size_t check_long(void *test, void *correct, size_t count, size_t vector_size) {
|
|||||||
const cl_long *c = (const cl_long *) correct;
|
const cl_long *c = (const cl_long *) correct;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
if (memcmp(t, c, count * sizeof(c[0])) != 0)
|
||||||
for(i = 0; i < count; i++ )
|
{
|
||||||
if(t[i] != c[i]) {
|
for (i = 0; i < count; i++)
|
||||||
log_error("\n(check_long) Error for vector size %ld found at 0x%8.8lx (of 0x%8.8lx): "
|
if (t[i] != c[i])
|
||||||
"*0x%16.16llx vs 0x%16.16llx\n", vector_size, i, count, c[i], t[i] );
|
{
|
||||||
return i + 1;
|
log_error("\n(check_long) Error for vector size %ld found at "
|
||||||
}
|
"0x%8.8lx (of 0x%8.8lx): "
|
||||||
|
"*0x%16.16llx vs 0x%16.16llx\n",
|
||||||
|
vector_size, i, count, c[i], t[i]);
|
||||||
|
return i + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -700,14 +729,19 @@ size_t check_float( void *test, void *correct, size_t count, size_t vector_size
|
|||||||
const cl_uint *c = (const cl_uint *) correct;
|
const cl_uint *c = (const cl_uint *) correct;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
if (memcmp(t, c, count * sizeof(c[0])) != 0)
|
||||||
for( i = 0; i < count; i++ )
|
{
|
||||||
/* Allow nans to be binary different */
|
for (i = 0; i < count; i++) /* Allow nans to be binary different */
|
||||||
if ((t[i] != c[i]) && !(isnan(((float *)correct)[i]) && isnan(((float *)test)[i]))) {
|
if ((t[i] != c[i])
|
||||||
log_error("\n(check_float) Error for vector size %ld found at 0x%8.8lx (of 0x%8.8lx): "
|
&& !(isnan(((float *)correct)[i]) && isnan(((float *)test)[i])))
|
||||||
"*0x%8.8x vs 0x%8.8x\n", vector_size, i, count, c[i], t[i] );
|
{
|
||||||
return i + 1;
|
log_error("\n(check_float) Error for vector size %ld found at "
|
||||||
}
|
"0x%8.8lx (of 0x%8.8lx): "
|
||||||
|
"*0x%8.8x vs 0x%8.8x\n",
|
||||||
|
vector_size, i, count, c[i], t[i]);
|
||||||
|
return i + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -717,15 +751,20 @@ size_t check_double( void *test, void *correct, size_t count, size_t vector_size
|
|||||||
const cl_ulong *c = (const cl_ulong *) correct;
|
const cl_ulong *c = (const cl_ulong *) correct;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
if (memcmp(t, c, count * sizeof(c[0])) != 0)
|
||||||
|
{
|
||||||
for( i = 0; i < count; i++ )
|
for (i = 0; i < count; i++) /* Allow nans to be binary different */
|
||||||
/* Allow nans to be binary different */
|
if ((t[i] != c[i])
|
||||||
if ((t[i] != c[i]) && !(isnan(((double *)correct)[i]) && isnan(((double *)test)[i]))) {
|
&& !(isnan(((double *)correct)[i])
|
||||||
log_error("\n(check_double) Error for vector size %ld found at 0x%8.8lx (of 0x%8.8lx): "
|
&& isnan(((double *)test)[i])))
|
||||||
"*0x%16.16llx vs 0x%16.16llx\n", vector_size, i, count, c[i], t[i] );
|
{
|
||||||
return i + 1;
|
log_error("\n(check_double) Error for vector size %ld found at "
|
||||||
}
|
"0x%8.8lx (of 0x%8.8lx): "
|
||||||
|
"*0x%16.16llx vs 0x%16.16llx\n",
|
||||||
|
vector_size, i, count, c[i], t[i]);
|
||||||
|
return i + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user