Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
Signed-off-by: Sven van Haastregt <[email protected]>
  • Loading branch information
svenvh committed Nov 28, 2024
1 parent ee8fded commit 635a68e
Show file tree
Hide file tree
Showing 13 changed files with 361 additions and 119 deletions.
24 changes: 18 additions & 6 deletions test_conformance/buffers/test_sub_buffers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,16 +344,26 @@ int test_sub_buffers_read_write_core( cl_context context, cl_command_queue queue
size_t sbThatFailed = find_subbuffer_by_index( subBuffers, numSubBuffers, i + j );
if ( sbThatFailed == numSubBuffers )
{
log_error( "ERROR: Validation failure outside of a sub-buffer! (Shouldn't be possible, but it happened at index %zu out of %zu...)\n", i + j, mainSize );
log_error("ERROR: Validation failure outside of a "
"sub-buffer! (Shouldn't be possible, but it "
"happened at index %zu out of %zu...)\n",
i + j, mainSize);
// Since this is a nonsensical, don't bother continuing to check
// (we will, however, print our map of sub-buffers for comparison)
for ( size_t k = 0; k < numSubBuffers; k++ )
{
log_error( "\tBuffer %zu: %zu to %zu (length %zu)\n", k, subBuffers[ k ].mOrigin, subBuffers[ k ].mOrigin + subBuffers[ k ].mSize, subBuffers[ k ].mSize );
log_error("\tBuffer %zu: %zu to %zu (length %zu)\n",
k, subBuffers[k].mOrigin,
subBuffers[k].mOrigin
+ subBuffers[k].mSize,
subBuffers[k].mSize);
}
return -1;
}
log_error( "ERROR: Validation failure on sub-buffer %zu (start: %zu, length: %zu)\n", sbThatFailed, subBuffers[ sbThatFailed ].mOrigin, subBuffers[ sbThatFailed ].mSize );
log_error("ERROR: Validation failure on sub-buffer %zu "
"(start: %zu, length: %zu)\n",
sbThatFailed, subBuffers[sbThatFailed].mOrigin,
subBuffers[sbThatFailed].mSize);
size_t newPos = subBuffers[ sbThatFailed ].mOrigin + subBuffers[ sbThatFailed ].mSize - 1;
i = newPos & ~65535;
j = newPos - i;
Expand Down Expand Up @@ -589,8 +599,10 @@ int test_sub_buffers_overlapping( cl_device_id deviceID, cl_context context, cl_
}
}

log_info( "\tTesting %d sub-buffers with %lld overlapping Kbytes (%d%%; as many as %zu buffers overlapping at once)\n",
16, ( delta / 1024LL ), (int)( delta * 100LL / (long long)mainSize ), maxOverlap );
log_info("\tTesting %d sub-buffers with %lld overlapping Kbytes (%d%%; as "
"many as %zu buffers overlapping at once)\n",
16, (delta / 1024LL), (int)(delta * 100LL / (long long)mainSize),
maxOverlap);

// Write some random contents to the main buffer
cl_char * contents = new cl_char[ mainSize ];
Expand All @@ -615,7 +627,7 @@ int test_sub_buffers_overlapping( cl_device_id deviceID, cl_context context, cl_

if ( memcmp( tempBuffer, contents + subBuffers[ i ].mOrigin, subBuffers[ i ].mSize ) != 0 )
{
log_error( "ERROR: Validation for sub-buffer %zu failed!\n", i );
log_error("ERROR: Validation for sub-buffer %zu failed!\n", i);
numErrors++;
}
}
Expand Down
156 changes: 122 additions & 34 deletions test_conformance/contractions/contractions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ static int RunTest( int testNumber )
for( i = 0; i < sizeof(args ) / sizeof( args[0]); i++ )
if( (error = clSetKernelArg(k, i, sizeof( cl_mem ), args + i) ))
{
vlog_error( "Error %d setting kernel arg # %zu\n", error, i );
vlog_error("Error %d setting kernel arg # %zu\n", error, i);
return error;
}

