Tools
Explore new features and tools within Intel® products, communities, and platforms
94 Discussions

Optimize Rendering Applications with Experiments

Pamela_H_Intel
Moderator
0 0 1,235

Authors

Xiaohan Wang, GPU Software Development Engineer, Intel Corporation

Pamela Harrison, Software Technical Consulting Engineer

Introduction

Intel® GPA Framework provides a set of command-line tools for capture, playback and analysis of graphics applications. Additionally, Intel® GPA Framework provides functionality to play a frame or a stream with some properties modified. We call this Experiments. Similarly to the previous blog Custom Layers: Part II Extending Intel® GPA Framework with Custom Layers - Intel Community, for this feature you need to build the source code to create the executable before you can do the experiment.

In this article, we will explore the topics below:

  • Experiment System Overview
  • Introduction of built-in samples
    • How to build, install, and run an experiment sample
  • How to design a case with a custom combination of different experiments

Experiment System Overview

Once a stream is loaded into memory, before loading to the playback system, the experiment system loads the experiment parameters and applies additional properties to the playback system that will affect the render result.

Pamela_H_Intel_0-1701223721396.png

 

Example of a highlight experiment

The experiment below first plays to frame number 20 and then finds the 15th draw call. Then the corresponding area is highlighted by executing a pink pixel shader fill.

Pamela_H_Intel_0-1702952683598.png

In this example, instead of drawing textures, the renderer is using a color filling shader and as a result, we can clearly see, by the pink coloring, which areas are drawn by the selected draw call.

In the next section, we will introduce our included samples and how to build and run them.

Introduction of built-in experiment samples

Experiment samples are provided as source code included with the installation of Intel® GPA Framework. Here is a guide on how to build and execute different experiments.

How to build, install, and run an experiment sample

Step 1 Download and install Intel® GPA Framework. Then if you don’t have one, capture a stream so that you can experiment.

Step 2 Choose a location to build the sample source code.

mkdir <SAMPLE_BUILD_PATH>

Step 3 Build the sample source code from the source code tree.

cmake -DCMAKE_INSTALL_PREFIX=<SAMPLE_BUILD_PATH>\install -B <SAMPLE_BUILD_PATH>\build "C:\Program Files\IntelSWTools\GPA Framework\23.3\samples"
cmake --build <SAMPLE_BUILD_PATH>\build --config Release --target install

Step 4 Add libraries to your PATH and ready to run your executable in Command Prompt

"%INTEL_GPA_FRAMEWORK%\bin\gpa-env-vars.bat"
"Setting paths to GPA Framework binaries at location: C:\Program Files\IntelSWTools\GPA Framework\23.3\\bin"
cd <SAMPLE_BUILD_PATH>/install/bin/Release
highlight-experiment -f 20 -c 15 <STREAM_PATH>

For more details about system requirements and sample introduction, refer to our official guide here Samples — Intel® GPA Framework documentation.

Examples of other built-in experiments

Render the 10th frame of a stream, but replace the 15th draw call with a customized hlsl shader file.

shader-experiment.exe <STREAM_PATH> <SHADER_FILE_PATH> -l hlsl -s vertex -f 10 -c 15

Customize your pipeline structure (ex. Pipeline-State-Object in Microsoft* DirectX 12) in source code, and reflect in 10th frame:

pipeline-experiment <STREAM_PATH> -f 10

Render the 10th frame of a stream, and apply a Scissor Rectangle, with top left vertex (30, 50) and size 400x300, to the 15th draw call:

prefab-experimentor.exe <STREAM_PATH>  -f 10 -c 15 – experiment SCISSOR_RECT  -x 30 -y 50 --width 400 –-height 300

Demo: Experiment on UE5 Architecture Sample

 

Step 1 Capture a stream of UE5 Architecture Sample, which can be found and built from Epic Unreal Engine 5 sample.

gpa-injector --layer capture ./Architecture.exe

When the capture window opens, capture begins. To end capture, either

  • Use Ctrl + C to terminate the executable, or
  • Close the capture window.

Now you have a captured stream. (By default the stream will be saved in .../Documents/GPA/<streams>

 

Step 2 Use print-api-log to get details about Callable Indexes in the 200th frame

print-api-log <YOUR_STREAM_PATH> -f 200

This tool prints the current Callable Index by default.

 

Step 3 In Callable Index logs, search for “DrawInstanced” functions, and select one we want to experiment on and remember the index. Here, we are choosing the last one.

Index: [5772] DrawIndexedInstanced

Remember the Index 5772. We will apply experiments to this draw call. 

 

Step 4 Use frame index 200 and callable index 5772 to apply experiments to this draw call.  

highlighting-experiment.exe <YOUR_STREAM_PATH>

This command will open a stream playback window and play from the beginning to the 200th frame. Then the highlight experiment will be applied: highlighting the corresponding part of the rendered image.

In this example, you can see that in frame 200, call 5772 draws the icon at the bottom.

Pamela_H_Intel_1-1702954639434.png

Summary

In this article we discussed the experiment system of Intel® GPA Framework and how to build and run our sample experiments.  Feel free to leave a comment if you have suggestions for other experiments, or an example of a useful experiment that helps you in your profiling work.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

About the Author
Software engineer for 20+ years. Excels in all things software, plus connecting people and teams for optimal synergy.