ULT renaming: Create Program from IL

Change-Id: I129f8b2d3f0e36815db2b8f517ae4ea8aeab2209
Signed-off-by: Cetnerowski, Adam <adam.cetnerowski@intel.com>
This commit is contained in:
Cetnerowski, Adam 2018-11-08 15:13:03 +01:00 committed by sys_ocldev
parent 31c6e036ef
commit b3fd643d72
1 changed files with 19 additions and 13 deletions

View File

@ -18,7 +18,7 @@ typedef api_tests clCreateProgramWithILKHRTests;
namespace ULT { namespace ULT {
TEST_F(clCreateProgramWithBinaryTests, returnsSuccess) { TEST_F(clCreateProgramWithBinaryTests, GivenCorrectParametersWhenCreatingProgramWithBinaryThenProgramIsCreatedAndSuccessIsReturned) {
cl_program pProgram = nullptr; cl_program pProgram = nullptr;
cl_int binaryStatus = CL_INVALID_VALUE; cl_int binaryStatus = CL_INVALID_VALUE;
void *pBinary = nullptr; void *pBinary = nullptr;
@ -63,7 +63,7 @@ TEST_F(clCreateProgramWithBinaryTests, returnsSuccess) {
EXPECT_EQ(nullptr, pProgram); EXPECT_EQ(nullptr, pProgram);
} }
TEST_F(clCreateProgramWithILTests, whenContextIsInvalidThenReturnsInvalidValue) { TEST_F(clCreateProgramWithILTests, GivenInvalidContextWhenCreatingProgramWithIlThenInvalidContextErrorIsReturned) {
const uint32_t spirv[16] = {0x03022307}; const uint32_t spirv[16] = {0x03022307};
cl_int err = CL_SUCCESS; cl_int err = CL_SUCCESS;
@ -72,24 +72,23 @@ TEST_F(clCreateProgramWithILTests, whenContextIsInvalidThenReturnsInvalidValue)
EXPECT_EQ(nullptr, prog); EXPECT_EQ(nullptr, prog);
} }
TEST_F(clCreateProgramWithILTests, whenIntermediateRepresentationIsEmptyThenReturnsInvalidValue) { TEST_F(clCreateProgramWithILTests, GivenNullIlWhenCreatingProgramWithIlThenInvalidValueErrorIsReturned) {
const uint32_t spirv[16] = {0x03022307};
cl_int err = CL_SUCCESS; cl_int err = CL_SUCCESS;
cl_program prog = clCreateProgramWithIL(pContext, nullptr, 0, &err); cl_program prog = clCreateProgramWithIL(pContext, nullptr, 0, &err);
EXPECT_EQ(CL_INVALID_VALUE, err); EXPECT_EQ(CL_INVALID_VALUE, err);
EXPECT_EQ(nullptr, prog); EXPECT_EQ(nullptr, prog);
}
err = CL_SUCCESS; TEST_F(clCreateProgramWithILTests, GivenIncorrectIlSizeWhenCreatingProgramWithIlThenInvalidBinaryErrorIsReturned) {
prog = clCreateProgramWithIL(pContext, spirv, 0, &err); const uint32_t spirv[16] = {0x03022307};
cl_int err = CL_SUCCESS;
cl_program prog = clCreateProgramWithIL(pContext, spirv, 0, &err);
EXPECT_EQ(CL_INVALID_BINARY, err); EXPECT_EQ(CL_INVALID_BINARY, err);
EXPECT_EQ(nullptr, prog); EXPECT_EQ(nullptr, prog);
prog = clCreateProgramWithIL(pContext, spirv, 0, nullptr);
EXPECT_EQ(nullptr, prog);
} }
TEST_F(clCreateProgramWithILTests, whenIntermediateRepresentationIsNotSpirvOrLlvmBCThenReturnsInvalidValue) { TEST_F(clCreateProgramWithILTests, GivenIncorrectIlWhenCreatingProgramWithIlThenInvalidBinaryErrorIsReturned) {
const uint32_t notSpirv[16] = {0xDEADBEEF}; const uint32_t notSpirv[16] = {0xDEADBEEF};
cl_int err = CL_SUCCESS; cl_int err = CL_SUCCESS;
@ -98,7 +97,14 @@ TEST_F(clCreateProgramWithILTests, whenIntermediateRepresentationIsNotSpirvOrLlv
EXPECT_EQ(nullptr, prog); EXPECT_EQ(nullptr, prog);
} }
TEST_F(clCreateProgramWithILKHRTests, whenValidInputParametersThenReturnsSuccessAndProgram) { TEST_F(clCreateProgramWithILTests, GivenIncorrectIlAndNoErrorPointerWhenCreatingProgramWithIlThenInvalidBinaryErrorIsReturned) {
const uint32_t notSpirv[16] = {0xDEADBEEF};
cl_program prog = clCreateProgramWithIL(pContext, notSpirv, sizeof(notSpirv), nullptr);
EXPECT_EQ(nullptr, prog);
}
TEST_F(clCreateProgramWithILKHRTests, GivenCorrectParametersWhenCreatingProgramWithIlkhrThenProgramIsCreatedAndSuccessIsReturned) {
const uint32_t spirv[16] = {0x03022307}; const uint32_t spirv[16] = {0x03022307};
cl_int err = CL_INVALID_VALUE; cl_int err = CL_INVALID_VALUE;
@ -110,7 +116,7 @@ TEST_F(clCreateProgramWithILKHRTests, whenValidInputParametersThenReturnsSuccess
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
} }
TEST_F(clCreateProgramWithILKHRTests, whenInvalidInputParameterThenReturnsNull) { TEST_F(clCreateProgramWithILKHRTests, GivenNullIlWhenCreatingProgramWithIlkhrThenNullProgramIsReturned) {
cl_program program = clCreateProgramWithILKHR(pContext, nullptr, 0, nullptr); cl_program program = clCreateProgramWithILKHR(pContext, nullptr, 0, nullptr);
EXPECT_EQ(nullptr, program); EXPECT_EQ(nullptr, program);
} }