rocprofiler icon indicating copy to clipboard operation
rocprofiler copied to clipboard

Multiple variable definition errors if rocprofiler.h is included in multiple C files

Open gcongiu opened this issue 1 year ago • 2 comments

The HSA_VEN_AMD_AQLPROFILE_LEGACY_PM4_PACKET_SIZE is defined in an header file (hsa_ven_amd_aqlprofile.h) instead of a C file. The header is then included in rocprofiler.h and causes multiple definition errors at compile time when the rocprofiler header is included in more than one C file.

A possible fix for this problem could be to define the variable as static in the header file or to declare it extern in the header and define it another C file.

gcongiu avatar May 17 '23 10:05 gcongiu

@ammarwa any update on this? Thanks

gcongiu avatar Jun 09 '23 08:06 gcongiu

This is a reproducer issue-114.tar.gz

gcongiu avatar Jun 12 '23 20:06 gcongiu

@gcongiu Thanks for the reproducer! I was able to reproduce the issue on ROCm-6.2. Since this issue is a duplicate of https://github.com/ROCm/ROCR-Runtime/issues/121, we will be closing this issue and track it there. Thanks!

tcgu-amd avatar Aug 26 '24 18:08 tcgu-amd

@mardom1 The correct usage of the header file for v2 would be that instead of '#include <rocprofiler.h>', use '#include <v2/rocprofiler.h>' instead.

Please refer to the documentation for the API here: https://github.com/ROCm/rocprofiler?tab=readme-ov-file#rocprofiler-v1

Along with the example here: ROCProfilerV2 API — rocprofiler 2.0.0 Documentation (amd.com)

Apologies for the confusion. Hope this helps!

tcgu-amd avatar Sep 04 '24 17:09 tcgu-amd