36#include <granulation.h>
37#include <trace_malloc.h>
51#define SUBDIM_UNUSED (size_t)-1
55 MAX_STATEMENT_PRIORITY = 63,
56 MAX_STATEMENT_LENGTH = 4096
66 FUNC_NAME_MAXLEN = KSTRING_MAXLEN
70 SubproblemDim subdims[MAX_SUBDIMS];
89typedef enum CLMemFence {
97typedef enum UptrType {
107typedef struct Kstring {
109 char buf[KSTRING_MAXLEN];
117(*LoopUnrollGen)(
struct KgenContext *ctx,
void *priv);
125typedef struct LoopCtl {
132 unsigned long inBound;
139typedef struct LoopUnrollers {
141 LoopUnrollGen preUnroll;
143 LoopUnrollGen genSingleVec;
145 LoopUnrollGen genSingle;
147 LoopUnrollGen postUnroll;
149 LoopUnrollGen getVecLen;
155emptyKstring(Kstring *kstr)
161isKstringEmpty(
const Kstring *kstr)
163 return (kstr->buf[0] ==
'\0');
190*createKgenContext(
char *srcBuf,
size_t srcBufLen,
bool fmt);
199destroyKgenContext(
struct KgenContext *ctx);
211resetKgenContext(
struct KgenContext *ctx);
234 struct KgenContext *srcCtx,
235 const struct KgenContext *dstCtx,
251kgenDeclareFunction(
struct KgenContext *ctx,
const char *decl);
264kgenBeginFuncBody(
struct KgenContext *ctx);
278kgenEndFuncBody(
struct KgenContext *ctx);
296 const struct KgenContext *ctx);
313kgenBeginBranch(
struct KgenContext *ctx,
const char *stmt);
330kgenEndBranch(
struct KgenContext *ctx,
const char *stmt);
348kgenAddStmt(
struct KgenContext *ctx,
const char *stmt);
351kgenPrintf(
struct KgenContext *ctx,
const char *fmt,...);
354*createStmtBatch(
void);
358 struct StatementBatch *batch,
364 struct StatementBatch *batch,
366 const char *fmt,...);
369flushStmtBatch(
struct KgenContext *ctx,
struct StatementBatch *batch);
372destroyStmtBatch(
struct StatementBatch *batch);
384kgenAddBlankLine(
struct KgenContext *ctx);
397kgenSourceSize(
struct KgenContext *ctx);
418kgenAddBarrier(
struct KgenContext *ctx, CLMemFence fence);
430kgenAddMemFence(
struct KgenContext *ctx, CLMemFence fence);
447 struct KgenContext *ctx,
449 const PGranularity *pgran);
466 struct KgenContext *ctx,
468 const PGranularity *pgran);
480kgenDeclareUptrs(
struct KgenContext *ctx,
bool withDouble);
519 struct KgenContext *ctx,
522 const LoopUnrollers *unrollers,
542 struct KgenContext *ctx,
543 int (*genCallback)(
struct KgenContext *ctx,
const void *pattern),
558 struct KgenGuard *guard,
559 struct KgenContext *ctx,
560 int (*genCallback)(
struct KgenContext *ctx,
const void *pattern),
585 struct KgenGuard *guard,
597destroyKgenGuard(
struct KgenGuard *guard);
609kstrcpy(Kstring *kstr,
const char *str);
612ksprintf(Kstring *kstr,
const char *fmt,...);
615kstrcatf(Kstring *kstr,
const char *fmt,...);
619*uptrTypeName(UptrType type);
634dtypeToPrefix(DataType type);
645*dtypeBuiltinType(DataType dtype);
656*dtypeUPtrField(DataType dtype);
667*strOne(DataType dtype);
686 const char **typeName,
687 const char **typePtrName);