From 4d16e802e0b9451c9d3c27cd308928c13b73acd6 Mon Sep 17 00:00:00 2001 From: Adam Sawicki Date: Fri, 24 Feb 2023 10:21:21 +0100 Subject: [PATCH] GpuMemDumpVis.py: Fixed division by zero error when only custom pools are used --- tools/GpuMemDumpVis/GpuMemDumpVis.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/GpuMemDumpVis/GpuMemDumpVis.py b/tools/GpuMemDumpVis/GpuMemDumpVis.py index 42800ea..e0575c1 100644 --- a/tools/GpuMemDumpVis/GpuMemDumpVis.py +++ b/tools/GpuMemDumpVis/GpuMemDumpVis.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2018-2022 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2018-2023 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -25,7 +25,7 @@ import json from PIL import Image, ImageDraw, ImageFont -PROGRAM_VERSION = 'Vulkan/D3D12 Memory Allocator Dump Visualization 3.0.0' +PROGRAM_VERSION = 'Vulkan/D3D12 Memory Allocator Dump Visualization 3.0.2' IMG_WIDTH = 1200 IMG_MARGIN = 8 TEXT_MARGIN = 4 @@ -81,16 +81,17 @@ def IsDataEmpty(): def RemoveEmptyType(): global data for poolType in list(data.keys()): - if len(data[poolType]['DedicatedAllocations']) > 0: + pool = data[poolType] + if len(pool['DedicatedAllocations']) > 0: continue - if len(data[poolType]['Blocks']) > 0: + if len(pool['Blocks']) > 0: continue empty = True - for customPool in data[poolType]['CustomPools'].values(): - if len(data[poolType]['Blocks']) > 0: + for customPool in pool['CustomPools'].values(): + if len(customPool['Blocks']) > 0: empty = False break - if len(data[poolType]['DedicatedAllocations']) > 0: + if len(customPool['DedicatedAllocations']) > 0: empty = False break if empty: