Add new simple kernel and method to adjust WALKER command parameters

Change-Id: Id0591908353ca744c44c7bab4e27db8332289a68
This commit is contained in:
Zdanowicz, Zbigniew 2018-10-26 15:02:28 -07:00
parent 6aa9b36a7b
commit 7a4ecd1507
6 changed files with 48 additions and 9 deletions

View File

@ -201,6 +201,11 @@ class GpgpuWalkerHelper {
static void dispatchOnDeviceWaitlistSemaphores(LinearStream *commandStream, Device &currentDevice, static void dispatchOnDeviceWaitlistSemaphores(LinearStream *commandStream, Device &currentDevice,
cl_uint numEventsInWaitList, const cl_event *eventWaitList); cl_uint numEventsInWaitList, const cl_event *eventWaitList);
static void adjustWalkerData(LinearStream *commandStream,
WALKER_TYPE<GfxFamily> *walkerCmd,
const Kernel &kernel,
const DispatchInfo &dispatchInfo);
}; };
template <typename GfxFamily> template <typename GfxFamily>

View File

@ -189,4 +189,11 @@ void GpgpuWalkerHelper<GfxFamily>::setupTimestampPacket(
} }
} }
template <typename GfxFamily>
void GpgpuWalkerHelper<GfxFamily>::adjustWalkerData(LinearStream *commandStream,
WALKER_TYPE<GfxFamily> *walkerCmd,
const Kernel &kernel,
const DispatchInfo &dispatchInfo) {
}
} // namespace OCLRT } // namespace OCLRT

View File

@ -226,6 +226,8 @@ void HardwareInterface<GfxFamily>::dispatchWalker(
localIdsGenerationByRuntime, inlineDataProgrammingRequired, localIdsGenerationByRuntime, inlineDataProgrammingRequired,
*kernel.getKernelInfo().patchInfo.threadPayload); *kernel.getKernelInfo().patchInfo.threadPayload);
GpgpuWalkerHelper<GfxFamily>::adjustWalkerData(commandStream, walkerCmd, kernel, dispatchInfo);
dispatchWorkarounds(commandStream, commandQueue, kernel, false); dispatchWorkarounds(commandStream, commandQueue, kernel, false);
currentDispatchIndex++; currentDispatchIndex++;
} }

View File

@ -9,6 +9,7 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "CL/cl.h" #include "CL/cl.h"
#include "runtime/device/device.h" #include "runtime/device/device.h"
#include "runtime/helpers/array_count.h"
#include "runtime/helpers/file_io.h" #include "runtime/helpers/file_io.h"
#include "runtime/kernel/kernel.h" #include "runtime/kernel/kernel.h"
#include "runtime/program/program.h" #include "runtime/program/program.h"
@ -187,7 +188,7 @@ class SimpleKernelFixture : public ProgramFixture {
public: public:
using ProgramFixture::SetUp; using ProgramFixture::SetUp;
SimpleKernelFixture() { SimpleKernelFixture() {
kernelsCount = sizeof(kernels) / sizeof(Kernel *); kernelsCount = arrayCount(kernels);
} }
protected: protected:
@ -212,14 +213,14 @@ class SimpleKernelFixture : public ProgramFixture {
false); false);
ASSERT_EQ(CL_SUCCESS, retVal); ASSERT_EQ(CL_SUCCESS, retVal);
for (uint32_t i = 0; i < kernelsCount; i++) { for (size_t i = 0; i < kernelsCount; i++) {
if ((1 << i) & kernelIds) { if ((1 << i) & kernelIds) {
std::string kernelName("simple_kernel_"); std::string kernelName("simple_kernel_");
kernelName.append(std::to_string(i)); kernelName.append(std::to_string(i));
kernels[i] = Kernel::create<MockKernel>( kernels[i].reset(Kernel::create<MockKernel>(
pProgram, pProgram,
*pProgram->getKernelInfo(kernelName.c_str()), *pProgram->getKernelInfo(kernelName.c_str()),
&retVal); &retVal));
ASSERT_NE(nullptr, kernels[i]); ASSERT_NE(nullptr, kernels[i]);
ASSERT_EQ(CL_SUCCESS, retVal); ASSERT_EQ(CL_SUCCESS, retVal);
} }
@ -227,19 +228,18 @@ class SimpleKernelFixture : public ProgramFixture {
} }
virtual void TearDown() { virtual void TearDown() {
for (uint32_t i = 0; i < kernelsCount; i++) { for (size_t i = 0; i < kernelsCount; i++) {
if (kernels[i]) { if (kernels[i]) {
delete kernels[i]; kernels[i].reset(nullptr);
kernels[i] = nullptr;
} }
} }
ProgramFixture::TearDown(); ProgramFixture::TearDown();
} }
uint32_t kernelsCount; size_t kernelsCount;
cl_int retVal = CL_SUCCESS; cl_int retVal = CL_SUCCESS;
Kernel *kernels[5] = {}; std::unique_ptr<Kernel> kernels[6] = {};
uint32_t kernelIds = 0; uint32_t kernelIds = 0;
}; };

View File

@ -395,6 +395,25 @@ TEST_F(KernelFromBinaryTests, BuiltInIsSetToFalseForRegularKernels) {
EXPECT_FALSE(isBuiltIn); EXPECT_FALSE(isBuiltIn);
delete pKernel; delete pKernel;
pKernel = nullptr;
pKernelInfo = pProgram->getKernelInfo("simple_kernel_5");
pKernel = Kernel::create(
pProgram,
*pKernelInfo,
&retVal);
ASSERT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, pKernel);
// get builtIn property
isBuiltIn = pKernel->isBuiltIn;
EXPECT_FALSE(isBuiltIn);
delete pKernel;
pKernel = nullptr;
} }
TEST(PatchInfo, Constructor) { TEST(PatchInfo, Constructor) {

View File

@ -5,6 +5,8 @@
* *
*/ */
#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics : enable
__kernel void simple_kernel_0( __kernel void simple_kernel_0(
const uint arg0, const uint arg0,
const float arg1, const float arg1,
@ -42,3 +44,7 @@ __kernel void simple_kernel_3(
__kernel void simple_kernel_4() { __kernel void simple_kernel_4() {
} }
__kernel void simple_kernel_5(__global uint *dst) {
atomic_inc(dst);
}