Mali OpenCL SDK v1.1.0
Home
Help and Tutorials
Files
File List
File Members
All
Classes
Files
Functions
Variables
Macros
Pages
hello_world_vector.cl
Go to the documentation of this file.
1
/*
2
* This confidential and proprietary software may be used only as
3
* authorised by a licensing agreement from ARM Limited
4
* (C) COPYRIGHT 2013 ARM Limited
5
* ALL RIGHTS RESERVED
6
* The entire notice above must be reproduced on all authorised
7
* copies and copies may only be made to the extent permitted
8
* by a licensing agreement from ARM Limited.
9
*/
10
17
/* [Vector Implementation] */
18
__kernel
void
hello_world_vector
(__global
int
* restrict inputA,
19
__global
int
* restrict inputB,
20
__global
int
* restrict output)
21
{
22
/*
23
* We have reduced the global work size (n) by a factor of 4 compared to the hello_world_opencl sample.
24
* Therefore, i will now be in the range [0, (n / 4) - 1].
25
*/
26
int
i = get_global_id(0);
27
28
/*
29
* Load 4 integers into 'a'.
30
* The offset calculation is implicit from the size of the vector load.
31
* For vloadN(i, p), the address of the first data loaded would be p + i * N.
32
* Load from the data from the address: inputA + i * 4.
33
*/
34
int4 a = vload4(i, inputA);
35
/* Do the same for inputB */
36
int4 b = vload4(i, inputB);
37
38
/*
39
* Do the vector addition.
40
* Store the result at the address: output + i * 4.
41
*/
42
vstore4(a + b, i, output);
43
}
44
/* [Vector Implementation] */
samples
hello_world_vector
assets
hello_world_vector.cl
(C) ARM Ltd. 2013