Return 0 when Program Scope Global Variables are not supported

clGetDeviceInfo and clGetProgramBuildInfo may return 0 when Program
Scope Global Variables are not supported

Related-To: NEO-4368

Change-Id: I2c319c53ffa2e02eeb370775023f5d73219cb39e
Signed-off-by: Andrzej Swierczynski <andrzej.swierczynski@intel.com>
This commit is contained in:
Andrzej Swierczynski
2020-04-10 14:45:04 +02:00
committed by sys_ocldev
parent 853d870d1c
commit 42810f4690
5 changed files with 51 additions and 7 deletions

View File

@@ -550,6 +550,7 @@ TEST_P(ProgramFromBinaryTest, GivenGlobalVariableTotalSizeSetWhenGettingBuildGlo
paramValueSize,
paramValue,
&paramValueSizeRet);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(paramValueSizeRet, sizeof(globalVarSize));
EXPECT_EQ(globalVarSize, 0u);
@@ -557,7 +558,12 @@ TEST_P(ProgramFromBinaryTest, GivenGlobalVariableTotalSizeSetWhenGettingBuildGlo
// Set GlobalVariableTotalSize as 1024
CreateProgramFromBinary(pContext, &device, BinaryFileName);
MockProgram *p = pProgram;
p->SetGlobalVariableTotalSize(1024u);
ProgramInfo programInfo;
char constantData[1024] = {};
programInfo.globalVariables.initData = constantData;
programInfo.globalVariables.size = sizeof(constantData);
p->processProgramInfo(programInfo);
// get build info once again
retVal = pProgram->getBuildInfo(
@@ -568,7 +574,11 @@ TEST_P(ProgramFromBinaryTest, GivenGlobalVariableTotalSizeSetWhenGettingBuildGlo
&paramValueSizeRet);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(paramValueSizeRet, sizeof(globalVarSize));
EXPECT_EQ(globalVarSize, 1024u);
if (castToObject<ClDevice>(pClDevice)->getEnabledClVersion() >= 20) {
EXPECT_EQ(globalVarSize, 1024u);
} else {
EXPECT_EQ(globalVarSize, 0u);
}
}
TEST_P(ProgramFromBinaryTest, givenProgramWhenItIsBeingBuildThenItContainsGraphicsAllocationInKernelInfo) {