Command line tool for offline shader ISA inspection.

Overview

Intel Shader Analyzer

Intel Shader Analyzer is a tool for offline static analysis of shaders for Intel GPU Architectures. It allows a user to compile dxbc or HLSL code and inspect the generated GPU ISA for either DX11 and DX12.

Intel Shader Analyzer uses a dedicated driver API to compile and disassemble shaders, and may be run on any Windows 10 machine. It depends on the following graphics driver components:

  • For 32-bit:
    • igc32.dll
    • iga32.dll
    • IntelGPUCompiler32.dll
  • For 64-bit:
    • igc64.dll
    • iga64.dll
    • IntelGPUCompiler64.dll

In the initial release, these driver components are bundled with the release executable. Future driver releases will also allow Intel GPU users to run with in-situ drivers.

Besides being a functional tool, Intel Shader Analyzer is also intended to serve as a working refrence for the use of the driver compilation API, so that others may incorporate into their own tool chains as appropriate.

Related Links

The following third-party tools integrate IntelShaderAnalyzer and provide GUIs:

Below are some overviews and articles which introduce the ISA and architecture:

Detailed ISA documentation can be found in the PRMs:

Usage

Intel Shader Analyzer can consume HLSL input or DX bytecode, and pass them for compilation to either the DX11 or DX12 compilers. Currently, HLSL is only supported for shader model 5 shaders.

A simple HLSL command line is shown below:

IntelShaderAnalyzer.exe -s hlsl -f MyVS -p vs_5_0 shader.hlsl

By default, DX11 will be used. DX12 may be specified by using the --api command line switch. For example:

IntelShaderAnalyzer.exe -s hlsl --api dx12 -f MyVS -p vs_5_0 shader.hlsl

The dxbc source language may be used to feed dx bytecode directly to the tool. For example:

IntelShaderAnalyzer.exe -s dxbc --api dx11 shader.bin

The dxbc option also supports passing DXIL shaders to the DX12 backend. For example:

IntelShaderAnalyzer.exe -s dxbc --api dx12 --rootsig_file rootsig.bin shader.bin

Root Signatures

DX12 compilation requires a root signature, so that the compiler may determine how samplers, descriptors, and constants are to be provided to the shader. Different root signatures will result in slightly different generation. Intel Shader Analyzer can obtain a root signature in several differnet ways. If more than one of them is attempted, they are applied in the order described here.

HLSL Attributes

The first option is to use HLSL attributes to embed a root signature in the resulting shader blob, as shown in the example below. If a root signature is found embedded in the compiled shader, it will always be used first.

#define MyRS1 "DescriptorTable(SRV(t0))," \
              "StaticSampler(s0, addressU = TEXTURE_ADDRESS_CLAMP, " \
                                "filter = FILTER_MIN_MAG_MIP_LINEAR )"
                                 
Texture2D<float4> tx : register(t0);
sampler SS : register(s0);

[RootSignature(MyRS1)]
float4 main( float4 uv : uv ) : SV_Target
{
   return tx.Sample( SS, uv );
}


Two-Pass Compilation

For HLSL shaders, a second option is to use the --rootsig_macro command line switch to compile a root signature out of the same source. Here is the same shader, without the rootsignature attribute:

#define MyRS1 "DescriptorTable(SRV(t0))," \
              "StaticSampler(s0, addressU = TEXTURE_ADDRESS_CLAMP, " \
                                "filter = FILTER_MIN_MAG_MIP_LINEAR )"
                                 
Texture2D<float4> tx : register(t0);
sampler SS : register(s0);

float4 main( float4 uv : uv ) : SV_Target
{
   return tx.Sample( SS, uv );
}

If the following command line is used, Intel Shader Analyzer will attempt to compile the input file a second time to obtain the root signature:

IntelShaderAnalyzer.exe -s HLSL --rootsig_macro MyRS1 --api dx12 --profile ps_5_0 filename.hlsl

Precompiled Root Signatures

The final option is to supply a pre-compiled, serialized root signature in a separate file, using the following command line:

IntelShaderAnalyzer.exe -s HLSL --rootsig_file rootsig.bin --api dx12 --profile ps_5_0 filename.hlsl

This option may also be used with dxbc input:

IntelShaderAnalyzer.exe -s dxbc --rootsig_file rootsig.bin --api dx12 filename.dxbc

