ocloc help cleanup

Change-Id: I4378fa306e3a2b3ec219800a61dbae6c7115808a
This commit is contained in:
chmielew
2019-07-04 10:29:41 +02:00
committed by sys_ocldev
parent 009dbc45e2
commit 369982995d
4 changed files with 77 additions and 32 deletions

View File

@ -243,11 +243,27 @@ void BinaryDecoder::parseTokens() {
}
void BinaryDecoder::printHelp() {
printf(R"===(Disassembles Intel OCL GPU device binary.
printf(R"===(Disassembles Intel OpenCL GPU device binary files.
Output of such operation is a set of files that can be later used to
reassemble back a valid Intel OpenCL GPU device binary (using ocloc 'asm'
command). This set of files contains:
Program-scope data :
- spirv.bin (optional) - spirV representation of the program from which
the input binary was generated
- build.bin - build options that were used when generating the
input binary
- PTM.txt - 'patch tokens' describing program-scope and
kernel-scope metadata about the input binary
Kernel-scope data (<kname> is replaced by corresponding kernel's name):
- <kname>_DynamicStateHeap.bin - initial DynamicStateHeap (binary file)
- <kname>_SurfaceStateHeap.bin - initial SurfaceStateHeap (binary file)
- <kname>_KernelHeap.asm - list of instructions describing
the kernel function (text file)
Usage: ocloc disasm -file <file> [-patch <patchtokens_dir>] [-dump <dump_dir>] [-device <device_type>]
-file <file> Input file to be disassembled.
This file should be an Intel OCL GPU device binary.
This file should be an Intel OpenCL GPU device binary.
-patch <patchtokens_dir> Optional path to the directory containing
patchtoken definitions (patchlist.h, etc.)
@ -270,7 +286,7 @@ Usage: ocloc disasm -file <file> [-patch <patchtokens_dir>] [-dump <dump_dir>] [
--help Print this usage message.
Examples:
Disassemble Intel OCL GPU device binary
Disassemble Intel OpenCL GPU device binary
ocloc disasm -file source_file_Gen9core.bin
)===",
NEO::getDevicesTypes().c_str());

View File

@ -139,7 +139,10 @@ int BinaryEncoder::createElf() {
}
void BinaryEncoder::printHelp() {
printf(R"===(Assembles Intel OCL GPU device binary.
printf(R"===(Assembles Intel OpenCL GPU device binary from input files.
It's expected that input files were previously generated by 'ocloc disasm'
command or are compatible with 'ocloc disasm' output (especially in terms of
file naming scheme). See 'ocloc disasm --help' for additional info.
Usage: ocloc asm -out <out_file> [-dump <dump_dir>] [-device <device_type>]
-out <out_file> Filename for newly assembled binary.
@ -159,7 +162,7 @@ Usage: ocloc asm -out <out_file> [-dump <dump_dir>] [-device <device_type>]
--help Print this usage message.
Examples:
Assemble to Intel OCL GPU device binary (after above disasm)
Assemble to Intel OpenCL GPU device binary
ocloc asm -out reassembled.bin
)===",
NEO::getDevicesTypes().c_str());

View File

@ -19,30 +19,38 @@
using namespace NEO;
void printHelp() {
printf(R"===(ocloc is a tool for offline compilation to Intel OCL GPU device binary files.
It can be used for generation as well as manipulation (decoding/modifying)
of such binary files.
printf(R"===(ocloc is a tool for managing Intel OpenCL GPU device binary format.
It can be used for generation (as part of 'compile' command) as well as
manipulation (decoding/modifying - as part of 'disasm'/'asm' commands) of such
binary files.
Intel OpenCL GPU device binary is a format used by Intel OpenCL GPU runtime
(aka NEO). Intel OpenCL GPU runtime will return this binary format when queried
using clGetProgramInfo(..., CL_PROGRAM_BINARIES, ...). It will also honor
this format as input to clCreateProgramWithBinary function call.
ocloc does not require Intel GPU device to be present in the system nor does it
depend on Intel OpenCL GPU runtime driver to be installed. It does however rely
on the same set of compilers (IGC, common_clang) as the runtime driver.
Usage: ocloc [--help] <command> [<command_args>]
Available commands are listed below.
Use 'ocloc <command> --help' to get help about specific command.
Commands:
compile Compiles input to Intel OCL GPU device binary.
disasm Disassembles Intel OCL GPU device binary.
asm Assembles Intel OCL GPU device binary.
compile Compiles input to Intel OpenCL GPU device binary.
disasm Disassembles Intel OpenCL GPU device binary.
asm Assembles Intel OpenCL GPU device binary.
multi Compiles multiple files using a config file.
Default command (when none provided) is 'compile'.
Examples:
Compile file to Intel OCL GPU device binary (out = source_file_Gen9core.bin)
Compile file to Intel OpenCL GPU device binary (out = source_file_Gen9core.bin)
ocloc -file source_file.cl -device skl
Disassemble Intel OCL GPU device binary
Disassemble Intel OpenCL GPU device binary
ocloc disasm -file source_file_Gen9core.bin
Assemble to Intel OCL GPU device binary (after above disasm)
Assemble to Intel OpenCL GPU device binary (after above disasm)
ocloc asm -out reassembled.bin
)===");
}

View File

@ -657,34 +657,39 @@ std::string getDevicesTypes() {
// PrintUsage
////////////////////////////////////////////////////////////////////////////////
void OfflineCompiler::printUsage() {
printf(R"===(Compiles input file to Intel OCL GPU device binary.
printf(R"===(Compiles input file to Intel OpenCL GPU device binary (*.bin).
Additionally, outputs intermediate representation (e.g. spirV).
Different input and intermediate file formats are available.
Usage: ocloc [compile] -file <filename> -device <device_type> [-output <filename>] [-out_dir <output_dir>] [-options <options>] [-32|-64] [-internal_options <options>] [-llvm_text] [-llvm_input|-spirv_input] [-options_name] [-q] [-cpp_file] [--help]
Usage: ocloc [compile] -file <filename> -device <device_type> [-output <filename>] [-out_dir <output_dir>] [-options <options>] [-32|-64] [-internal_options <options>] [-llvm_text|-llvm_input|-spirv_input] [-options_name] [-q] [-cpp_file] [--help]
-file <filename> The input file to be compiled
(by default input source format is
OCL C kernel language).
OpenCL C kernel language).
-device <device_type> Target device.
<device_type> can be: %s
-output <filename> Optional output file base name.
Default is input file's base name.
This base name will be used for all output
files. Proper sufixes (describing file formats)
will be added automatically.
-out_dir <output_dir> Optional output directory.
Default is current working directory.
-options <options> Optional OCL C compilation options
as defined by OCL spec.
-options <options> Optional OpenCL C compilation options
as defined by OpenCL specification.
-32 Forces target architecture to 32-bit pointers.
Default is based on ocloc bittness.
Default pointer size is inherited from
ocloc's pointer size.
This option is exclusive with -64.
-64 Forces target architecture to 64-bit pointers.
Default is based on ocloc bittness.
Default pointer size is inherited from
ocloc's pointer size.
This option is exclusive with -32.
-internal_options <options> Optional compiler internal options
@ -694,30 +699,43 @@ Usage: ocloc [compile] -file <filename> -device <device_type> [-output <filename
-llvm_text Forces intermediate representation (IR) format
to human-readable LLVM IR (.ll).
This option affects only output files
and should not be used in combination with
'-llvm_input' option.
Default IR is spirV.
-llvm_input Indicates that input file is an llvm binary.
Default is OCL C kernel language.
This option is exclusive with -spirv_input.
This option is exclusive with -llvm_input.
-llvm_input Indicates that input file is an llvm binary.
Default is OpenCL C kernel language.
This option is exclusive with -spirv_input.
This option is exclusive with -llvm_text.
-spirv_input Indicates that input file is a spirV binary.
Default is OCL C kernel language format.
Default is OpenCL C kernel language format.
This option is exclusive with -llvm_input.
This option is exclusive with -llvm_text.
-options_name Will add suffix to generated files.
This suffix will be based on input options.
(Useful when rebuilding with different
set of options to not overwrite results).
-options_name Will add suffix to output files.
This suffix will be generated based on input
options (useful when rebuilding with different
set of options so that results won't get
overwritten).
This suffix is added always as the last part
of the filename (even after file's extension).
It does not affect '--output' parameter and can
be used along with it ('--output' parameter
defines the base name - i.e. prefix).
-q Will silence most of output messages.
-cpp_file Will generate c++ file with C-array
containing Intel OCL device binary.
containing Intel OpenCL device binary.
--help Print this usage message.
Examples :
Compile file to Intel OCL GPU device binary (out = source_file_Gen9core.bin)
Compile file to Intel OpenCL GPU device binary (out = source_file_Gen9core.bin)
ocloc -file source_file.cl -device skl
)===",
NEO::getDevicesTypes().c_str());