Rename gSpirVPath to gCompilationCachePath

gSpirVPath controls the location of the compilation cache for SPIR-V
offline compilation, but its name falsely implies that it is
SPIR-V specific.  This change renames it to gCompilationCachePath.
This commit is contained in:
Stuart Brady
2019-06-27 18:15:15 +01:00
committed by Kévin Petit
parent 9be570cdf0
commit f2f458b675
4 changed files with 12 additions and 11 deletions

View File

@@ -173,7 +173,7 @@ std::string add_build_options(const std::string &baseName, const char *options)
do
{
i++;
std::string fileName = gSpirVPath + slash + get_file_name(baseName, i, ".options");
std::string fileName = gCompilationCachePath + slash + get_file_name(baseName, i, ".options");
long fileSize = get_file_size(fileName);
if (fileSize == 0)
break;
@@ -186,7 +186,8 @@ std::string add_build_options(const std::string &baseName, const char *options)
} while (!equal);
if (equal)
return get_file_name(baseName, i, "");
std::string fileName = gSpirVPath + slash + get_file_name(baseName, i, ".options");
std::string fileName = gCompilationCachePath + slash + get_file_name(baseName, i, ".options");
std::ofstream ofs(fileName.c_str(), std::ios::binary);
if (!ofs.good())
{
@@ -260,8 +261,8 @@ static int create_single_kernel_helper_create_program(cl_context context,
kernelName = add_build_options(kernelName, buildOptions);
std::string sourceFilename = gSpirVPath + slash + kernelName + ".cl";
std::string outputFilename = gSpirVPath + slash + kernelName;
std::string sourceFilename = gCompilationCachePath + slash + kernelName + ".cl";
std::string outputFilename = gCompilationCachePath + slash + kernelName;
std::string size_t_width_str;

View File

@@ -29,7 +29,7 @@ using namespace std;
CompilationMode gCompilationMode = kOnline;
CompilationCacheMode gCompilationCacheMode = kCacheModeCompileIfAbsent;
std::string gSpirVPath = ".";
std::string gCompilationCachePath = ".";
void helpInfo ()
{
@@ -67,7 +67,7 @@ int parseCustomParam (int argc, const char *argv[], const char *ignore)
}
else if (!strcmp(argv[i], "-ILPath"))
{
gSpirVPath = argv[i + 1];
gCompilationCachePath = argv[i + 1];
delArg = 2;
}
else if (!strcmp(argv[i], "-offlineCompiler"))
@@ -90,14 +90,14 @@ int parseCustomParam (int argc, const char *argv[], const char *ignore)
if (!strcmp(argv[i + 2], "cache"))
{
gCompilationCacheMode = kCacheModeForceRead;
gSpirVPath = argv[i + 3];
gCompilationCachePath = argv[i + 3];
log_info(" SpirV reading from cache enabled.\n");
delArg += 2;
}
else if (!strcmp(argv[i + 2], "generate"))
{
gCompilationCacheMode = kCacheModeOverwrite;
gSpirVPath = argv[i + 3];
gCompilationCachePath = argv[i + 3];
log_info(" SpirV force generate binaries enabled.\n");
delArg += 2;
}

View File

@@ -35,7 +35,7 @@ enum CompilationCacheMode
extern CompilationMode gCompilationMode;
extern CompilationCacheMode gCompilationCacheMode;
extern std::string gSpirVPath;
extern std::string gCompilationCachePath;
extern int parseCustomParam (int argc, const char *argv[], const char *ignore = 0 );

View File

@@ -58,7 +58,7 @@ std::vector<unsigned char> readBinary(const char *file_name)
std::vector<unsigned char> readSPIRV(const char *file_name)
{
std::string full_name_str = gSpirVPath + slash + file_name + spvExt + gAddrWidth;
std::string full_name_str = gCompilationCachePath + slash + file_name + spvExt + gAddrWidth;
return readBinary(full_name_str.c_str());
}
@@ -97,7 +97,7 @@ static int offline_get_program_with_il(clProgramWrapper &prog,
cl_int err = 0;
std::string outputTypeStr = "binary";
std::string defaultScript = std::string("..") + slash + std::string("spv_to_binary.py");
std::string outputFilename = gSpirVPath + slash + std::string(prog_name);
std::string outputFilename = gCompilationCachePath + slash + std::string(prog_name);
std::string sourceFilename = outputFilename + spvExt;
std::string scriptArgs =