Remove source transformation support

This change removes support for the "source" mode of offline compilation
which is commented with "to be removed in the future as we will use
offline compiler here".

The "source" mode allowed for the CL source to be transformed by
build_script_source.py and then passed to clCreateProgramWithSource(),
and appears to have been developed only for the purpose of testing the
offline compilation infrastructure.
This commit is contained in:
Stuart Brady
2019-07-03 19:32:44 +01:00
committed by Kévin Petit
parent e7586a7a78
commit 90b0c52584
4 changed files with 7 additions and 38 deletions

View File

@@ -208,8 +208,6 @@ int create_single_kernel_helper_create_program(cl_context context,
const bool openclCXX)
{
int error = CL_SUCCESS;
std::string modifiedKernelStr;
const char* modifiedKernelCode;
if (gOfflineCompiler)
{
@@ -378,30 +376,8 @@ int create_single_kernel_helper_create_program(cl_context context,
int length = ifs.tellg();
ifs.seekg(0, ifs.beg);
//treat modifiedProgram as input for clCreateProgramWithSource
if (gOfflineCompilerOutputType == kSource)
{
// read source from file:
std::vector<char> modifiedKernelBuf(length);
ifs.read(&modifiedKernelBuf[0], length);
ifs.close();
for (int i = 0; i < length; i++)
modifiedKernelStr.push_back(modifiedKernelBuf[i]);
modifiedKernelCode = &modifiedKernelStr[0];
/* Create the program object from source - to be removed in the future as we will use offline compiler here */
*outProgram = clCreateProgramWithSource(context, numKernelLines, &modifiedKernelCode, NULL, &error);
if (*outProgram == NULL || error != CL_SUCCESS)
{
print_error(error, "clCreateProgramWithSource failed");
return error;
}
}
//treat modifiedProgram as input for clCreateProgramWithBinary
else if (gOfflineCompilerOutputType == kBinary)
if (gOfflineCompilerOutputType == kBinary)
{
// read binary from file:
std::vector<unsigned char> modifiedKernelBuf(length);

View File

@@ -35,9 +35,8 @@ OfflineCompilerOutputType gOfflineCompilerOutputType;
void helpInfo ()
{
log_info(" '-offlineCompiler <output_type:binary|source|spir_v>': use offline compiler\n");
log_info(" '-offlineCompiler <output_type:binary|spir_v>': use offline compiler\n");
log_info(" ' output_type binary - \"../build_script_binary.py\" is invoked\n");
log_info(" ' output_type source - \"../build_script_source.py\" is invoked\n");
log_info(" ' output_type spir_v <mode:generate|cache> - \"../cl_build_script_spir_v.py\" is invoked, optional modes: generate, cache\n");
log_info(" ' mode generate <path> - force binary generation\n");
log_info(" ' mode cache <path> - force reading binary files from cache\n");
@@ -78,11 +77,6 @@ int parseCustomParam (int argc, const char *argv[], const char *ignore)
gOfflineCompilerOutputType = kBinary;
delArg++;
}
else if (!strcmp(argv[i + 1], "source"))
{
gOfflineCompilerOutputType = kSource;
delArg++;
}
else if (!strcmp(argv[i + 1], "spir_v"))
{
gOfflineCompilerOutputType = kSpir_v;
@@ -114,7 +108,7 @@ int parseCustomParam (int argc, const char *argv[], const char *ignore)
else
{
log_error(" Offline Compiler parameters are incorrect. Usage:\n");
log_error(" -offlineCompiler <input> <output> <output_type:binary | source | spir_v>\n");
log_error(" -offlineCompiler <input> <output> <output_type:binary|spir_v>\n");
return -1;
}
}

View File

@@ -27,7 +27,6 @@ extern std::string gSpirVPath;
enum OfflineCompilerOutputType
{
kBinary = 0,
kSource,
kSpir_v
};

View File

@@ -423,7 +423,7 @@ int test_get_program_source(cl_device_id deviceID, cl_context context, cl_comman
/* Try getting the length */
error = clGetProgramInfo( program, CL_PROGRAM_SOURCE, NULL, NULL, &length );
test_error( error, "Unable to get program source length" );
if (length != strlen(sample_kernel_code_single_line[0]) + 1 && !(gOfflineCompiler && gOfflineCompilerOutputType != kSource))
if (length != strlen(sample_kernel_code_single_line[0]) + 1 && !gOfflineCompiler)
{
log_error( "ERROR: Length returned for program source is incorrect!\n" );
return -1;
@@ -432,7 +432,7 @@ int test_get_program_source(cl_device_id deviceID, cl_context context, cl_comman
/* Try normal source */
error = clGetProgramInfo( program, CL_PROGRAM_SOURCE, sizeof( buffer ), buffer, NULL );
test_error( error, "Unable to get program source" );
if (strlen(buffer) != strlen(sample_kernel_code_single_line[0]) && !(gOfflineCompiler && gOfflineCompilerOutputType != kSource))
if (strlen(buffer) != strlen(sample_kernel_code_single_line[0]) && !gOfflineCompiler)
{
log_error( "ERROR: Length of program source is incorrect!\n" );
return -1;
@@ -441,12 +441,12 @@ int test_get_program_source(cl_device_id deviceID, cl_context context, cl_comman
/* Try both at once */
error = clGetProgramInfo( program, CL_PROGRAM_SOURCE, sizeof( buffer ), buffer, &length );
test_error( error, "Unable to get program source" );
if (strlen(buffer) != strlen(sample_kernel_code_single_line[0]) && !(gOfflineCompiler && gOfflineCompilerOutputType != kSource))
if (strlen(buffer) != strlen(sample_kernel_code_single_line[0]) && !gOfflineCompiler)
{
log_error( "ERROR: Length of program source is incorrect!\n" );
return -1;
}
if (length != strlen(sample_kernel_code_single_line[0]) + 1 && !(gOfflineCompiler && gOfflineCompilerOutputType != kSource))
if (length != strlen(sample_kernel_code_single_line[0]) + 1 && !gOfflineCompiler)
{
log_error( "ERROR: Returned length of program source is incorrect!\n" );
return -1;