summaryrefslogtreecommitdiff
path: root/utests/compiler_byte_scatter.cpp
diff options
context:
space:
mode:
authorBenjamin Segovia <segovia.benjamin@gmail.com>2012-05-10 20:09:32 +0000
committerKeith Packard <keithp@keithp.com>2012-08-10 16:17:20 -0700
commitf79f4ef56a98a8a9a4c756f41f53322002238ac4 (patch)
tree84078e88738f41fb2f2e02b574f59cf56719b26e /utests/compiler_byte_scatter.cpp
parent44ee5a35d1e484f5ad10b67df136ef325071345d (diff)
downloadbeignet-f79f4ef56a98a8a9a4c756f41f53322002238ac4.tar.gz
Fixed this damn fucking relocation bug!
Diffstat (limited to 'utests/compiler_byte_scatter.cpp')
-rw-r--r--utests/compiler_byte_scatter.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/utests/compiler_byte_scatter.cpp b/utests/compiler_byte_scatter.cpp
new file mode 100644
index 00000000..115f5df3
--- /dev/null
+++ b/utests/compiler_byte_scatter.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright © 2012 Intel Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Benjamin Segovia <benjamin.segovia@intel.com>
+ */
+
+#include "utest_helper.hpp"
+
+static void compiler_byte_scatter(void)
+{
+ const size_t n = 128;
+
+ // Setup kernel and buffers
+ OCL_CREATE_KERNEL("compiler_byte_scatter");
+ OCL_CREATE_BUFFER(buf[0], 0, n * sizeof(int8_t), NULL);
+
+ // Run the kernel
+ OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]);
+ globals[0] = n;
+ locals[0] = 16;
+ OCL_NDRANGE(1);
+
+ // Check result
+ OCL_MAP_BUFFER(0);
+ for (int32_t i = 0; i < (int32_t) n; ++i)
+ OCL_ASSERT(((int8_t*)buf_data[0])[i] == (int8_t) i);
+}
+
+MAKE_UTEST_FROM_FUNCTION(compiler_byte_scatter);
+