Refactor setting of compilation mode and cache mode

This change refactors the setting of the compilation mode, so that
instead of using a 'gOfflineCompiler' bool together with a
'gOfflineCompilerOutputType' enum, a single 'gCompilationMode' enum
is used.  The default value for gCompilationMode is 'kOnline', which
is equivalent to the previous defaulting of gOfflineCompiler to false.

In addition, it refactors the setting of the compilation cache mode,
so that instead of the 'gForceSpirVCache' and 'gForceSpirVGenerate'
bools, a single 'gCompilationCacheMode' enum is used.  The default
value for gCompilationCacheMode is 'kCacheModeCompileIfAbsent', which
is equivalent to the previous defaulting of both booleans to false.

This change also refactors create_openclcpp_program() to avoid saving
and restoring gOfflineCompiler and gOfflineCompilerOutputType.  Instead,
it now passes the desired compilation mode as a parameter.
This commit is contained in:
Stuart Brady
2019-06-27 17:44:54 +01:00
committed by Kévin Petit
parent 8b34a55cfc
commit 0b1520f508
5 changed files with 60 additions and 56 deletions

View File

@@ -20,7 +20,7 @@
#include "errorHelpers.h"
extern bool gOfflineCompiler;
#include "parseParameters.h"
const char *IGetErrorString( int clErrorCode )
{
@@ -800,7 +800,7 @@ int check_opencl_version(cl_device_id device, cl_uint requestedMajorVersion, cl_
int check_functions_for_offline_compiler(const char *subtestname, cl_device_id device)
{
if(gOfflineCompiler)
if (gCompilationMode != kOnline)
{
int nNotRequiredWithOfflineCompiler = sizeof(subtests_to_skip_with_offline_compiler)/sizeof(char *);
size_t i;