From 9d324e135c96ad089b5404a274eff84695f02fd0 Mon Sep 17 00:00:00 2001 From: David Hashe Date: Mon, 22 Aug 2016 11:41:37 -0400 Subject: 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. --- tests/test-progs/gpu-hello/src/gpu-hello.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/test-progs') 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, -- cgit v1.2.3