Khronos Bug 15271 allocations test doesn't check if all events on the wait list are valid

This commit is contained in:
Grzegorz Wawiorko
2019-03-14 15:45:49 +01:00
committed by Kévin Petit
parent ac21278e8d
commit 90c6aee519
3 changed files with 27 additions and 16 deletions

View File

@@ -72,7 +72,7 @@ int fill_buffer_with_data(cl_context context, cl_device_id device_id, cl_command
}
error = clWaitForEvents(1, &event);
result = check_allocation_error(context, device_id, error, queue);
result = check_allocation_error(context, device_id, error, queue, &event);
if (result == FAILED_ABORT) {
print_error(error, "clWaitForEvents failed.");
@@ -128,7 +128,7 @@ int fill_buffer_with_data(cl_context context, cl_device_id device_id, cl_command
}
error = clWaitForEvents(1, &event);
result = check_allocation_error(context, device_id, error, queue);
result = check_allocation_error(context, device_id, error, queue, &event);
if (result == FAILED_ABORT) {
print_error(error, "clWaitForEvents failed.");
@@ -219,16 +219,7 @@ int fill_image_with_data(cl_context context, cl_device_id device_id, cl_command_
}
error = clWaitForEvents(1, &event);
// Dig out execution error if that is the problem
if (error == CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST) {
cl_int err, exec_status;
err = clGetEventInfo(event, CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof(exec_status), &exec_status, NULL);
test_error(err, "clGetEventInfo failed getting CL_EVENT_COMMAND_EXECUTION_STATUS from failed event");
error = exec_status;
}
result = check_allocation_error(context, device_id, error, queue);
result = check_allocation_error(context, device_id, error, queue, &event);
if (result == FAILED_ABORT) {
print_error(error, "clWaitForEvents failed.");
@@ -284,7 +275,7 @@ int fill_image_with_data(cl_context context, cl_device_id device_id, cl_command_
}
error = clWaitForEvents(1, &event);
result = check_allocation_error(context, device_id, error, queue);
result = check_allocation_error(context, device_id, error, queue, &event);
if (result == FAILED_ABORT) {
print_error(error, "clWaitForEvents failed.");

View File

@@ -23,8 +23,25 @@ cl_command_queue reset_queue(cl_context context, cl_device_id device_id, cl_comm
return *queue;
}
int check_allocation_error(cl_context context, cl_device_id device_id, int error, cl_command_queue *queue) {
int check_allocation_error(cl_context context, cl_device_id device_id, int error, cl_command_queue *queue, cl_event *event) {
//log_info("check_allocation_error context=%p device_id=%p error=%d *queue=%p\n", context, device_id, error, *queue);
if (error == CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST && event != 0)
{
// check for errors from clWaitForEvents (e.g after clEnqueueWriteBuffer)
cl_int eventError;
error = clGetEventInfo(*event, CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof(error), &eventError, 0);
if (CL_SUCCESS != error)
{
log_error("Failed to get event execution status: %s\n", IGetErrorString(error));
return FAILED_ABORT;
}
if (eventError >= 0)
{
log_error("Non-negative event execution status after CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST: %s\n", IGetErrorString(error));
return FAILED_ABORT;
}
error = eventError;
}
if ((error == CL_MEM_OBJECT_ALLOCATION_FAILURE ) || (error == CL_OUT_OF_RESOURCES ) || (error == CL_OUT_OF_HOST_MEMORY) || (error == CL_INVALID_IMAGE_SIZE)) {
return FAILED_TOO_BIG;
} else if (error == CL_INVALID_COMMAND_QUEUE) {

View File

@@ -13,12 +13,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef _allocation_utils_h
#define _allocation_utils_h
#include "testBase.h"
extern cl_uint checksum;
int check_allocation_error(cl_context context, cl_device_id device_id, int error, cl_command_queue *queue);
int check_allocation_error(cl_context context, cl_device_id device_id, int error, cl_command_queue *queue, cl_event *event = 0);
double toMB(cl_ulong size_in);
size_t get_actual_allocation_size(cl_mem mem);
#endif // _allocation_utils_h