@@ -764,9 +764,10 @@ bool VirtualGPU::processMemObjects(const amd::Kernel& kernel, const_address para
764764 uint32_t index = desc.info_ .arrayIndex_ ;
765765 mem = memories[index];
766766 const void * globalAddress = *reinterpret_cast <const void * const *>(params + desc.offset_ );
767- ClPrint (amd::LOG_INFO, amd::LOG_KERN,
768- " Arg%d: %s %s = ptr:%p" , i, desc.typeName_ .c_str (), desc.name_ .c_str (), globalAddress);
769767 if (mem == nullptr ) {
768+ ClPrint (amd::LOG_INFO, amd::LOG_KERN,
769+ " Arg%d: %s %s = ptr:%p " , i, desc.typeName_ .c_str (), desc.name_ .c_str (),
770+ globalAddress);
770771 // ! This condition is for SVM fine-grain
771772 if (dev ().isFineGrainedSystem (true )) {
772773 // Sync AQL packets
@@ -775,22 +776,22 @@ bool VirtualGPU::processMemObjects(const amd::Kernel& kernel, const_address para
775776 const static bool All = true ;
776777 memoryDependency ().clear (!All);
777778 }
778- }
779- else {
779+ } else {
780780 gpuMem = static_cast <Memory*>(mem->getDeviceMemory (dev ()));
781781
782- const void * globalAddress = *reinterpret_cast <const void * const *>(params + desc.offset_ );
782+ const void * globalAddress =
783+ *reinterpret_cast <const void * const *>(params + desc.offset_ );
783784 ClPrint (amd::LOG_INFO, amd::LOG_KERN,
784785 " Arg%d: %s %s = ptr:%p obj:[%p-%p]" , i, desc.typeName_ .c_str (),
785- desc.name_ .c_str (), globalAddress, gpuMem->getDeviceMemory (),
786+ desc.name_ .c_str (), globalAddress, gpuMem->getDeviceMemory (),
786787 reinterpret_cast <address>(gpuMem->getDeviceMemory ()) + mem->getSize ());
787788
788789 // Validate memory for a dependency in the queue
789790 memoryDependency ().validate (*this , gpuMem, (desc.info_ .readOnly_ == 1 ));
790791
791792 assert ((desc.addressQualifier_ == CL_KERNEL_ARG_ADDRESS_GLOBAL ||
792793 desc.addressQualifier_ == CL_KERNEL_ARG_ADDRESS_CONSTANT) &&
793- " Unsupported address qualifier" );
794+ " Unsupported address qualifier" );
794795
795796 const bool readOnly =
796797#if defined(USE_COMGR_LIBRARY)
@@ -855,10 +856,34 @@ bool VirtualGPU::processMemObjects(const amd::Kernel& kernel, const_address para
855856 const auto it = hsaKernel.patch ().find (desc.offset_ );
856857 WriteAqlArgAt (const_cast <address>(params), mem, sizeof (void *), it->second );
857858 }
858- ClPrint (amd::LOG_INFO, amd::LOG_KERN,
859- " Arg%d: %s %s = val:0x%lx" , i, desc.typeName_ .c_str (), desc.name_ .c_str (),
860- (desc.size_ == 4 ) ? *reinterpret_cast <const int *>(srcArgPtr) :
861- (desc.size_ == 8 ) ? *reinterpret_cast <const long long *>(srcArgPtr) : 0LL );
859+
860+ if (IsLogEnabled (amd::LOG_INFO, amd::LOG_KERN)) {
861+ if (desc.size_ > 8 ) {
862+ std::string bytes = " 0x" ;
863+ constexpr size_t kMaxBytes = 64 ;
864+ for (size_t j = 0 ; j < std::min (desc.size_ , kMaxBytes ); j++) {
865+ char byteStr[4 ];
866+ snprintf (byteStr, sizeof (byteStr), " %02x " ,
867+ reinterpret_cast <const uint8_t *>(srcArgPtr)[j]);
868+ bytes += byteStr;
869+ }
870+ if (desc.size_ > kMaxBytes ) {
871+ bytes += " ..." ;
872+ }
873+ ClPrint (amd::LOG_INFO, amd::LOG_KERN,
874+ " Arg%d: %s %s = %s (size:0x%x)" , i, desc.typeName_ .c_str (), desc.name_ .c_str (),
875+ bytes.c_str (), desc.size_ );
876+ } else {
877+ ClPrint (amd::LOG_INFO, amd::LOG_KERN,
878+ " Arg%d: %s %s = val:0x%lx (size:0x%x)" , i, desc.typeName_ .c_str (),
879+ desc.name_ .c_str (),
880+ (desc.size_ == 1 ) ? *reinterpret_cast <const uint8_t *>(srcArgPtr) :
881+ (desc.size_ == 2 ) ? *reinterpret_cast <const uint16_t *>(srcArgPtr) :
882+ (desc.size_ == 4 ) ? *reinterpret_cast <const uint32_t *>(srcArgPtr) :
883+ (desc.size_ == 8 ) ? *reinterpret_cast <const uint64_t *>(srcArgPtr) :
884+ 0LL , desc.size_ );
885+ }
886+ }
862887 }
863888 else if (desc.type_ == T_SAMPLER) {
864889 uint32_t index = desc.info_ .arrayIndex_ ;
0 commit comments