}
GBE_EXPORT_SYMBOL
-const GenKernel *GenProgramGetKernel(const GenProgram *genProgram, const char *name) {
+const GenKernel *GenProgramGetKernelByName(const GenProgram *genProgram, const char *name) {
if (genProgram == NULL) return NULL;
const gbe::gen::Program *program = (const gbe::gen::Program*) genProgram;
return (GenKernel*) program->getKernel(std::string(name));
}
GBE_EXPORT_SYMBOL
+const GenKernel *GenProgramGetKernel(const GenProgram *genProgram, uint32_t ID) {
+ if (genProgram == NULL) return NULL;
+ const gbe::gen::Program *program = (const gbe::gen::Program*) genProgram;
+ return (GenKernel*) program->getKernel(ID);
+}
+
+GBE_EXPORT_SYMBOL
const char *GenKernelGetCode(const GenKernel *genKernel) {
if (genKernel == NULL) return NULL;
const gbe::gen::Kernel *kernel = (const gbe::gen::Kernel*) genKernel;
uint32_t GenProgramGetKernelNum(const GenProgram *program);
/*! Get the kernel from its name */
-const GenKernel *GenProgramGetKernel(const GenProgram *program, const char *name);
+const GenKernel *GenProgramGetKernelByName(const GenProgram *program, const char *name);
+
+/*! Get the kernel from its ID */
+const GenKernel *GenProgramGetKernel(const GenProgram *program, uint32_t ID);
/*! Get the Gen ISA source code */
const char *GenKernelGetCode(const GenKernel *kernel);
else
return it->second;
}
+ /*! Get the kernel from its ID */
+ Kernel *getKernel(const uint32_t ID) const {
+ uint32_t currID = 0;
+ Kernel *kernel = NULL;
+ for (auto it = kernels.begin(); it != kernels.end(); ++it) {
+ if (currID == ID) {
+ kernel = it->second;
+ break;
+ }
+ }
+ return kernel;
+ }
/*! Build a program from a ir::Unit */
bool buildFromUnit(const ir::Unit &unit, std::string &error);
/*! Buils a program from a LLVM source code */