From: David Hashe Date: Mon, 22 Aug 2016 15:41:37 +0000 (-0400) Subject: tests: Add example of using KVM acceleration with an app X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9d324e135c96ad089b5404a274eff84695f02fd0;p=gem5.git 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. --- diff --git a/tests/test-progs/gpu-hello/src/gpu-hello.cpp b/tests/test-progs/gpu-hello/src/gpu-hello.cpp index b054558f5..bdff074a8 100755 --- a/tests/test-progs/gpu-hello/src/gpu-hello.cpp +++ b/tests/test-progs/gpu-hello/src/gpu-hello.cpp @@ -41,6 +41,12 @@ #include #include +#ifdef KVM_SWITCH +#include "m5op.h" + +void *m5_mem = (void*)0xffffc90000000000; +#endif + #define SUCCESS 0 #define FAILURE 1 @@ -247,6 +253,10 @@ runCLKernel(cl_kernel kernel) return FAILURE; } +#ifdef KVM_SWITCH + m5_switchcpu(); +#endif + // 2. Launch kernel status = clEnqueueNDRangeKernel(commandQueue, kernel, 1, NULL, globalThreads, localThreads, 0, NULL,