Add test fixture for set of simple kernels from simple_kernels.cl
Change-Id: I4e9bde6f1a72eb15c58d09a1ad24f98ccda5a08d
This commit is contained in:
parent
d0298b7f32
commit
0a7c13f805
|
@ -183,4 +183,64 @@ class SimpleArgNonUniformKernelFixture : public ProgramFixture {
|
|||
Kernel *kernel;
|
||||
};
|
||||
|
||||
class SimpleKernelFixture : public ProgramFixture {
|
||||
public:
|
||||
using ProgramFixture::SetUp;
|
||||
SimpleKernelFixture() {
|
||||
kernelsCount = sizeof(kernels) / sizeof(Kernel *);
|
||||
}
|
||||
|
||||
protected:
|
||||
void SetUp(Device *device, Context *context) {
|
||||
ProgramFixture::SetUp();
|
||||
|
||||
cl_device_id deviceId = device;
|
||||
cl_context clContext = context;
|
||||
std::string programName("simple_kernels");
|
||||
CreateProgramFromBinary<Program>(
|
||||
clContext,
|
||||
&deviceId,
|
||||
programName);
|
||||
ASSERT_NE(nullptr, pProgram);
|
||||
|
||||
retVal = pProgram->build(
|
||||
1,
|
||||
&deviceId,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
false);
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
for (uint32_t i = 0; i < kernelsCount; i++) {
|
||||
if ((1 << i) & kernelIds) {
|
||||
std::string kernelName("simple_kernel_");
|
||||
kernelName.append(std::to_string(i));
|
||||
kernels[i] = Kernel::create<MockKernel>(
|
||||
pProgram,
|
||||
*pProgram->getKernelInfo(kernelName.c_str()),
|
||||
&retVal);
|
||||
ASSERT_NE(nullptr, kernels[i]);
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
for (uint32_t i = 0; i < kernelsCount; i++) {
|
||||
if (kernels[i]) {
|
||||
delete kernels[i];
|
||||
kernels[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
ProgramFixture::TearDown();
|
||||
}
|
||||
|
||||
uint32_t kernelsCount;
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
Kernel *kernels[5] = {};
|
||||
uint32_t kernelIds = 0;
|
||||
};
|
||||
|
||||
} // namespace OCLRT
|
||||
|
|
|
@ -37,7 +37,7 @@ __kernel void simple_kernel_2(
|
|||
|
||||
__kernel void simple_kernel_3(
|
||||
__global uint *dst) {
|
||||
dst[get_local_id(0)] = 0;
|
||||
dst[get_global_id(0)] = 0;
|
||||
}
|
||||
|
||||
__kernel void simple_kernel_4() {
|
||||
|
|
Loading…
Reference in New Issue