mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Support CL_INVALID_PROGRAM_EXECUTABLE in clCreateKernel
Change-Id: I7ff5b988d0e6187931ea4ad35a7aaeb92e37907a
This commit is contained in:

committed by
sys_ocldev

parent
8d80a84ac0
commit
20aa362a7d
@ -1452,6 +1452,11 @@ cl_kernel CL_API_CALL clCreateKernel(cl_program clProgram,
|
||||
break;
|
||||
}
|
||||
|
||||
if (pProgram->getBuildStatus() != CL_SUCCESS) {
|
||||
retVal = CL_INVALID_PROGRAM_EXECUTABLE;
|
||||
break;
|
||||
}
|
||||
|
||||
const KernelInfo *pKernelInfo = pProgram->getKernelInfo(kernelName);
|
||||
if (!pKernelInfo) {
|
||||
retVal = CL_INVALID_KERNEL_NAME;
|
||||
|
@ -154,6 +154,10 @@ class Program : public BaseObject<_cl_program> {
|
||||
cl_int getBuildInfo(cl_device_id device, cl_program_build_info paramName,
|
||||
size_t paramValueSize, void *paramValue, size_t *paramValueSizeRet) const;
|
||||
|
||||
cl_build_status getBuildStatus() const {
|
||||
return buildStatus;
|
||||
}
|
||||
|
||||
Context &getContext() const {
|
||||
return *context;
|
||||
}
|
||||
|
@ -95,6 +95,7 @@ TEST_F(clCreateKernelTests, invalidKernel) {
|
||||
|
||||
MockProgram *pMockProg = new MockProgram(pContext, false);
|
||||
pMockProg->addKernelInfo(pKernelInfo);
|
||||
pMockProg->SetBuildStatus(CL_BUILD_SUCCESS);
|
||||
|
||||
kernel = clCreateKernel(
|
||||
pMockProg,
|
||||
@ -199,6 +200,20 @@ TEST_F(clCreateKernelTests, invalidProgram) {
|
||||
ASSERT_EQ(nullptr, kernel);
|
||||
}
|
||||
|
||||
TEST_F(clCreateKernelTests, givenProgramWithBuildErrorWhenCreatingNewKernelThenReturnClInvalidProgramExecutable) {
|
||||
cl_kernel kernel = nullptr;
|
||||
std::unique_ptr<MockProgram> pMockProg = std::make_unique<MockProgram>(pContext, false);
|
||||
pMockProg->SetBuildStatus(CL_BUILD_ERROR);
|
||||
|
||||
kernel = clCreateKernel(
|
||||
pMockProg.get(),
|
||||
"",
|
||||
&retVal);
|
||||
|
||||
EXPECT_EQ(CL_INVALID_PROGRAM_EXECUTABLE, retVal);
|
||||
EXPECT_EQ(nullptr, kernel);
|
||||
}
|
||||
|
||||
TEST_F(clCreateKernelTests, noRet) {
|
||||
cl_kernel kernel = nullptr;
|
||||
kernel = clCreateKernel(
|
||||
|
Reference in New Issue
Block a user