Command Line

General-Purpose Options

-l
--list-asics

Print a list of supported device families.

-c <device_name>
--asic <device_name>

Add the specified device to the list of compile targets. The device name must be one of the ones returned by --list-asics. By default, all supported asics are compiled.

--api dx11
--api dx12

Set the target API. Default is 'dx11'. Code generation may differ between the dx11 and dx12 drivers. Supported APIs are 'dx11' and 'dx12' Compilation for DX12 requires a root signature.

--isa <path_prefix>

Set the directory name for output ISA files. For each target device the compiler will emit a file named <path_prefix><device_name>.asm

For example:
--isa ./output --asic Skylake

will produce a file named: ./outputSkylake.asm

The default is "./isa_".

-s [hlsl | dxbc]

Set the source language. Valid values are hlsl or dxbc. The dxbcsource language may be used for both legacy DX11 bytecode and DXIL. Default is dxbc

--rootsig_file <path>

Load a serialized DX root signature from the specified path.

HLSL Options

--rootsig_profile <profile>

Set the compilation profile for root signature compilation. Default is: rootsig_1_0.

--rootsig_macro <name>

Sets the macro name for root signature compilation. If this option is specified, and no root signature is provided. The tool will attempt to re-compile the input HLSL source to extract the root signature.

--DXLocation

Set the location of the D3D compiler DLL. The default is d3dcompiler_47.dll

--DXFlags <number>

Set the flags for the HLSL compiler. Argument is a bitwise combination of D3DCOMPILE_ flags. See the MSDN documentation

-D <SYMBOL>=<VALUE>
-D <SYMBOL>

Add a preprocessor define

--profile
-p

Set the shader profile for HLSL compilation. Required.

--function
-f

Set the entrypoint for HLSL compilation. Optional. Default is main.

Running Tests

The tests use a very simple-minded python script.

To run the tests, cd to the 'tests' directory, copy the executable into it (and the driver DLLs, as required). Then run python run_tests.py The script will automatically check exit codes, but it is necessary to manually inspect the output to ensure that the tool is behaving as expected.

The tests need to be run from a bash shell, or a windows shell with GNU 'rm' utilities in the path.

You might also like...
ContactGot is an offline desktop app, where clients can leave their info, while an administrator can manage which information they need to gather on certain projects.
ContactGot is an offline desktop app, where clients can leave their info, while an administrator can manage which information they need to gather on certain projects.

ContactGot Contents Description How to use Requirements Engineering Installation Documentation Design Architecture Demonstration 1. Description During

A GPS bicycle speedometer that supports offline maps and track recording
A GPS bicycle speedometer that supports offline maps and track recording

X-TRACK 开源GPS自行车码表。 拥有可显示实时位置的离线地图。 支持记录和显示实时轨迹以及导出标准GPX格式的轨迹文件。 全新设计的"页面生命周期管理"和"消息订阅发布框架"。 演示视频:https://www.bilibili.com/video/BV1GB4y1K7VV GUI LVGL

Offline fluid simulation solver adopted from https://github.com/doyubkim/fluid-engine-dev.
Offline fluid simulation solver adopted from https://github.com/doyubkim/fluid-engine-dev.

FluidEngine This is a fluid simulation engine for computer graphics applications. I adopt it from Doyub Kim's fluid-engine-dev. It's built on C++11 an

