From cbeaeeb24920974c5ae7ee0cbdde617ebd543435 Mon Sep 17 00:00:00 2001 From: Vladislav Sytchenko Date: Fri, 20 Mar 2020 16:29:46 -0400 Subject: [PATCH] Correctly format hipResourceDesc objects The struct consists of a union - only the active object should be read. Change-Id: I1c40965b61518acd91a2dcbae92a015ac9be346a [ROCm/hip commit: fbe30090a2407d28becbbbc64a22646dca6d1d62] --- projects/hip/vdi/hip_formatting.hpp | 53 ++++++++++++++++++----------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/projects/hip/vdi/hip_formatting.hpp b/projects/hip/vdi/hip_formatting.hpp index d75c2071fc..ec92b137c1 100644 --- a/projects/hip/vdi/hip_formatting.hpp +++ b/projects/hip/vdi/hip_formatting.hpp @@ -614,26 +614,39 @@ inline std::ostream& operator<<(std::ostream& os, const hipResourceDesc& s) { os << '{' << s.resType << ',' - << s.res.array.array - << ',' - << s.res.mipmap.mipmap - << ',' - << s.res.linear.devPtr - << ',' - << s.res.linear.desc - << ',' - << s.res.linear.sizeInBytes - << ',' - << s.res.pitch2D.devPtr - << ',' - << s.res.pitch2D.desc - << ',' - << s.res.pitch2D.width - << ',' - << s.res.pitch2D.height - << ',' - << s.res.pitch2D.pitchInBytes - << '}'; + << '{'; + + switch (s.resType) { + case hipResourceTypeLinear: + os << s.res.linear.devPtr + << ',' + << s.res.linear.desc + << ',' + << s.res.linear.sizeInBytes; + break; + case hipResourceTypePitch2D: + os << s.res.pitch2D.devPtr + << ',' + << s.res.pitch2D.desc + << ',' + << s.res.pitch2D.width + << ',' + << s.res.pitch2D.height + << ',' + << s.res.pitch2D.pitchInBytes; + break; + case hipResourceTypeArray: + os << s.res.array.array; + break; + case hipResourceTypeMipmappedArray: + os <