Expand Down Expand Up @@ -1021,24 +1021,72 @@ static int RunTest( int testNumber )
switch( testNumber )
{
// Zeros for these should be positive
case 0: vlog_error( "%zu) Error for %s %s: %a * %a + %a = *%a vs. %a\n", i, sizeNames[ vectorSize], kernelName[ testNumber ],
a[i], b[i], c[i], correct[testNumber][i], test[i] ); clReleaseKernel(k); return -1;
case 1: vlog_error( "%zu) Error for %s %s: %a * %a - %a = *%a vs. %a\n", i, sizeNames[ vectorSize], kernelName[ testNumber ],
a[i], b[i], c[i], correct[testNumber][i], test[i] ); clReleaseKernel(k); return -1;
case 2: vlog_error( "%zu) Error for %s %s: %a + %a * %a = *%a vs. %a\n", i, sizeNames[ vectorSize], kernelName[ testNumber ],
c[i], a[i], b[i], correct[testNumber][i], test[i] ); clReleaseKernel(k); return -1;
case 3: vlog_error( "%zu) Error for %s %s: %a - %a * %a = *%a vs. %a\n", i, sizeNames[ vectorSize], kernelName[ testNumber ],
c[i], a[i], b[i], correct[testNumber][i], test[i] ); clReleaseKernel(k); return -1;
case 0:
vlog_error("%zu) Error for %s %s: %a * %a + %a = *%a "
"vs. %a\n",
i, sizeNames[vectorSize],
kernelName[testNumber], a[i], b[i], c[i],
correct[testNumber][i], test[i]);
clReleaseKernel(k);
return -1;
case 1:
vlog_error("%zu) Error for %s %s: %a * %a - %a = *%a "
"vs. %a\n",
i, sizeNames[vectorSize],
kernelName[testNumber], a[i], b[i], c[i],
correct[testNumber][i], test[i]);
clReleaseKernel(k);
return -1;
case 2:
vlog_error("%zu) Error for %s %s: %a + %a * %a = *%a "
"vs. %a\n",
i, sizeNames[vectorSize],
kernelName[testNumber], c[i], a[i], b[i],
correct[testNumber][i], test[i]);
clReleaseKernel(k);
return -1;
case 3:
vlog_error("%zu) Error for %s %s: %a - %a * %a = *%a "
"vs. %a\n",
i, sizeNames[vectorSize],
kernelName[testNumber], c[i], a[i], b[i],
correct[testNumber][i], test[i]);
clReleaseKernel(k);
return -1;

// Zeros for these shouzu be negative
case 4: vlog_error( "%zu) Error for %s %s: -(%a * %a + %a) = *%a vs. %a\n", i, sizeNames[ vectorSize], kernelName[ testNumber ],
a[i], b[i], c[i], correct[testNumber][i], test[i] ); clReleaseKernel(k); return -1;
case 5: vlog_error( "%zu) Error for %s %s: -(%a * %a - %a) = *%a vs. %a\n", i, sizeNames[ vectorSize], kernelName[ testNumber ],
a[i], b[i], c[i], correct[testNumber][i], test[i] ); clReleaseKernel(k); return -1;
case 6: vlog_error( "%zu) Error for %s %s: -(%a + %a * %a) = *%a vs. %a\n", i, sizeNames[ vectorSize], kernelName[ testNumber ],
c[i], a[i], b[i], correct[testNumber][i], test[i] ); clReleaseKernel(k); return -1;
case 7: vlog_error( "%zu) Error for %s %s: -(%a - %a * %a) = *%a vs. %a\n", i, sizeNames[ vectorSize], kernelName[ testNumber ],
c[i], a[i], b[i], correct[testNumber][i], test[i] ); clReleaseKernel(k); return -1;
case 4:
vlog_error("%zu) Error for %s %s: -(%a * %a + %a) = "
"*%a vs. %a\n",
i, sizeNames[vectorSize],
kernelName[testNumber], a[i], b[i], c[i],
correct[testNumber][i], test[i]);
clReleaseKernel(k);
return -1;
case 5:
vlog_error("%zu) Error for %s %s: -(%a * %a - %a) = "
"*%a vs. %a\n",
i, sizeNames[vectorSize],
kernelName[testNumber], a[i], b[i], c[i],
correct[testNumber][i], test[i]);
clReleaseKernel(k);
return -1;
case 6:
vlog_error("%zu) Error for %s %s: -(%a + %a * %a) = "
"*%a vs. %a\n",
i, sizeNames[vectorSize],
kernelName[testNumber], c[i], a[i], b[i],
correct[testNumber][i], test[i]);
clReleaseKernel(k);
return -1;
case 7:
vlog_error("%zu) Error for %s %s: -(%a - %a * %a) = "
"*%a vs. %a\n",
i, sizeNames[vectorSize],
kernelName[testNumber], c[i], a[i], b[i],
correct[testNumber][i], test[i]);
clReleaseKernel(k);
return -1;
default:
vlog_error( "error: Unknown test number!\n" );
clReleaseKernel(k);
Expand Down Expand Up @@ -1097,7 +1145,7 @@ static int RunTest_Double( int testNumber )
for( i = 0; i < sizeof(args ) / sizeof( args[0]); i++ )
if( (error = clSetKernelArg(k, i, sizeof( cl_mem ), args + i) ))
{
vlog_error( "Error %d setting kernel arg # %zu\n", error, i );
vlog_error("Error %d setting kernel arg # %zu\n", error, i);
return error;
}

Expand Down Expand Up @@ -1138,24 +1186,64 @@ static int RunTest_Double( int testNumber )
switch( testNumber )
{
// Zeros for these should be positive
case 0: vlog_error( "%zu) Error for %s %s: %a * %a + %a = *%a vs. %a\n", i, sizeNames_double[ vectorSize], kernelName[ testNumber ],
a[i], b[i], c[i], correct[testNumber][i], test[i] ); return -1;
case 1: vlog_error( "%zu) Error for %s %s: %a * %a - %a = *%a vs. %a\n", i, sizeNames_double[ vectorSize], kernelName[ testNumber ],
a[i], b[i], c[i], correct[testNumber][i], test[i] ); return -1;
case 2: vlog_error( "%zu) Error for %s %s: %a + %a * %a = *%a vs. %a\n", i, sizeNames_double[ vectorSize], kernelName[ testNumber ],
c[i], a[i], b[i], correct[testNumber][i], test[i] ); return -1;
case 3: vlog_error( "%zu) Error for %s %s: %a - %a * %a = *%a vs. %a\n", i, sizeNames_double[ vectorSize], kernelName[ testNumber ],
c[i], a[i], b[i], correct[testNumber][i], test[i] ); return -1;
case 0:
vlog_error("%zu) Error for %s %s: %a * %a + %a = *%a "
"vs. %a\n",
i, sizeNames_double[vectorSize],
kernelName[testNumber], a[i], b[i], c[i],
correct[testNumber][i], test[i]);
return -1;
case 1:
vlog_error("%zu) Error for %s %s: %a * %a - %a = *%a "
"vs. %a\n",
i, sizeNames_double[vectorSize],
kernelName[testNumber], a[i], b[i], c[i],
correct[testNumber][i], test[i]);
return -1;
case 2:
vlog_error("%zu) Error for %s %s: %a + %a * %a = *%a "
"vs. %a\n",
i, sizeNames_double[vectorSize],
kernelName[testNumber], c[i], a[i], b[i],
correct[testNumber][i], test[i]);
return -1;
case 3:
vlog_error("%zu) Error for %s %s: %a - %a * %a = *%a "
"vs. %a\n",
i, sizeNames_double[vectorSize],
kernelName[testNumber], c[i], a[i], b[i],
correct[testNumber][i], test[i]);
return -1;

// Zeros for these shouzu be negative
case 4: vlog_error( "%zu) Error for %s %s: -(%a * %a + %a) = *%a vs. %a\n", i, sizeNames_double[ vectorSize], kernelName[ testNumber ],
a[i], b[i], c[i], correct[testNumber][i], test[i] ); return -1;
case 5: vlog_error( "%zu) Error for %s %s: -(%a * %a - %a) = *%a vs. %a\n", i, sizeNames_double[ vectorSize], kernelName[ testNumber ],
a[i], b[i], c[i], correct[testNumber][i], test[i] ); return -1;
case 6: vlog_error( "%zu) Error for %s %s: -(%a + %a * %a) = *%a vs. %a\n", i, sizeNames_double[ vectorSize], kernelName[ testNumber ],
c[i], a[i], b[i], correct[testNumber][i], test[i] ); return -1;
case 7: vlog_error( "%zu) Error for %s %s: -(%a - %a * %a) = *%a vs. %a\n", i, sizeNames_double[ vectorSize], kernelName[ testNumber ],
c[i], a[i], b[i], correct[testNumber][i], test[i] ); return -1;
case 4:
vlog_error("%zu) Error for %s %s: -(%a * %a + %a) = "
"*%a vs. %a\n",
i, sizeNames_double[vectorSize],
kernelName[testNumber], a[i], b[i], c[i],
correct[testNumber][i], test[i]);
return -1;
case 5:
vlog_error("%zu) Error for %s %s: -(%a * %a - %a) = "
"*%a vs. %a\n",
i, sizeNames_double[vectorSize],
kernelName[testNumber], a[i], b[i], c[i],
correct[testNumber][i], test[i]);
return -1;
case 6:
vlog_error("%zu) Error for %s %s: -(%a + %a * %a) = "
"*%a vs. %a\n",
i, sizeNames_double[vectorSize],
kernelName[testNumber], c[i], a[i], b[i],
correct[testNumber][i], test[i]);
return -1;
case 7:
vlog_error("%zu) Error for %s %s: -(%a - %a * %a) = "
"*%a vs. %a\n",
i, sizeNames_double[vectorSize],
kernelName[testNumber], c[i], a[i], b[i],
correct[testNumber][i], test[i]);
return -1;
default:
vlog_error( "error: Unknown test number!\n" );
return -2;
Expand Down
17 changes: 12 additions & 5 deletions test_conformance/device_partition/test_device_partition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,14 @@ int test_device_set(size_t deviceCount, size_t queueCount, cl_device_id *devices
RandomSeed seed( gRandomSeed );

if (queueCount > MAX_QUEUES) {
log_error("Number of queues (%zu) is greater than the number for which the test was written (%d).", queueCount, MAX_QUEUES);
log_error("Number of queues (%zu) is greater than the number for which "
"the test was written (%d).",
queueCount, MAX_QUEUES);
return -1;
}

log_info("Testing with %zu queues on %zu devices, %zu kernel executions.\n", queueCount, deviceCount, queueCount*num_elements/TEST_SIZE);
log_info("Testing with %zu queues on %zu devices, %zu kernel executions.\n",
queueCount, deviceCount, queueCount * num_elements / TEST_SIZE);

for (i=0; i<deviceCount; i++) {
size_t deviceNameSize;
Expand Down Expand Up @@ -332,11 +335,15 @@ int test_device_set(size_t deviceCount, size_t queueCount, cl_device_id *devices
{
if( expectedResults[ i ] != outputData[ i ] )
{
log_error( "ERROR: Sample data did not verify for queue %d on device %zu (sample %d, expected %d, got %d)\n",
q, q % deviceCount, (int)i, expectedResults[ i ], outputData[ i ] );
log_error("ERROR: Sample data did not verify for queue %d on "
"device %zu (sample %d, expected %d, got %d)\n",
q, q % deviceCount, (int)i, expectedResults[i],
outputData[i]);
for (size_t j=0; j<deviceCount; j++) {
if (expectedResultsOneDevice[j][i] == outputData[i])
log_info("Sample consistent with only device %zu having modified the data.\n", j);
log_info("Sample consistent with only device %zu "
"having modified the data.\n",
j);
}
errorsThisTime++;
break;
Expand Down
Loading

0 comments on commit 635a68e

Please sign in to comment.