mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-26 07:00:17 +08:00
Disallow compiling/building program if it has attached Kernels
allow for creating kernel if the program is built for at least one device Related-To: NEO-5001 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
a5dba1d43c
commit
8fdc35bb4b
@@ -3062,3 +3062,38 @@ TEST(BuildProgramTest, givenMultiDeviceProgramWhenBuildingThenStoreAndProcessBin
|
||||
retVal = clReleaseProgram(pProgram);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
}
|
||||
|
||||
TEST(ProgramTest, whenProgramIsBuiltAsAnExecutableForAtLeastOneDeviceThenIsBuiltMethodReturnsTrue) {
|
||||
MockSpecializedContext context;
|
||||
MockProgram program(&context, false, context.getDevices());
|
||||
EXPECT_FALSE(program.isBuilt());
|
||||
program.deviceBuildInfos[context.getDevice(0)].buildStatus = CL_BUILD_SUCCESS;
|
||||
program.deviceBuildInfos[context.getDevice(0)].programBinaryType = CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT;
|
||||
program.deviceBuildInfos[context.getDevice(1)].buildStatus = CL_BUILD_ERROR;
|
||||
EXPECT_FALSE(program.isBuilt());
|
||||
program.deviceBuildInfos[context.getDevice(0)].buildStatus = CL_BUILD_SUCCESS;
|
||||
program.deviceBuildInfos[context.getDevice(0)].programBinaryType = CL_PROGRAM_BINARY_TYPE_EXECUTABLE;
|
||||
EXPECT_TRUE(program.isBuilt());
|
||||
}
|
||||
|
||||
TEST(ProgramTest, givenUnlockedProgramWhenRetainForKernelIsCalledThenProgramIsLocked) {
|
||||
MockSpecializedContext context;
|
||||
MockProgram program(&context, false, context.getDevices());
|
||||
EXPECT_FALSE(program.isLocked());
|
||||
program.retainForKernel();
|
||||
EXPECT_TRUE(program.isLocked());
|
||||
}
|
||||
|
||||
TEST(ProgramTest, givenLockedProgramWhenReleasingForKernelIsCalledForEachRetainThenProgramIsUnlocked) {
|
||||
MockSpecializedContext context;
|
||||
MockProgram program(&context, false, context.getDevices());
|
||||
EXPECT_FALSE(program.isLocked());
|
||||
program.retainForKernel();
|
||||
EXPECT_TRUE(program.isLocked());
|
||||
program.retainForKernel();
|
||||
EXPECT_TRUE(program.isLocked());
|
||||
program.releaseForKernel();
|
||||
EXPECT_TRUE(program.isLocked());
|
||||
program.releaseForKernel();
|
||||
EXPECT_FALSE(program.isLocked());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user