mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Add test fixture for set of simple kernels from simple_kernels.cl
Change-Id: I4e9bde6f1a72eb15c58d09a1ad24f98ccda5a08d
This commit is contained in:

committed by
sys_ocldev

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
|
||||
|
Reference in New Issue
Block a user