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 Advanced Simulation Library.
Advanced Computational Language.
virtual string getLocalDeclaration(const KernelConfiguration &kernelConfig) const
virtual string getName() const
std::string numToStr(T i)
Converts numbers or another type to string.
unsigned int paddingElements(unsigned int size, const KernelConfiguration &kernelConfig)
Adds padding in elements based on vector width.
virtual string getAddressSpaceQualifier() const
virtual string getTypeSignature(const KernelConfiguration &kernelConfig) const
virtual void setAsArgument(cl::Kernel &kernel, unsigned int argumentIndex) const
virtual void addToKernelSource(vector< Element > &arguments, vector< Element > &localDeclarations) const
constexpr const TypeID typeToTypeID()
Class interface for cl_kernel.
virtual string str(const KernelConfiguration &kernelConfig) const