return CL_BUILD_NONE when clGetProgramBuildInfo is called

return CL_BUILD_NONE from clGetProgramBuildInfo (CL_PROGRAM_BUILD_STATUS)
when clCreateProgramWithBinary was called and no build has been performed
on the specified program object for device.

Change-Id: Ib59dd07671a69ab1325c6c51f28e9dd550d5e5bf
This commit is contained in:
Kamil Diedrich
2018-06-26 15:52:13 +02:00
committed by sys_ocldev
parent 415623b08f
commit 5186474ef5
3 changed files with 44 additions and 4 deletions

View File

@@ -138,7 +138,6 @@ cl_int Program::processElfBinary(
if (retVal == CL_SUCCESS) { if (retVal == CL_SUCCESS) {
isProgramBinaryResolved = true; isProgramBinaryResolved = true;
buildStatus = CL_BUILD_SUCCESS;
// Create an empty build log since program is effectively built // Create an empty build log since program is effectively built
updateBuildLog(pDevice, "", 1); updateBuildLog(pDevice, "", 1);

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Intel Corporation * Copyright (c) 2017 - 2018, Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -35,7 +35,7 @@ typedef api_tests clGetProgramBuildInfoTests;
namespace ULT { namespace ULT {
TEST_F(clGetProgramBuildInfoTests, success) { TEST_F(clGetProgramBuildInfoTests, givenSourceWhenclGetProgramBuildInfoIsCalledThenReturnClBuildNone) {
cl_program pProgram = nullptr; cl_program pProgram = nullptr;
void *pSource = nullptr; void *pSource = nullptr;
size_t sourceSize = 0; size_t sourceSize = 0;
@@ -109,4 +109,45 @@ TEST_F(clGetProgramBuildInfoTests, success) {
deleteDataReadFromFile(pSource); deleteDataReadFromFile(pSource);
CompilerInterface::shutdown(); CompilerInterface::shutdown();
} }
TEST_F(clGetProgramBuildInfoTests, givenElfBinaryWhenclGetProgramBuildInfoIsCalledThenReturnClBuildNone) {
cl_program pProgram = nullptr;
cl_int binaryStatus = CL_INVALID_VALUE;
void *pBinary = nullptr;
size_t binarySize = 0;
std::string testFile;
retrieveBinaryKernelFilename(testFile, "CopyBuffer_simd8_", ".bin");
ASSERT_EQ(true, fileExists(testFile));
binarySize = loadDataFromFile(
testFile.c_str(),
pBinary);
ASSERT_NE(0u, binarySize);
ASSERT_NE(nullptr, pBinary);
pProgram = clCreateProgramWithBinary(
pContext,
num_devices,
devices,
&binarySize,
(const unsigned char **)&pBinary,
&binaryStatus,
&retVal);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_NE(nullptr, pProgram);
EXPECT_EQ(CL_SUCCESS, binaryStatus);
cl_build_status buildStatus;
retVal = clGetProgramBuildInfo(pProgram, devices[0], CL_PROGRAM_BUILD_STATUS, sizeof(buildStatus), &buildStatus, nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(CL_BUILD_NONE, buildStatus);
deleteDataReadFromFile(pBinary);
retVal = clReleaseProgram(pProgram);
EXPECT_EQ(CL_SUCCESS, retVal);
CompilerInterface::shutdown();
}
} // namespace ULT } // namespace ULT

View File

@@ -373,7 +373,7 @@ TEST_P(ProgramFromBinaryTest, GetBuildInfo_Status) {
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(param_value_size, param_value_size_ret); EXPECT_EQ(param_value_size, param_value_size_ret);
EXPECT_EQ(CL_BUILD_SUCCESS, buildStatus); EXPECT_EQ(CL_BUILD_NONE, buildStatus);
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////