From fe369a0e18ae7881cedf671d735c9ab7df6be185 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/clr commit: 1cacb5c9b727cfe971d07c0834c6cff05317c9fa] --- projects/clr/hipamd/vdi/hip_formatting.hpp | 53 ++++++++++++++-------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/projects/clr/hipamd/vdi/hip_formatting.hpp b/projects/clr/hipamd/vdi/hip_formatting.hpp index d75c2071fc..ec92b137c1 100644 --- a/projects/clr/hipamd/vdi/hip_formatting.hpp +++ b/projects/clr/hipamd/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 <