mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-20 14:39:01 +00:00
Run spirv-val for SPIR-V offline compilation (#1108)
The common --disable-spirv-validation option has been added to disable this functionality. Signed-off-by: Stuart Brady <stuart.brady@arm.com>
This commit is contained in:
@@ -530,7 +530,7 @@ static int get_offline_compiler_output(
|
||||
sourceFilename, outputFilename);
|
||||
if (error != CL_SUCCESS) return error;
|
||||
|
||||
// read output file
|
||||
// open output file for reading
|
||||
ifs.open(outputFilename.c_str(), std::ios::binary);
|
||||
if (!ifs.good())
|
||||
{
|
||||
@@ -540,6 +540,26 @@ static int get_offline_compiler_output(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (compilationMode == kSpir_v && !gDisableSPIRVValidation)
|
||||
{
|
||||
std::string runString = gSPIRVValidator + " " + outputFilename;
|
||||
|
||||
int returnCode = system(runString.c_str());
|
||||
if (returnCode == -1)
|
||||
{
|
||||
log_error("Error: failed to invoke SPIR-V validator\n");
|
||||
return CL_COMPILE_PROGRAM_FAILURE;
|
||||
}
|
||||
else if (returnCode != 0)
|
||||
{
|
||||
log_error(
|
||||
"Failed to validate SPIR-V file %s: system() returned 0x%x\n",
|
||||
outputFilename.c_str(), returnCode);
|
||||
return CL_COMPILE_PROGRAM_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user