summaryrefslogtreecommitdiff
path: root/utests/runtime_flat_address_space.cpp
diff options
context:
space:
mode:
authorBenjamin Segovia <segovia.benjamin@gmail.com>2012-05-03 17:25:24 +0000
committerKeith Packard <keithp@keithp.com>2012-08-10 16:17:00 -0700
commit89381fa7285c462521671c2e10712b9d5a7a8dcb (patch)
tree419b47bd6195aadbe7e06c9c4cca832657784588 /utests/runtime_flat_address_space.cpp
parent7237f7fc9d49888b1b7b3412f38ec7b28977036b (diff)
downloadbeignet-89381fa7285c462521671c2e10712b9d5a7a8dcb.tar.gz
Added flat_address_space tests
Diffstat (limited to 'utests/runtime_flat_address_space.cpp')
-rw-r--r--utests/runtime_flat_address_space.cpp32
1 files changed, 14 insertions, 18 deletions
diff --git a/utests/runtime_flat_address_space.cpp b/utests/runtime_flat_address_space.cpp
index 68aeef05..d2f4aefb 100644
--- a/utests/runtime_flat_address_space.cpp
+++ b/utests/runtime_flat_address_space.cpp
@@ -17,35 +17,32 @@
* Author: Benjamin Segovia <benjamin.segovia@intel.com>
*/
-#include "cl_test.h"
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
+#include "utest_helper.hpp"
int
-main (int argc, char *argv[])
+main(int argc, char *argv[])
{
cl_mem dst[24];
int *dst_buffer;
const size_t n = 32 * 1024 * 1024;
const size_t global_work_size = n;
const size_t local_work_size = 16;
- int status = 0, i, j;
+ int status = 0;
if ((status = cl_test_init("test_write_only.cl", "test_write_only", SOURCE)) != 0)
goto error;
- for (j = 0; j < 24; ++j) {
- /* Allocate the two buffers */
+ for (uint32_t j = 0; j < 24; ++j)
+ {
+ // Allocate the two buffers
dst[j] = clCreateBuffer(ctx, 0, n * sizeof(uint32_t), NULL, &status);
if (status != CL_SUCCESS) goto error;
- /* Set source and destination */
- CALL (clSetKernelArg, kernel, 0, sizeof(cl_mem), &dst[j]);
+ // Set source and destination
+ OCL_CALL (clSetKernelArg, kernel, 0, sizeof(cl_mem), &dst[j]);
- /* Run the kernel */
- CALL (clEnqueueNDRangeKernel, queue,
+ // Run the kernel
+ OCL_CALL (clEnqueueNDRangeKernel, queue,
kernel,
1,
NULL,
@@ -55,21 +52,20 @@ main (int argc, char *argv[])
NULL,
NULL);
- /* Be sure that everything run fine */
+ // Be sure that everything run fine
dst_buffer = (int *) clIntelMapBuffer(dst[j], &status);
if (status != CL_SUCCESS)
goto error;
- for (i = 0; i < n; ++i) assert(dst_buffer[i] == i);
- CALL (clIntelUnmapBuffer, dst[j]);
+ for (uint32_t i = 0; i < n; ++i) assert(dst_buffer[i] == int(i));
+ OCL_CALL (clIntelUnmapBuffer, dst[j]);
}
- for (j = 0; j < 24; ++j) CALL (clReleaseMemObject, dst[j]);
+ for (uint32_t j = 0; j < 24; ++j) OCL_CALL (clReleaseMemObject, dst[j]);
cl_test_destroy();
printf("%i memory leaks\n", clIntelReportUnfreed());
assert(clIntelReportUnfreed() == 0);
error:
- cl_report_error(status);
return status;
}