Official page of MLCPP (IROS'18 @ Barcelona, Spain): Offline Coverage Path Planner
Official page of MLCPP (IROS'18 @ Barcelona, Spain): Offline Coverage Path Planner

MLCPP: Multi-layer coverage path planner for autonomous structural inspection of high-rise structures The purpose of the algorithm is to inspect high-

A small DLL that fixes tool's usage of the Halo 3 shader compiler.

h3-shader-compiler-fix A small DLL that fixes tool's usage of the Halo 3 shader compiler. Tool forgot to initialise the compiler before using it, so t

SPIRV-Cross is a tool designed for parsing and converting SPIR-V to other shader languages.

SPIRV-Cross SPIRV-Cross is a tool designed for parsing and converting SPIR-V to other shader languages. Features Convert SPIR-V to readable, usable an

⚔️ A tool for cross compiling shaders. Convert between GLSL, HLSL, Metal Shader Language, or older versions of GLSL.
⚔️ A tool for cross compiling shaders. Convert between GLSL, HLSL, Metal Shader Language, or older versions of GLSL.

A cross compiler for shader languages. Convert between SPIR-V, GLSL / GLSL ES, HLSL, Metal Shader Language, or older versions of a given language. Cross Shader wraps glslang and SPIRV-Cross, exposing a simpler interface to transpile shaders.

Lightweight C++ command line option parser

Release versions Note that master is generally a work in progress, and you probably want to use a tagged release version. Version 3 breaking changes I

The command line interface for Piccolo
The command line interface for Piccolo

Piccolo programming language A fun, easy to embed high-level programming language. This repo contains the code for the Piccolo CLI. The core Piccolo c

Comments
  • Latest iGPU drvs add IntelGPUCompiler OCL SPIR-V support.. Updated IntelGPUCompiler headers &ShaderAnalyzer OCL support??

    Latest iGPU drvs add IntelGPUCompiler OCL SPIR-V support.. Updated IntelGPUCompiler headers &ShaderAnalyzer OCL support??

    Hi, just seen latest public graphics driver 26.20.100.7000: https://downloadcenter.intel.com/download/28991/Intel-Graphics-Windows-10-DCH-Drivers?product=88345 mentions: "Added OpenCL SPIR-V support to the public IntelGPUCompiler API on top of existing DX11 and DX12 support. IntelGPUCompiler API allows developers to compile their shaders into Intel GPU assembly instructions." any way to obtain updated IntelGPUCompiler headers for OpenCL support? better yet IntelShaderAnalyzer OpenCL support? thanks..

    opened by oscarbg 7
Owner
null
Pyramid is a free, open GUI tool for offline shader validation and analysis

Pyramid is a free, open GUI tool for offline shader validation and analysis. The UI takes HLSL or GLSL as input, and runs them through various shader compilers and static analyzers.

null 277 Dec 20, 2022
RISC-V has a 128-bit ISA that is fairly developed, but not standardized fully yet.

128-bit RISC-V assembler RISC-V has a 128-bit ISA that is fairly developed, but not standardized fully yet. I am maintaining a RISC-V userspace emulat

Alf-André Walla 39 Nov 20, 2022
Shader Playground is a website for exploring shader compilers.

Shader Playground is a website for exploring shader compilers. Visit website Supported backends Compilers ANGLE Clspv DXC FXC Glslan

Tim Jones 445 Dec 30, 2022
Shader cross compiler to translate HLSL (Shader Model 4 and 5) to GLSL

XShaderCompiler ("Cross Shader Compiler") Features Cross compiles HLSL shader code (Shader Model 4 and 5) into GLSL Simple to integrate into other pro

Lukas Hermanns 345 Dec 9, 2022
Icopack - A simple command line tool to create multi-frame ICO files from PNG source images

Optidash is a modern, AI-powered image optimization and processing API. We will drastically speed-up your websites and save you money on bandwidth and

Optidash AI 61 Jul 27, 2022
Wave Function Collapse library in C, plus a command-line tool

wfc Single-file Wave Function Collapse library in C, plus a command-line tool License: MIT Version: 0.01 This is an early version that supports the ov

krychu 314 Dec 29, 2022
A small, fast codeforces command line tool for competitive programming.

chainsaw: A Codeforces Commandline Tool chainsaw is a small and faster drop-in replacement for your copy and paste while attending Codeforces contests

Jiawei Wang 41 Dec 8, 2022
OS X command line tool to inject Frameworks and dylibs on mach-o binaries (iOS & Mac Apps).

macho-inject OS X command line tool to inject Frameworks and dylibs on mach-o binaries. It does the injection of the framework and the codesigning. It

Jon Gabilondo 6 Nov 8, 2022
fx is a workspace tool manager. It allows you to create consistent, discoverable, language-neutral and developer friendly command line tools.

fx is a workspace tool manager. It allows you to create consistent, discoverable, language-neutral and developer friendly command line tools.

null 19 Aug 27, 2022
🗺️ OMAPS.APP — Offline OpenStreetMap maps for iOS and Android. A community-driven fork of MAPS.ME.

OMaps is an open source cross-platform offline maps application, built on top of crowd-sourced OpenStreetMap data. It was publicly released for iOS and Android.

OMaps 4.4k Jan 7, 2023