mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-20 06:29:02 +00:00
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:
committed by
Kévin Petit
parent
8b34a55cfc
commit
0b1520f508
@@ -27,11 +27,9 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool gOfflineCompiler = false;
|
||||
bool gForceSpirVCache = false;
|
||||
bool gForceSpirVGenerate = false;
|
||||
std::string gSpirVPath = ".";
|
||||
OfflineCompilerOutputType gOfflineCompilerOutputType;
|
||||
CompilationMode gCompilationMode = kOnline;
|
||||
CompilationCacheMode gCompilationCacheMode = kCacheModeCompileIfAbsent;
|
||||
std::string gSpirVPath = ".";
|
||||
|
||||
void helpInfo ()
|
||||
{
|
||||
@@ -70,29 +68,27 @@ int parseCustomParam (int argc, const char *argv[], const char *ignore)
|
||||
delArg = 1;
|
||||
if ((i + 1) < argc)
|
||||
{
|
||||
gOfflineCompiler = true;
|
||||
|
||||
if (!strcmp(argv[i + 1], "binary"))
|
||||
{
|
||||
gOfflineCompilerOutputType = kBinary;
|
||||
gCompilationMode = kBinary;
|
||||
delArg++;
|
||||
}
|
||||
else if (!strcmp(argv[i + 1], "spir_v"))
|
||||
{
|
||||
gOfflineCompilerOutputType = kSpir_v;
|
||||
gCompilationMode = kSpir_v;
|
||||
delArg++;
|
||||
if ((i + 3) < argc)
|
||||
{
|
||||
if (!strcmp(argv[i + 2], "cache"))
|
||||
{
|
||||
gForceSpirVCache = true;
|
||||
gCompilationCacheMode = kCacheModeForceRead;
|
||||
gSpirVPath = argv[i + 3];
|
||||
log_info(" SpirV reading from cache enabled.\n");
|
||||
delArg += 2;
|
||||
}
|
||||
else if (!strcmp(argv[i + 2], "generate"))
|
||||
{
|
||||
gForceSpirVGenerate = true;
|
||||
gCompilationCacheMode = kCacheModeOverwrite;
|
||||
gSpirVPath = argv[i + 3];
|
||||
log_info(" SpirV force generate binaries enabled.\n");
|
||||
delArg += 2;
|
||||
|
||||
Reference in New Issue
Block a user