Fix verification if atomics 64bit extensions supported by device (#441)

This commit is contained in:
Grzegorz Wawiorko
2019-08-23 11:24:02 +02:00
committed by Kévin Petit
parent 0b9329a9d6
commit e880869559
3 changed files with 19 additions and 11 deletions

View File

@@ -21,6 +21,7 @@
#include "harness/errorHelpers.h"
#include "harness/kernelHelpers.h"
#include "harness/typeWrappers.h"
#include <vector>
#if (defined(_WIN32) || defined(_WIN64)) && defined(_MSC_VER)
#include <windows.h>
@@ -94,7 +95,7 @@ extern int test_svm_shared_sub_buffers(cl_device_id deviceID, cl_context cont
extern int test_svm_enqueue_api(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_svm_migrate(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern cl_int create_cl_objects(cl_device_id device_from_harness, const char** ppCodeString, cl_context* context, cl_program *program, cl_command_queue *queues, cl_uint *num_devices, cl_device_svm_capabilities required_svm_caps);
extern cl_int create_cl_objects(cl_device_id device_from_harness, const char** ppCodeString, cl_context* context, cl_program *program, cl_command_queue *queues, cl_uint *num_devices, cl_device_svm_capabilities required_svm_caps, std::vector<std::string> extensions_list = {});
extern const char *linked_list_create_and_verify_kernels[];

View File

@@ -168,7 +168,7 @@ cl_int verify_linked_lists(Node* pNodes, size_t num_lists, int list_length)
// Note that we don't use the context provided by the test harness since it doesn't support multiple devices,
// so we create are own context here that has all devices, we use the same platform that the harness used.
cl_int create_cl_objects(cl_device_id device_from_harness, const char** ppCodeString, cl_context* context, cl_program *program, cl_command_queue *queues, cl_uint *num_devices, cl_device_svm_capabilities required_svm_caps)
cl_int create_cl_objects(cl_device_id device_from_harness, const char** ppCodeString, cl_context* context, cl_program *program, cl_command_queue *queues, cl_uint *num_devices, cl_device_svm_capabilities required_svm_caps, std::vector<std::string> extensions_list)
{
cl_int error;
@@ -215,7 +215,17 @@ cl_int create_cl_objects(cl_device_id device_from_harness, const char** ppCodeSt
log_error("clGetDeviceInfo returned an invalid cl_device_svm_capabilities value");
return -1;
}
if((caps & required_svm_caps) == required_svm_caps)
bool extensions_supported = true;
for (auto extension : extensions_list)
{
if (!is_extension_available(devices[i], extension.c_str()))
{
log_error("Required extension not found - device id %d - %s\n", i, extension.c_str());
extensions_supported = false;
break;
}
}
if((caps & required_svm_caps) == required_svm_caps && extensions_supported)
{
capable_devices.push_back(devices[i]);
++num_capable_devices;
@@ -226,7 +236,7 @@ cl_int create_cl_objects(cl_device_id device_from_harness, const char** ppCodeSt
if(num_capable_devices == 0)
// if(svm_level > CL_DEVICE_COARSE_SVM && 0 == num_capable_devices)
{
log_info("Requested SVM level not supported by any device on this platform, test not executed.\n");
log_info("Requested SVM level or required extensions not supported by any device on this platform, test not executed.\n");
return 1; // 1 indicates do not execute, but counts as passing.
}

View File

@@ -140,19 +140,16 @@ int test_svm_fine_grain_memory_consistency(cl_device_id deviceID, cl_context c,
cl_uint num_devices = 0;
cl_int err = CL_SUCCESS;
if (sizeof(void *) == 8 && (!is_extension_available(deviceID, "cl_khr_int64_base_atomics") || !is_extension_available(deviceID, "cl_khr_int64_extended_atomics")))
{
log_info("WARNING: test skipped. 'cl_khr_int64_base_atomics' and 'cl_khr_int64_extended_atomics' extensions are not supported\n");
return 0;
}
std::vector<std::string> required_extensions;
required_extensions.push_back("cl_khr_int64_base_atomics");
required_extensions.push_back("cl_khr_int64_extended_atomics");
// Make pragmas visible for 64-bit addresses
hash_table_kernel[4] = sizeof(void *) == 8 ? '1' : '0';
char *source[] = { hash_table_kernel };
err = create_cl_objects(deviceID, (const char**)source, &context, &program, &queues[0], &num_devices, CL_DEVICE_SVM_FINE_GRAIN_BUFFER | CL_DEVICE_SVM_ATOMICS);
err = create_cl_objects(deviceID, (const char**)source, &context, &program, &queues[0], &num_devices, CL_DEVICE_SVM_FINE_GRAIN_BUFFER | CL_DEVICE_SVM_ATOMICS, required_extensions);
if(err == 1) return 0; // no devices capable of requested SVM level, so don't execute but count test as passing.
if(err < 0) return -1; // fail test.