tests: Add example of using KVM acceleration with an app

Add #ifdef's to gpu-hello.cpp demonstrating how to annotate an application
for KVM acceleration.
This commit is contained in:
David Hashe 2016-08-22 11:41:37 -04:00
parent f3ccaab1e9
commit 9d324e135c

View file

@ -41,6 +41,12 @@
#include <fstream> #include <fstream>
#include <string> #include <string>
#ifdef KVM_SWITCH
#include "m5op.h"
void *m5_mem = (void*)0xffffc90000000000;
#endif
#define SUCCESS 0 #define SUCCESS 0
#define FAILURE 1 #define FAILURE 1
@ -247,6 +253,10 @@ runCLKernel(cl_kernel kernel)
return FAILURE; return FAILURE;
} }
#ifdef KVM_SWITCH
m5_switchcpu();
#endif
// 2. Launch kernel // 2. Launch kernel
status = clEnqueueNDRangeKernel(commandQueue, kernel, 1, NULL, status = clEnqueueNDRangeKernel(commandQueue, kernel, 1, NULL,
globalThreads, localThreads, 0, NULL, globalThreads, localThreads, 0, NULL,