From 8bc85173931c31e47726ec57a7babe9fac811460 Mon Sep 17 00:00:00 2001 From: Gil Pitney Date: Wed, 29 Jun 2016 22:26:53 +0000 Subject: Add in the logic to resetDeviceDependent upon recompiling a built program Previously, this was ifdef'd out, but the logic is needed to ensure the program is actually rebuilt if the client rebuild the same program with different user options. This enables the following 3 test_compiler Khronos test cases to pass: % test_compiler options_build_macro options_build_macro_existence options_include_directory Signed-off-by: Gil Pitney --- src/core/program.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/core/program.cpp b/src/core/program.cpp index 1b981da..1158cfd 100644 --- a/src/core/program.cpp +++ b/src/core/program.cpp @@ -592,22 +592,17 @@ cl_int Program::compile(const char *options, { cl_int retcode = CL_SUCCESS; -#if 0 - // If we've already built this program and are re-building - // (for example, with different user options) then clear out the - // device dependent information in preparation for building again. - if( p_state == Built || p_state == Compiled) resetDeviceDependent(); -#else // Per the v1.2 spec for clBuildProgram() and clCompileProgram(): // "Returns: CL_INVALID_OPERATION if there are kernel objects attached to program." - // Note this causes some Khronos tests to fail, like test_compiler options_build_macro, - // options_build_macro_existence, and options_include_directory, and - // test_api binary_create, as they all violate the spec in this regard. if (kernelList.size() > 0) { p_state = Failed; return(CL_INVALID_OPERATION); } -#endif + + // If we've already built this program and are re-building + // (for example, with different user options) then clear out the + // device dependent information in preparation for building again. + if( p_state == Built || p_state == Compiled) resetDeviceDependent(); p_state = Failed; -- cgit v1.2.3