Using CodeXLAnalyzer Command Line Interface to compile OpenCL Kernels

CodeXL

PreviousNext
CodeXL User Guide
Help > Using CodeXL > Static Analyzer > CodeXLAnalyzer Command Line Interface > Using CodeXLAnalyzer Command Line Interface to compile OpenCL Kernels
Using CodeXLAnalyzer Command Line Interface to compile OpenCL Kernels

OpenCL is the default language for CodeXLAnalyzer, so in order to compile OpenCL kernels specifying the input source code language is optional.

CodeXLAnalyzer uses the actual AMD OpenCL Driver installed on the computer, i.e the Catalyst driver to perform offline compilation.

If no GPU is present, the OpenCL driver installed with APP SDK can be used.

Details of available commands:

-h

View available options

CodeXLAnalyzer.exe  -h

 

-s

Specify the source language for the compilation. “cl” is the default which means that for OpenCL kernel compilation there is no need to specify the –s switch

CodeXLAnalyzer.exe  -s cl -l

 

-l [ --list-asics ]

List known ASIC targets.

CodeXLAnalyzer.exe  -l

 

--verbose         

 View supported ASICS with detailed marketing names

CodeXLAnalyzer.exe  -l --verbose         

 

--version          

 Print version string.

CodeXLAnalyzer.exe  --version         

 

-a [ --analysis ] arg

Path to output analysis file.  Requires --kernel.

 

CodeXLAnalyzer.exe foo.cl --kernel myKernel --analysis foo.csv

 

-c [ --asic ] arg   

Which ASIC to target.  Repeatable.

CodeXLAnalyzer.exe foo.cl --kernel myKernel -isa foo.isa --asic Bonaire

 

--list-kernels      

List the kernels functions available in the specify cl file

CodeXLAnalyzer foo.cl --list-kernels

 

--isa arg          

Path to output ISA disassembly file(s). This command requires compilation switches identifying the required kernel --kernel

CodeXLAnalyzer.exe foo.cl --kernel Foo --isa c:\files\Foo

 

Detailed explanation:

--kernel FooKernel: compile and get ISA for “Foo” kernel

--isa c:\files\Foo: specify the designated output location and prefix. This will creates files such as c:\files\Foo-Bonaire.amdisa, c:\files\Foo-Hawaii.amdisa, etc.

 

--il arg            

Path to output IL file(s).  Requires --kernel.

CodeXLAnalyzer foo.cl --kernel myKernel --il foo.il --asic Tahity

 

--debugil arg      

Path to output Debug IL file(s).

CodeXLAnalyzer foo.cl --kernel myKernel --debugil foo.debugil

 

--metadata arg      

Path to output Metadata file(s). Requires --kernel.

CodeXLAnalyzer foo.cl --kernel myKernel -- metadata foo.metadata

 

-b [ --binary ] arg  

Path to binary output file(s).

CodeXLAnalyzer foo.cl --kernel myKernel –b foo.bin

 

--suppress arg       

Section to omit from binary output.  Repeatable.

 

CodeXLAnalyzer foo.cl --kernel myKernel –suppress .source –b foo.bin

 

-k [ --kernel ] arg  

Kernel to analyze or make IL or ISA.

CodeXLAnalyzer foo.cl --kernel myKernel –b foo.bin

 

--OpenCLoption arg  

OpenCL compiler options.  Repeatable.

CodeXLAnalyzer foo.cl --kernel myKernel --isa foo.isa --OpenCLoption -cl-enable-mad --OpenCLoption -w

 

-D [ --define ] arg

 Define symbol or symbol=value.  Repeatable.

CodeXLAnalyzer foo.cl --kernel myKernel --isa foo.isa –D myDefine

 

--csv-separator arg

 Override to default separator for analysis items.

CodeXLAnalyzer foo.cl --kernel myKernel --analysis foo.csv –csv-separator #

 

--livereg arg

Path to the live register analysis output file (note that “--isa arg" must be used in conjunction with the --livereg switch for live register analysis to be performed, since the live register analysis engine works by analyzing the ISA disassembly).

Note: this is a beta feature of CodeXLAnalyzer CLI. You can find more info about it in the “Generating and Interpreting CodeXLAnalyzer CLI’s Live Register Analysis Report”

CodeXLAnalyzer –s cl –c Bonaire --kernel myKernel --isa foo.isa --livereg fooLiveRegFile.txt --il fooIl.il myClFile.cl

 

Usage examples:

  Create binary files output/foo-ASIC.bin for foo.cl.

    CodeXLAnalyzer foo.cl --bin outdir/foo

 

  List the kernels available in foo.cl.

    CodeXLAnalyzer foo.cl --list-kernels

 

  Generate ISA and performance statistics for all ASICs for kernel myKernel which is defined in foo.cl

    CodeXLAnalyzer foo.cl --kernel myKernel --analysis foo.csv

 

  List the ASICs that the runtime supports.

    CodeXLAnalyzer --list-asics

 

Generate ISA and IL code for Cypress (ASIC) for kernel myKernel which is defined in source file foo.cl

    CodeXLAnalyzer foo.cl --kernel myKernel --il foo --isa foo --asic Cypress

 

Generate ISA code and live register analysis report for Iceland (ASIC), for kernel myKernel which is defined in source file foo.cl

    CodeXLAnalyzer foo.cl --kernel myKernel –livereg livereg.txt --isa foo --asic Iceland