Fix indentation of test_waitlists.cpp (#1459)

* fix indentation of test_waitlists.cpp

Followup of #1458

* run formatter
This commit is contained in:
Matthias Diener
2022-08-02 14:31:24 -05:00
committed by GitHub
parent cdf5a105fc
commit c44b5b6ae3

View File

@@ -28,10 +28,13 @@ int test_waitlist( cl_device_id device, cl_context context, cl_command_queue que
cl_int status[ 3 ]; cl_int status[ 3 ];
cl_int error; cl_int error;
if (multiple) if (multiple)
log_info("\tExecuting reference event 0, then reference event 1 with reference event 0 in its waitlist, then test event 2 with reference events 0 and 1 in its waitlist.\n"); log_info("\tExecuting reference event 0, then reference event 1 with "
else "reference event 0 in its waitlist, then test event 2 with "
log_info("\tExecuting reference event 0, then test event 2 with reference event 0 in its waitlist.\n"); "reference events 0 and 1 in its waitlist.\n");
else
log_info("\tExecuting reference event 0, then test event 2 with "
"reference event 0 in its waitlist.\n");
// Set up the first base action to wait against // Set up the first base action to wait against
error = actions[ 0 ].Setup( device, context, queue ); error = actions[ 0 ].Setup( device, context, queue );
@@ -49,7 +52,7 @@ int test_waitlist( cl_device_id device, cl_context context, cl_command_queue que
test_error( error, "Unable to set up test event" ); test_error( error, "Unable to set up test event" );
// Execute all events now // Execute all events now
if (PRINT_OPS) log_info("\tExecuting action 0...\n"); if (PRINT_OPS) log_info("\tExecuting action 0...\n");
error = actions[ 0 ].Execute( queue, 0, NULL, &events[ 0 ] ); error = actions[ 0 ].Execute( queue, 0, NULL, &events[ 0 ] );
test_error( error, "Unable to execute first event" ); test_error( error, "Unable to execute first event" );
@@ -61,17 +64,20 @@ int test_waitlist( cl_device_id device, cl_context context, cl_command_queue que
} }
// Sanity check // Sanity check
if( multiple ) { if (multiple)
if (PRINT_OPS) log_info("\tChecking status of action 1...\n"); {
if (PRINT_OPS) log_info("\tChecking status of action 1...\n");
error = clGetEventInfo( events[ 1 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 1 ] ), &status[ 1 ], NULL ); error = clGetEventInfo( events[ 1 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 1 ] ), &status[ 1 ], NULL );
test_error( error, "Unable to get event status" ); test_error(error, "Unable to get event status");
} }
if (PRINT_OPS) log_info("\tChecking status of action 0...\n"); if (PRINT_OPS) log_info("\tChecking status of action 0...\n");
error = clGetEventInfo( events[ 0 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 0 ] ), &status[ 0 ], NULL ); error = clGetEventInfo( events[ 0 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 0 ] ), &status[ 0 ], NULL );
test_error( error, "Unable to get event status" ); test_error(error, "Unable to get event status");
log_info("\t\tEvent status after starting reference events: reference event 0: %s, reference event 1: %s, test event 2: %s.\n", log_info("\t\tEvent status after starting reference events: reference "
IGetStatusString( status[ 0 ] ), (multiple ? IGetStatusString( status[ 1 ] ) : "N/A"), "N/A"); "event 0: %s, reference event 1: %s, test event 2: %s.\n",
IGetStatusString(status[0]),
(multiple ? IGetStatusString(status[1]) : "N/A"), "N/A");
if( ( status[ 0 ] == CL_COMPLETE ) || ( multiple && status[ 1 ] == CL_COMPLETE ) ) if( ( status[ 0 ] == CL_COMPLETE ) || ( multiple && status[ 1 ] == CL_COMPLETE ) )
{ {
@@ -79,25 +85,29 @@ int test_waitlist( cl_device_id device, cl_context context, cl_command_queue que
return 0; return 0;
} }
if (PRINT_OPS) log_info("\tExecuting action to test...\n"); if (PRINT_OPS) log_info("\tExecuting action to test...\n");
error = actionToTest->Execute( queue, ( multiple ) ? 2 : 1, &events[ 0 ], &events[ 2 ] ); error = actionToTest->Execute( queue, ( multiple ) ? 2 : 1, &events[ 0 ], &events[ 2 ] );
test_error( error, "Unable to execute test event" ); test_error( error, "Unable to execute test event" );
// Hopefully, the first event is still running // Hopefully, the first event is still running
if (PRINT_OPS) log_info("\tChecking status of action to test 2...\n"); if (PRINT_OPS) log_info("\tChecking status of action to test 2...\n");
error = clGetEventInfo( events[ 2 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 2 ] ), &status[ 2 ], NULL ); error = clGetEventInfo( events[ 2 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 2 ] ), &status[ 2 ], NULL );
test_error( error, "Unable to get event status" ); test_error( error, "Unable to get event status" );
if( multiple ) { if (multiple)
if (PRINT_OPS) log_info("\tChecking status of action 1...\n"); {
if (PRINT_OPS) log_info("\tChecking status of action 1...\n");
error = clGetEventInfo( events[ 1 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 1 ] ), &status[ 1 ], NULL ); error = clGetEventInfo( events[ 1 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 1 ] ), &status[ 1 ], NULL );
test_error( error, "Unable to get event status" ); test_error(error, "Unable to get event status");
} }
if (PRINT_OPS) log_info("\tChecking status of action 0...\n"); if (PRINT_OPS) log_info("\tChecking status of action 0...\n");
error = clGetEventInfo( events[ 0 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 0 ] ), &status[ 0 ], NULL ); error = clGetEventInfo( events[ 0 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 0 ] ), &status[ 0 ], NULL );
test_error( error, "Unable to get event status" ); test_error(error, "Unable to get event status");
log_info("\t\tEvent status after starting test event: reference event 0: %s, reference event 1: %s, test event 2: %s.\n", log_info("\t\tEvent status after starting test event: reference event 0: "
IGetStatusString( status[ 0 ] ), (multiple ? IGetStatusString( status[ 1 ] ) : "N/A"), IGetStatusString( status[ 2 ] )); "%s, reference event 1: %s, test event 2: %s.\n",
IGetStatusString(status[0]),
(multiple ? IGetStatusString(status[1]) : "N/A"),
IGetStatusString(status[2]));
if( multiple ) if( multiple )
{ {
@@ -108,12 +118,15 @@ int test_waitlist( cl_device_id device, cl_context context, cl_command_queue que
return 0; return 0;
} }
if(status[1] == CL_COMPLETE && status[0] != CL_COMPLETE) if (status[1] == CL_COMPLETE && status[0] != CL_COMPLETE)
{ {
log_error("ERROR: Test failed because the second wait event is complete and the first is not.(status: 0: %s and 1: %s)\n", IGetStatusString( status[ 0 ] ), IGetStatusString( status[ 1 ] ) ); log_error(
"ERROR: Test failed because the second wait event is complete "
"and the first is not.(status: 0: %s and 1: %s)\n",
IGetStatusString(status[0]), IGetStatusString(status[1]));
clFinish( queue ); clFinish( queue );
return -1; return -1;
} }
} }
else else
{ {
@@ -139,25 +152,29 @@ int test_waitlist( cl_device_id device, cl_context context, cl_command_queue que
} }
// Now wait for the first reference event // Now wait for the first reference event
if (PRINT_OPS) log_info("\tWaiting for action 1 to finish...\n"); if (PRINT_OPS) log_info("\tWaiting for action 1 to finish...\n");
error = clWaitForEvents( 1, &events[ 0 ] ); error = clWaitForEvents( 1, &events[ 0 ] );
test_error( error, "Unable to wait for reference event" ); test_error( error, "Unable to wait for reference event" );
// Grab statuses again // Grab statuses again
if (PRINT_OPS) log_info("\tChecking status of action to test 2...\n"); if (PRINT_OPS) log_info("\tChecking status of action to test 2...\n");
error = clGetEventInfo( events[ 2 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 2 ] ), &status[ 2 ], NULL ); error = clGetEventInfo( events[ 2 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 2 ] ), &status[ 2 ], NULL );
test_error( error, "Unable to get event status" ); test_error( error, "Unable to get event status" );
if( multiple ) { if (multiple)
if (PRINT_OPS) log_info("\tChecking status of action 1...\n"); {
if (PRINT_OPS) log_info("\tChecking status of action 1...\n");
error = clGetEventInfo( events[ 1 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 1 ] ), &status[ 1 ], NULL ); error = clGetEventInfo( events[ 1 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 1 ] ), &status[ 1 ], NULL );
test_error( error, "Unable to get event status" ); test_error(error, "Unable to get event status");
} }
if (PRINT_OPS) log_info("\tChecking status of action 0...\n"); if (PRINT_OPS) log_info("\tChecking status of action 0...\n");
error = clGetEventInfo( events[ 0 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 0 ] ), &status[ 0 ], NULL ); error = clGetEventInfo( events[ 0 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 0 ] ), &status[ 0 ], NULL );
test_error( error, "Unable to get event status" ); test_error(error, "Unable to get event status");
log_info("\t\tEvent status after waiting for reference event 0: reference event 0: %s, reference event 1: %s, test event 2: %s.\n", log_info("\t\tEvent status after waiting for reference event 0: reference "
IGetStatusString( status[ 0 ] ), (multiple ? IGetStatusString( status[ 1 ] ) : "N/A"), IGetStatusString( status[ 2 ] )); "event 0: %s, reference event 1: %s, test event 2: %s.\n",
IGetStatusString(status[0]),
(multiple ? IGetStatusString(status[1]) : "N/A"),
IGetStatusString(status[2]));
// Sanity // Sanity
if( status[ 0 ] != CL_COMPLETE ) if( status[ 0 ] != CL_COMPLETE )
@@ -170,11 +187,12 @@ int test_waitlist( cl_device_id device, cl_context context, cl_command_queue que
// If we're multiple, and the second event isn't complete, then our test event should still be queued // If we're multiple, and the second event isn't complete, then our test event should still be queued
if( multiple && status[ 1 ] != CL_COMPLETE ) if( multiple && status[ 1 ] != CL_COMPLETE )
{ {
if( status[ 1 ] == CL_RUNNING && status[ 2 ] == CL_RUNNING ) { if (status[1] == CL_RUNNING && status[2] == CL_RUNNING)
log_error("ERROR: Test event and second event are both running.\n"); {
clFinish( queue ); log_error("ERROR: Test event and second event are both running.\n");
return -1; clFinish(queue);
} return -1;
}
if( status[ 2 ] != CL_QUEUED && status[ 2 ] != CL_SUBMITTED ) if( status[ 2 ] != CL_QUEUED && status[ 2 ] != CL_SUBMITTED )
{ {
log_error( "ERROR: Test event did not wait for second event before starting! (status of ref: 1: %s, of test: 2: %s)\n", IGetStatusString( status[ 1 ] ), IGetStatusString( status[ 2 ] ) ); log_error( "ERROR: Test event did not wait for second event before starting! (status of ref: 1: %s, of test: 2: %s)\n", IGetStatusString( status[ 1 ] ), IGetStatusString( status[ 2 ] ) );
@@ -183,25 +201,33 @@ int test_waitlist( cl_device_id device, cl_context context, cl_command_queue que
} }
// Now wait for second event to complete, too // Now wait for second event to complete, too
if (PRINT_OPS) log_info("\tWaiting for action 1 to finish...\n"); if (PRINT_OPS) log_info("\tWaiting for action 1 to finish...\n");
error = clWaitForEvents( 1, &events[ 1 ] ); error = clWaitForEvents( 1, &events[ 1 ] );
test_error( error, "Unable to wait for second reference event" ); test_error( error, "Unable to wait for second reference event" );
// Grab statuses again // Grab statuses again
if (PRINT_OPS) log_info("\tChecking status of action to test 2...\n"); if (PRINT_OPS) log_info("\tChecking status of action to test 2...\n");
error = clGetEventInfo( events[ 2 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 2 ] ), &status[ 2 ], NULL ); error = clGetEventInfo(events[2], CL_EVENT_COMMAND_EXECUTION_STATUS,
test_error( error, "Unable to get event status" ); sizeof(status[2]), &status[2], NULL);
if( multiple ) { test_error(error, "Unable to get event status");
if (PRINT_OPS) log_info("\tChecking status of action 1...\n"); if (multiple)
error = clGetEventInfo( events[ 1 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 1 ] ), &status[ 1 ], NULL ); {
test_error( error, "Unable to get event status" ); if (PRINT_OPS) log_info("\tChecking status of action 1...\n");
} error = clGetEventInfo(events[1], CL_EVENT_COMMAND_EXECUTION_STATUS,
if (PRINT_OPS) log_info("\tChecking status of action 0...\n"); sizeof(status[1]), &status[1], NULL);
error = clGetEventInfo( events[ 0 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 0 ] ), &status[ 0 ], NULL ); test_error(error, "Unable to get event status");
test_error( error, "Unable to get event status" ); }
if (PRINT_OPS) log_info("\tChecking status of action 0...\n");
error = clGetEventInfo(events[0], CL_EVENT_COMMAND_EXECUTION_STATUS,
sizeof(status[0]), &status[0], NULL);
test_error(error, "Unable to get event status");
log_info("\t\tEvent status after waiting for reference event 1: reference event 0: %s, reference event 1: %s, test event 2: %s.\n", log_info(
IGetStatusString( status[ 0 ] ), (multiple ? IGetStatusString( status[ 1 ] ) : "N/A"), IGetStatusString( status[ 2 ] )); "\t\tEvent status after waiting for reference event 1: reference "
"event 0: %s, reference event 1: %s, test event 2: %s.\n",
IGetStatusString(status[0]),
(multiple ? IGetStatusString(status[1]) : "N/A"),
IGetStatusString(status[2]));
// Sanity // Sanity
if( status[ 1 ] != CL_COMPLETE ) if( status[ 1 ] != CL_COMPLETE )
@@ -227,25 +253,30 @@ int test_waitlist( cl_device_id device, cl_context context, cl_command_queue que
} }
// Wait for the test event, then return // Wait for the test event, then return
if (PRINT_OPS) log_info("\tWaiting for action 2 to test to finish...\n"); if (PRINT_OPS) log_info("\tWaiting for action 2 to test to finish...\n");
error = clWaitForEvents( 1, &events[ 2 ] ); error = clWaitForEvents( 1, &events[ 2 ] );
test_error( error, "Unable to wait for test event" ); test_error( error, "Unable to wait for test event" );
error |= clGetEventInfo( events[ 2 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 2 ] ), &status[ 2 ], NULL ); error |= clGetEventInfo(events[2], CL_EVENT_COMMAND_EXECUTION_STATUS,
test_error( error, "Unable to get event status" ); sizeof(status[2]), &status[2], NULL);
test_error(error, "Unable to get event status");
log_info("\t\tEvent status after waiting for test event: reference event 0: %s, reference event 1: %s, test event 2: %s.\n", log_info("\t\tEvent status after waiting for test event: reference event "
IGetStatusString( status[ 0 ] ), (multiple ? IGetStatusString( status[ 1 ] ) : "N/A"), IGetStatusString( status[ 2 ] )); "0: %s, reference event 1: %s, test event 2: %s.\n",
IGetStatusString(status[0]),
(multiple ? IGetStatusString(status[1]) : "N/A"),
IGetStatusString(status[2]));
// Sanity // Sanity
if( status[ 2 ] != CL_COMPLETE ) if (status[2] != CL_COMPLETE)
{ {
log_error( "ERROR: Test event didn't complete (status: 2: %s)\n", IGetStatusString( status[ 2 ] ) ); log_error("ERROR: Test event didn't complete (status: 2: %s)\n",
clFinish( queue ); IGetStatusString(status[2]));
return -1; clFinish(queue);
} return -1;
}
clFinish(queue); clFinish(queue);
return 0; return 0;
} }