mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-24 07:59:01 +00:00
Fix windows stack overflow. (#1839)
This commit is contained in:
@@ -16,6 +16,8 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "harness/mt19937.h"
|
#include "harness/mt19937.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#define GLOBAL_SIZE 65536
|
#define GLOBAL_SIZE 65536
|
||||||
|
|
||||||
static const char *sources[] = {
|
static const char *sources[] = {
|
||||||
@@ -75,9 +77,9 @@ wait_and_release(const char* s, cl_event* evs, int n)
|
|||||||
|
|
||||||
int test_svm_migrate(cl_device_id deviceID, cl_context c, cl_command_queue queue, int num_elements)
|
int test_svm_migrate(cl_device_id deviceID, cl_context c, cl_command_queue queue, int num_elements)
|
||||||
{
|
{
|
||||||
cl_uint amem[GLOBAL_SIZE];
|
std::vector<cl_uint> amem(GLOBAL_SIZE);
|
||||||
cl_uint bmem[GLOBAL_SIZE];
|
std::vector<cl_uint> bmem(GLOBAL_SIZE);
|
||||||
cl_uint cmem[GLOBAL_SIZE];
|
std::vector<cl_uint> cmem(GLOBAL_SIZE);
|
||||||
cl_event evs[20];
|
cl_event evs[20];
|
||||||
|
|
||||||
const size_t global_size = GLOBAL_SIZE;
|
const size_t global_size = GLOBAL_SIZE;
|
||||||
@@ -145,9 +147,9 @@ int test_svm_migrate(cl_device_id deviceID, cl_context c, cl_command_queue queue
|
|||||||
test_error(error, "clSetKernelArgSVMPointer failed");
|
test_error(error, "clSetKernelArgSVMPointer failed");
|
||||||
|
|
||||||
// Initialize host copy of data (and result)
|
// Initialize host copy of data (and result)
|
||||||
fill_buffer(amem, global_size, seed);
|
fill_buffer(amem.data(), global_size, seed);
|
||||||
fill_buffer(bmem, global_size, seed);
|
fill_buffer(bmem.data(), global_size, seed);
|
||||||
fill_buffer(cmem, global_size, seed);
|
fill_buffer(cmem.data(), global_size, seed);
|
||||||
|
|
||||||
// Now we're ready to start
|
// Now we're ready to start
|
||||||
{
|
{
|
||||||
@@ -218,9 +220,9 @@ int test_svm_migrate(cl_device_id deviceID, cl_context c, cl_command_queue queue
|
|||||||
if (error)
|
if (error)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
memcpy((void *)asvm, (void *)amem, global_size*sizeof(cl_uint));
|
memcpy((void *)asvm, (void *)amem.data(), global_size * sizeof(cl_uint));
|
||||||
memcpy((void *)bsvm, (void *)bmem, global_size*sizeof(cl_uint));
|
memcpy((void *)bsvm, (void *)bmem.data(), global_size * sizeof(cl_uint));
|
||||||
memcpy((void *)csvm, (void *)cmem, global_size*sizeof(cl_uint));
|
memcpy((void *)csvm, (void *)cmem.data(), global_size * sizeof(cl_uint));
|
||||||
|
|
||||||
{
|
{
|
||||||
error = clEnqueueSVMUnmap(queues[1], (void *)asvm, 0, NULL, &evs[0]);
|
error = clEnqueueSVMUnmap(queues[1], (void *)asvm, 0, NULL, &evs[0]);
|
||||||
@@ -304,9 +306,9 @@ int test_svm_migrate(cl_device_id deviceID, cl_context c, cl_command_queue queue
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// Check kernel results
|
// Check kernel results
|
||||||
bool ok = check("memory a", (cl_uint *)asvm, amem, global_size);
|
bool ok = check("memory a", (cl_uint *)asvm, amem.data(), global_size);
|
||||||
ok &= check("memory b", (cl_uint *)bsvm, bmem, global_size);
|
ok &= check("memory b", (cl_uint *)bsvm, bmem.data(), global_size);
|
||||||
ok &= check("memory c", (cl_uint *)csvm, cmem, global_size);
|
ok &= check("memory c", (cl_uint *)csvm, cmem.data(), global_size);
|
||||||
|
|
||||||
{
|
{
|
||||||
void *ptrs[] = { asvm, bsvm, csvm };
|
void *ptrs[] = { asvm, bsvm, csvm };
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "procs.h"
|
#include "procs.h"
|
||||||
#include "harness/conversions.h"
|
#include "harness/conversions.h"
|
||||||
@@ -72,7 +72,7 @@ int test_work_item_functions(cl_device_id deviceID, cl_context context, cl_comma
|
|||||||
clProgramWrapper program;
|
clProgramWrapper program;
|
||||||
clKernelWrapper kernel;
|
clKernelWrapper kernel;
|
||||||
clMemWrapper outData;
|
clMemWrapper outData;
|
||||||
work_item_data testData[ 10240 ];
|
std::vector<work_item_data> testData(10240);
|
||||||
size_t threads[3], localThreads[3];
|
size_t threads[3], localThreads[3];
|
||||||
MTdata d;
|
MTdata d;
|
||||||
|
|
||||||
@@ -80,7 +80,9 @@ int test_work_item_functions(cl_device_id deviceID, cl_context context, cl_comma
|
|||||||
error = create_single_kernel_helper( context, &program, &kernel, 1, &workItemKernelCode, "sample_kernel" );
|
error = create_single_kernel_helper( context, &program, &kernel, 1, &workItemKernelCode, "sample_kernel" );
|
||||||
test_error( error, "Unable to create testing kernel" );
|
test_error( error, "Unable to create testing kernel" );
|
||||||
|
|
||||||
outData = clCreateBuffer( context, CL_MEM_READ_WRITE, sizeof( testData ), NULL, &error );
|
outData =
|
||||||
|
clCreateBuffer(context, CL_MEM_READ_WRITE,
|
||||||
|
sizeof(work_item_data) * testData.size(), NULL, &error);
|
||||||
test_error( error, "Unable to create output buffer" );
|
test_error( error, "Unable to create output buffer" );
|
||||||
|
|
||||||
error = clSetKernelArg( kernel, 0, sizeof( outData ), &outData );
|
error = clSetKernelArg( kernel, 0, sizeof( outData ), &outData );
|
||||||
@@ -105,7 +107,10 @@ int test_work_item_functions(cl_device_id deviceID, cl_context context, cl_comma
|
|||||||
error = clEnqueueNDRangeKernel( queue, kernel, (cl_uint)dim, NULL, threads, localThreads, 0, NULL, NULL );
|
error = clEnqueueNDRangeKernel( queue, kernel, (cl_uint)dim, NULL, threads, localThreads, 0, NULL, NULL );
|
||||||
test_error( error, "Unable to run kernel" );
|
test_error( error, "Unable to run kernel" );
|
||||||
|
|
||||||
error = clEnqueueReadBuffer( queue, outData, CL_TRUE, 0, sizeof( testData ), testData, 0, NULL, NULL );
|
error =
|
||||||
|
clEnqueueReadBuffer(queue, outData, CL_TRUE, 0,
|
||||||
|
sizeof(work_item_data) * testData.size(),
|
||||||
|
testData.data(), 0, NULL, NULL);
|
||||||
test_error( error, "Unable to read results" );
|
test_error( error, "Unable to read results" );
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
|
|||||||
Reference in New Issue
Block a user