diff options
author | Benjamin Segovia <segovia.benjamin@gmail.com> | 2012-05-10 20:09:32 +0000 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-08-10 16:17:20 -0700 |
commit | f79f4ef56a98a8a9a4c756f41f53322002238ac4 (patch) | |
tree | 84078e88738f41fb2f2e02b574f59cf56719b26e /utests/compiler_short_scatter.cpp | |
parent | 44ee5a35d1e484f5ad10b67df136ef325071345d (diff) | |
download | beignet-f79f4ef56a98a8a9a4c756f41f53322002238ac4.tar.gz |
Fixed this damn fucking relocation bug!
Diffstat (limited to 'utests/compiler_short_scatter.cpp')
-rw-r--r-- | utests/compiler_short_scatter.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/utests/compiler_short_scatter.cpp b/utests/compiler_short_scatter.cpp new file mode 100644 index 00000000..8f5f4c2f --- /dev/null +++ b/utests/compiler_short_scatter.cpp @@ -0,0 +1,44 @@ +/* + * 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_short_scatter(void) +{ + const size_t n = 128; + + // Setup kernel and buffers + OCL_CREATE_KERNEL("compiler_short_scatter"); + OCL_CREATE_BUFFER(buf[0], 0, n * sizeof(int16_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(((int16_t*)buf_data[0])[i] == (int16_t) i); +} + +MAKE_UTEST_FROM_FUNCTION(compiler_short_scatter); + + |