mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Reimplement invocation of offline compilation program
This change reimplements offline compiler invocation, using a new command
line interface that allows the passing of relevant CL device information
to the offline compiler. The information that is passed is as follows:
* CL_DEVICE_ADDRESS_BITS
* CL_DEVICE_EXTENSIONS
* CL_DEVICE_IL_VERSION (with --compilation-mode=spir-v only)
* CL_DEVICE_VERSION
The interface for the offline compiler script is as follows:
usage: cl_offline_compiler --source FILE --output FILE
--cl-device-info FILE --mode MODE
-- [BUILD_OPTIONS [BUILD_OPTIONS ...]]
positional arguments:
BUILD_OPTIONS additional options to pass to the compiler
optional arguments:
--source FILE OpenCL C source file to compile
--output FILE SPIR-V or binary file to create
--cl-device-info FILE OpenCL device info file
--mode compilation mode (spir-v or binary)
The OpenCL C version for compilation is now specified in BUILD_OPTIONS,
as normal for online compilation, i.e. with -cl-std=VERSION.
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
This commit is contained in:
committed by
Kévin Petit
parent
2c43504923
commit
0d96c198ee
@@ -27,9 +27,12 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define DEFAULT_COMPILATION_PROGRAM "cl_offline_compiler"
|
||||
|
||||
CompilationMode gCompilationMode = kOnline;
|
||||
CompilationCacheMode gCompilationCacheMode = kCacheModeCompileIfAbsent;
|
||||
std::string gCompilationCachePath = ".";
|
||||
std::string gCompilationProgram = DEFAULT_COMPILATION_PROGRAM;
|
||||
|
||||
void helpInfo ()
|
||||
{
|
||||
@@ -47,6 +50,8 @@ void helpInfo ()
|
||||
" force-read Force reading from the cache\n"
|
||||
" overwrite Disable reading from the cache\n"
|
||||
" --compilation-cache-path <path> Path for offline compiler output and CL source\n"
|
||||
" --compilation-program <prog> Program to use for offline compilation,\n"
|
||||
" defaults to " DEFAULT_COMPILATION_PROGRAM "\n"
|
||||
"\n");
|
||||
}
|
||||
|
||||
@@ -158,6 +163,20 @@ int parseCustomParam (int argc, const char *argv[], const char *ignore)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(argv[i], "--compilation-program"))
|
||||
{
|
||||
delArg++;
|
||||
if ((i + 1) < argc)
|
||||
{
|
||||
delArg++;
|
||||
gCompilationProgram = argv[i + 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
log_error("Program argument for --compilation-program was not specified.\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
//cleaning parameters from argv tab
|
||||
for (int j = i; j < argc - delArg; j++)
|
||||
|
||||
Reference in New Issue
Block a user