Rename gSpirVPath to gCompilationCachePath

gSpirVPath controls the location of the compilation cache for SPIR-V
offline compilation, but its use would also make sense for binary
offline compilation.  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 0b1520f508
commit 6eec559ffd
3 changed files with 8 additions and 8 deletions

View File

@@ -173,7 +173,7 @@ std::string add_build_options(const std::string &baseName, const char *options)
do do
{ {
i++; 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); long fileSize = get_file_size(fileName);
if (fileSize == 0) if (fileSize == 0)
break; break;
@@ -187,7 +187,7 @@ std::string add_build_options(const std::string &baseName, const char *options)
if (equal) if (equal)
return get_file_name(baseName, i, ""); 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); std::ofstream ofs(fileName.c_str(), std::ios::binary);
if (!ofs.good()) if (!ofs.good())
{ {
@@ -266,8 +266,8 @@ static int create_single_kernel_helper_create_program(cl_context context,
kernelName = add_build_options(kernelName, buildOptions); kernelName = add_build_options(kernelName, buildOptions);
std::string sourceFilename = gSpirVPath + slash + kernelName + ".cl"; std::string sourceFilename = gCompilationCachePath + slash + kernelName + ".cl";
std::string outputFilename = gSpirVPath + slash + kernelName; std::string outputFilename = gCompilationCachePath + slash + kernelName;
// Get device CL_DEVICE_ADDRESS_BITS // Get device CL_DEVICE_ADDRESS_BITS
cl_uint device_address_space_size = 0; cl_uint device_address_space_size = 0;

View File

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

View File

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