CodeXLAnalyzer command line tool supports offline compilation and statistics generation for DirectX shaders. Naturally, it is supported on Windows only.
The Analyzer works in 2 stages:
1. By default, CodeXLAnalyzer compiles the shader using the D3D Compiler. CodeXL ships with a default compiler (d3dcompiler_47.dll). Unless the --DXLocation command line switch is specified, CodeXL will use the default compiler. The compilation can also go through Microsoft’s FXC tool instead of directly through the D3D compiler. To use FXC, you need to specify the –FXC command line switch with the location of FXC.exe.
2. CodeXLAnalyzer compiles the D3D ASM code generated by the D3D Compiler into AMD ISA, and generates statistics.
Regardless to the chosen compilation chain, all build errors and warnings will be printed in the command line window.
Details of available commands:
Details of available commands: |
||||
-h |
||||
CodeXLAnalyzer.exe -h |
||||
|
||||
-s |
Specify the source language for the compilation. For all DX options, you need to specify the source since OpenCL is the default language. Available options: DXAsm, HLSL, CL (default) |
|||
CodeXLAnalyzer.exe -s hlsl |
||||
|
||||
-s hlsl –l |
View supported ASICS for DirectX (also- this is default ASICs list for compilation) |
|||
CodeXLAnalyzer.exe -s hlsl –l |
||||
|
||||
-s hlsl -l --verbose |
||||
CodeXLAnalyzer.exe -s hlsl –l – verbose |
||||
|
||||
--isa arg |
Path to output ISA disassembly file(s). This command requires compilation switches such as –f, -p. |
|||
CodeXLAnalyzer.exe -s hlsl -f VsMain -p vs_5_0 -p vs_5_0 c:/files/myShader.fx --isa c:/files/myShader.isa
Detailed explanation: –s HLSL: run HSLS compilation (vs CL) –f VsMain: compile and get ISA for “VsMain” function –p vs_5_0: the target in D3DCompile: ps_5_0, vs_5_0, gs_5_0 c:/files/myShader.fx: the file to compile –isa c:/files/myShader.isa: specify the designated output file.
|
||||
|
||||
-c [ --asic ] arg |
By default, compilation will be done to all default available devices (run –s hlsl –l to view the list). This option enables you to choose which ASIC to target. This option is repeatable. |
|||
CodeXLAnalyzer.exe -s hlsl -f VsMain -p vs_5_0 c:/files/myShader.fx --isa c:/files/myShader.isa -c Hawaii -c Kaldini |
||||
|
||||
-a [ --analysis ] |
Path to output analysis file. Requires compilation. |
|||
CodeXLAnalyzer.exe -s hlsl -f VsMain c:/files/myShader.fx -p vs_5_0 -a c:/files/myShader.csv |
||||
|
||||
-D |
To compile using defines use –D, repeatable. |
|||
|
||||
-- DXFlags |
Compile using DXFlags |
|||
CodeXLAnalyzer.exe -s hlsl -f VsMain c:/files/myShader.fx --isa c:/files/myShader.isa -p vs_5_0 --DXFlagx 1 |
||||
|
||||
View the Catalyst driver version installed |
||||
CodeXLAnalyzer_d.exe -s hlsl –version |
||||
|
||||
--DXLocation |
Compile with a specific D3Dcompiler DLL. Note that the path need to be in quotes if it contains spaces. |
|||
CodeXLAnalyzer.exe -s hlsl -f VsMain -p vs_5_0 c:/files/myShader.fx --isa c:/files/myShader.isa -c Hawaii --DXLocation "C:\Program Files (x86)\Windows Kits\8.1\bin\x86\d3dcompiler_47.dll" |
||||
|
||||
-s DXAsm |
||||
CodeXLAnalyzer.exe -f VsMain -s DXAsm -p vs_5_0 c:/files/myShader.obj --isa c:\temp\dxTest.isa |
||||
|
||||
Compile using FXC. You need to provide the full FXC path and arguments, and need to use /Fo switch. Also, the output of the FXC file should be the input file for KA. Use with the DXAsm switch. |
||||
CodeXLAnalyzer.exe -s DXAsm -f VsMain -p vs_5_0 c:/files/myShader.fx --isa c:\files\myShader.isa -c tahiti --FXC "\"C:\Program Files (x86)\Windows Kits\8.1\bin\x86\fxc.exe\" /E VsMain /T vs_5_0 /Fo c:/files/myShader.obj c:/files/myShader.fx"
|
||||
|
||||
Compile from a blob represented as text (DX ASM as Text) . In this case, the application assumes D3DCompilation is done so it skips this and does the AMD DX Compilation only. |
||||
CodeXLAnalyzer.exe -s DXAsmT -f VsMain -p vs_5_0 c:/files/myShaderAsText.asm --isa c:\files\myShader.isa -c tahiti |
||||
|
||||
--DumpMSIntermediate arg |
When using this option, the MS Compilation output will be saved in the designated file |
|||
CodeXLAnalyzer.exe -s hlsl -f ps_main c:\temp\Pixel.psh --isa c:\temp\dxOutput.isa -c Tahiti -c Bonaire -p ps_5_0 --DumpMSIntermediate c:\temp\DumpMSIntermediate.txt
|
||||
|
||||
--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.exe -s hlsl -c Fiji -f VSMain -p vs_5_0 --isa c:\temp\.txt --livereg c:\temp\lreg.txt c:\temp\dx\BasicHLSL11_VS.hlsl
|
||||
Usage examples:
1. Suppose that you would like to compile and generate the ISA code of a DirectX pixel shader (C:\Users\shaders\Render.hlsl), using a the default D3D compiler that ships with CodeXL, and would like the output files which contain the ISA code to be located at c:\temp\ and be named myISA-<device-name>.isa:
CodeXLAnalyzer.exe -s hlsl -p ps_5_0 -f RenderPS --isa c:\temp\myISA.isa C:\Users\shaders\Render.hlsl
2. Suppose that you would like to compile and generate the ISA code of a DirectX pixel shader (C:\Users\shaders\Render.hlsl), using a specific D3D compiler (C:\Program Files (x86)\Windows Kits\8.1\bin\x86\d3dcompiler_47.dll), and would like the output files which contain the ISA code to be located at c:\temp\ and be named myISA-<device-name>.isa:
CodeXLAnalyzer.exe -s hlsl -p ps_5_0 -f RenderPS --DXLocation "C:\Program Files (x86)\Windows Kits\8.1\bin\x86\d3dcompiler_47.dll" --isa c:\temp\myISA.isa C:\Users\shaders\Render.hlsl
3. Suppose that you would like to compile and generate the ISA code of a DirectX pixel shader (C:\Users\shaders\Render.hlsl) only for “Iceland”, using a specific D3D compiler (C:\Program Files (x86)\Windows Kits\8.1\bin\x86\d3dcompiler_47.dll), and would like the output files which contain the ISA code to be located at c:\temp\ and be named myISA-<device-name>.isa:
CodeXLAnalyzer.exe -s hlsl -p ps_5_0 -f RenderPS –c Iceland --DXLocation "C:\Program Files (x86)\Windows Kits\8.1\bin\x86\d3dcompiler_47.dll" --isa c:\temp\myISA.isa C:\Users\shaders\Render.hlsl