-
Notifications
You must be signed in to change notification settings - Fork 87
Using rocTX with MIGraphX
MIGraphX provides perf knob via migraphx-driver, which provides wall clock time for each operation of a given model. For detailed performance debugging and optimization, it is preferred to have the exact GPU timing. One of the functionalities of rocTracer library is the code annotation API, named rocTX. By using rocTX, it is possible to wrap around GPU execution per instruction and get more accurate performance numbers.
Take a look below for the difference between the actual execution of "conv_bias_relu" on GPU and the information host provides. (Light orange ones)
MIGraphX can be run with rocTX markers, where each op is marked at the beginning and end of execution. This allows finer grain timing information.
The general steps are given below. The steps are provided to explain how it works. We also provide a script that provides this functionality with one command line. Please see the rocTX Helper Script section.
- Run
rocprof
binary with migraphx-driver withtrace
knob. Example CMD:rocprof --hip-trace --roctx-trace --flush-rate 10ms --timestamp on -d rocout /opt/rocm/bin/migraphx-driver trace $ONNX_PATH --onnx --gpu
- After running rocprof, it will provide an output at the folder given with
-d
knob. (/rocout/ at example above). We will need to read the output files (HCC, HIP, ROCTX outputs) and create a JSON file from this. To create a JSON file, we utilize therocmProfileData
repository:- Clone rocmProfileData:
git clone https://github.com/ROCmSoftwarePlatform/rocmProfileData.git
- cd into
cd /rocpd_python/
python setup.py install
- Clone rocmProfileData:
- Process the output:
python -m rocpd.rocprofiler_import --ops_input_file hcc_ops_trace.txt --api_input_file hip_api_trace.txt --roctx_input_file roctx_trace.txt trace.rpd
- python /tmp/roctx_temp/rocmProfileData/rpd2tracing.py trace.rpd trace.json
cd /AMDMIGraphX/tools
python roctx.py --parse --json_path ../trace.json
Simply provide --onnx_file
and if needed --migraphx_args
to roctx.py
file in AMDMIGraphX\tools
. Example command line is given below:
python roctx.py --run '--onnx --gpu ../../../AMDMIGraphX/fcn-resnet50-11.onnx' --out outfolder
After this, an output similar to the following will be printed on your terminal.