2.0 KiB
Scripts
trace_memory.py
This script is intended to be used from within rocGDB. e.g.:
rocgdb -ex "source trace_memory.py" -ex "gpu_memory_trace -h /work/tensile/Tensile/working/0_Build/client/tensile_client
Using this Script:
-
The first step is to get the executable and inputs you're going to execute. For Tensile this will look something like:
./working/0_Build/client/tensile_client --config-file ./working/1_BenchmarkProblems/Cijk_Ailk_Bjlk_HHS_BH_00/00_Final/source/ClientParameters.iniThe kernel only needs to be launched once, so consider modifying the
num-*parameters in theClientParameters.inifile. You can move theClientParameters.inito a more convenient place if you'd like. -
The second step is to get the label for the kernel your working on, this is the first label in the kernel. For Tensile kernels this will look something like:
Cijk_Ailk_Bjlk_HHS_BH_MT128x256x16_MI32x32x8x1_SE_K1 -
Next is to get the addresses matrices you are interested in tracing. To do this you can use the
get_to_kerneloption to this script to stop once the kernel is reached to enable inspection.Setting the environment variable
TENSILE_DB=0x40will output the Tensile kernel arguments, including the addresses of all of the input matrices. For the A matrix it will have something like:[40..47] a: 00 00 a0 b0 f7 7f 00 00 (0x7ff7b0a00000) -
Now we you are ready to collect the trace:
rocgdb -ex "source /data/scripts/trace_memory.py" -ex "gpu_memory_trace full_memory_trace --kernel_label Cijk_Ailk_Bjlk_HHS_BH_MT128x256x16_MI32x32x8x1_SE_K1 --instruction=load --workgroup=38,1,0 --base_address=0x7ff7b0a00000 --csv_file=/data/build/memory.csv --run_command=\"--config-file ClientParameters.ini\"" /work/tensile/Tensile/working/0_Build/client/tensile_client -
Finally, you can visualize the trace using the
trace_to_png.pyscript:./trace_to_png.py -c -m 7680 -n 8448 -s 2 -w 8 -t wf memory.csv