24 #ifndef ACLLOCALARRAY_H
25 #define ACLLOCALARRAY_H
27 #include "../aclElementBase.h"
28 #include "../../aslUtilities.h"
29 #include "../aclUtilities.h"
41 template <
typename T>
class LocalArray:
public ElementBase
45 static const string prefix;
46 static unsigned int id;
48 explicit LocalArray(
unsigned int size_);
49 virtual string str(
const KernelConfiguration & kernelConfig)
const;
50 virtual string getName()
const;
51 virtual string getAddressSpaceQualifier()
const;
52 virtual string getTypeSignature(
const KernelConfiguration & kernelConfig)
const;
53 virtual string getLocalDeclaration(
const KernelConfiguration & kernelConfig)
const;
54 virtual void addToKernelSource(vector<Element> & arguments,
55 vector<Element> & localDeclarations)
const;
56 virtual void setAsArgument(
cl::Kernel & kernel,
unsigned int argumentIndex)
const;
60 template <
typename T> LocalArray<T>::LocalArray(
unsigned int size_):
68 template <
typename T>
string LocalArray<T>::str(
const KernelConfiguration & kernelConfig)
const
70 if (kernelConfig.unaligned && kernelConfig.vectorWidth > 1)
72 return "vload" +
numToStr(kernelConfig.vectorWidth) +
"(0, &" + name +
"[" +
INDEX +
"])";
76 return name +
"[" +
INDEX +
"]";
101 return "__local " + typeToStr<T>(kernelConfig.unaligned ? 1 : kernelConfig.vectorWidth)
107 vector<Element> & localDeclarations)
const
114 unsigned int argumentIndex)
const
121 #endif // ACLLOCALARRAY_H