mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-26 00:39:03 +00:00
Rename gOfflineCompilerInput/Output locals
These are local variables, and wrongly start with a "g" indicating that they are globals.
This commit is contained in:
committed by
Kévin Petit
parent
ab36d94dd0
commit
5438c664a1
@@ -221,8 +221,8 @@ int create_single_kernel_helper_create_program(cl_context context, cl_program *o
|
|||||||
|
|
||||||
kernelName = add_build_options(kernelName, buildOptions);
|
kernelName = add_build_options(kernelName, buildOptions);
|
||||||
|
|
||||||
std::string gOfflineCompilerInput = gSpirVPath + slash + kernelName + ".cl";
|
std::string sourceFilename = gSpirVPath + slash + kernelName + ".cl";
|
||||||
std::string gOfflineCompilerOutput = gSpirVPath + slash + kernelName;
|
std::string outputFilename = gSpirVPath + slash + kernelName;
|
||||||
|
|
||||||
std::string size_t_width_str;
|
std::string size_t_width_str;
|
||||||
|
|
||||||
@@ -261,35 +261,35 @@ int create_single_kernel_helper_create_program(cl_context context, cl_program *o
|
|||||||
|
|
||||||
if (size_t_width == 32)
|
if (size_t_width == 32)
|
||||||
{
|
{
|
||||||
gOfflineCompilerOutput += ".spv32";
|
outputFilename += ".spv32";
|
||||||
size_t_width_str = "32";
|
size_t_width_str = "32";
|
||||||
}
|
}
|
||||||
else if (size_t_width == 64)
|
else if (size_t_width == 64)
|
||||||
{
|
{
|
||||||
gOfflineCompilerOutput += ".spv64";
|
outputFilename += ".spv64";
|
||||||
size_t_width_str = "64";
|
size_t_width_str = "64";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to read cached output file when test is run with gForceSpirVGenerate = false
|
// try to read cached output file when test is run with gForceSpirVGenerate = false
|
||||||
std::ifstream ifs(gOfflineCompilerOutput.c_str(), std::ios::binary);
|
std::ifstream ifs(outputFilename.c_str(), std::ios::binary);
|
||||||
if (!ifs.good() || gForceSpirVGenerate)
|
if (!ifs.good() || gForceSpirVGenerate)
|
||||||
{
|
{
|
||||||
if (gForceSpirVCache)
|
if (gForceSpirVCache)
|
||||||
{
|
{
|
||||||
log_info("OfflineCompiler: can't open cached SpirV file: %s\n", gOfflineCompilerOutput.c_str());
|
log_info("OfflineCompiler: can't open cached SpirV file: %s\n", outputFilename.c_str());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ifs.close();
|
ifs.close();
|
||||||
|
|
||||||
if (!gForceSpirVGenerate)
|
if (!gForceSpirVGenerate)
|
||||||
log_info("OfflineCompiler: can't find cached SpirV file: %s\n", gOfflineCompilerOutput.c_str());
|
log_info("OfflineCompiler: can't find cached SpirV file: %s\n", outputFilename.c_str());
|
||||||
|
|
||||||
std::ofstream ofs(gOfflineCompilerInput.c_str(), std::ios::binary);
|
std::ofstream ofs(sourceFilename.c_str(), std::ios::binary);
|
||||||
if (!ofs.good())
|
if (!ofs.good())
|
||||||
{
|
{
|
||||||
log_info("OfflineCompiler: can't create source file: %s\n", gOfflineCompilerInput.c_str());
|
log_info("OfflineCompiler: can't create source file: %s\n", sourceFilename.c_str());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,7 +320,7 @@ int create_single_kernel_helper_create_program(cl_context context, cl_program *o
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set script arguments
|
// set script arguments
|
||||||
std::string scriptArgs = gOfflineCompilerInput + " " + gOfflineCompilerOutput + " " + size_t_width_str + " " + outputTypeStr;
|
std::string scriptArgs = sourceFilename + " " + outputFilename + " " + size_t_width_str + " " + outputTypeStr;
|
||||||
|
|
||||||
if (!bOptions.empty())
|
if (!bOptions.empty())
|
||||||
{
|
{
|
||||||
@@ -372,10 +372,10 @@ int create_single_kernel_helper_create_program(cl_context context, cl_program *o
|
|||||||
return CL_COMPILE_PROGRAM_FAILURE;
|
return CL_COMPILE_PROGRAM_FAILURE;
|
||||||
}
|
}
|
||||||
// read output file
|
// read output file
|
||||||
ifs.open(gOfflineCompilerOutput.c_str(), std::ios::binary);
|
ifs.open(outputFilename.c_str(), std::ios::binary);
|
||||||
if (!ifs.good())
|
if (!ifs.good())
|
||||||
{
|
{
|
||||||
log_info("OfflineCompiler: can't read output file: %s\n", gOfflineCompilerOutput.c_str());
|
log_info("OfflineCompiler: can't read output file: %s\n", outputFilename.c_str());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,12 +97,12 @@ static int offline_get_program_with_il(clProgramWrapper &prog,
|
|||||||
cl_int err = 0;
|
cl_int err = 0;
|
||||||
std::string outputTypeStr = "binary";
|
std::string outputTypeStr = "binary";
|
||||||
std::string defaultScript = std::string("..") + slash + std::string("spv_to_binary.py");
|
std::string defaultScript = std::string("..") + slash + std::string("spv_to_binary.py");
|
||||||
std::string gOfflineCompilerOutput = gSpirVPath + slash + std::string(prog_name);
|
std::string outputFilename = gSpirVPath + slash + std::string(prog_name);
|
||||||
std::string gOfflineCompilerInput = gOfflineCompilerOutput + spvExt;
|
std::string sourceFilename = outputFilename + spvExt;
|
||||||
|
|
||||||
std::string scriptArgs =
|
std::string scriptArgs =
|
||||||
gOfflineCompilerInput + " " +
|
sourceFilename + " " +
|
||||||
gOfflineCompilerOutput + " " +
|
outputFilename + " " +
|
||||||
gAddrWidth + " " +
|
gAddrWidth + " " +
|
||||||
outputTypeStr + " " +
|
outputTypeStr + " " +
|
||||||
"-cl-std=CL2.0";
|
"-cl-std=CL2.0";
|
||||||
@@ -119,10 +119,10 @@ static int offline_get_program_with_il(clProgramWrapper &prog,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// read output file
|
// read output file
|
||||||
std::vector<unsigned char> buffer_vec = readBinary(gOfflineCompilerOutput.c_str());
|
std::vector<unsigned char> buffer_vec = readBinary(outputFilename.c_str());
|
||||||
size_t file_bytes = buffer_vec.size();
|
size_t file_bytes = buffer_vec.size();
|
||||||
if (file_bytes == 0) {
|
if (file_bytes == 0) {
|
||||||
log_error("OfflinerCompiler: Failed to open binary file: %s", gOfflineCompilerOutput.c_str());
|
log_error("OfflinerCompiler: Failed to open binary file: %s", outputFilename.c_str());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user