Skip to content

Conversation

cj401-amd
Copy link
Contributor

@cj401-amd cj401-amd commented Aug 4, 2025

@xla-rotation, would you please kindly help review this PR?

We are phasing out development and support for roctracer/rocprofiler/rocprof/rocprofv2 in favor of rocprofiler-sdk (v3) in upcoming ROCm releases. rocprofielr-sdk (v3) also moves away from cupti.

This PR integrates rocprofiler-sdk (v3) into XLA for profiling GPU events on AMD GPUs.

  • Integrate rocprofiler-sdk (v3) to XLA for improved profiling of GPU events, support both time-based and step-based profiling,
  • Add unit tests for rocm_collector and rocm_tracer

@i-chaochen
Copy link
Contributor

Hi @xla-rotation this PR is important to us, and it's amd-only code, could you review it please? thanks!

@cj401-amd cj401-amd force-pushed the ci_cj-rocprof-v3-roctracer-v1 branch from 90fd457 to c6080d1 Compare August 14, 2025 15:42
@cj401-amd cj401-amd changed the title [ROCm] upstream rocprofiler-sdk (v3) along with rocmtracer (v1) [ROCm] upstream using rocprofiler-sdk (v3) for tracing AMD GPU events Aug 18, 2025
@cj401-amd cj401-amd force-pushed the ci_cj-rocprof-v3-roctracer-v1 branch from c6080d1 to 8c23ab9 Compare September 17, 2025 22:49
Copy link
Member

@dimitar-asenov dimitar-asenov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please #include in each source file only the files that are used in this file and all the files that are used in this file. E.g. rocm_tracer_utils.cc file at the moment includes only the corresponding header, but instead should include everything it uses directly. Similarly, rocm_tracer_utils.h should not include any files that it does not use directly. Please also do this for all the other files.

Another comment:
Do not use the <chrono> library. Use substitutes from absl instead.

@cj401-amd cj401-amd force-pushed the ci_cj-rocprof-v3-roctracer-v1 branch from 63542a8 to 88fc01a Compare September 23, 2025 09:51
@cj401-amd
Copy link
Contributor Author

Please #include in each source file only the files that are used in this file and all the files that are used in this file. E.g. rocm_tracer_utils.cc file at the moment includes only the corresponding header, but instead should include everything it uses directly. Similarly, rocm_tracer_utils.h should not include any files that it does not use directly. Please also do this for all the other files.

Another comment: Do not use the <chrono> library. Use substitutes from absl instead.

Hey @dimitar-asenov, please help have a look as we have addressed your comments now.

btw, I wonder if it is possible to let me know what "Google internal checks FAILED" is?

#include <vector>
#include <time.h>
#include <unistd.h>
#include <chrono>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not use <chrono>. Use alternatives from absl instead.

#include <time.h>
#include <unistd.h>
#include <chrono>
#include <unistd.h> // For standard sysconf
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already included a few lines above.

#include "xla/backends/profiler/gpu/rocm_tracer_utils.h"

#include <cstdint>
#include <cstring>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the entries within the individual include blocks sorted alphabetically.

case ROCPROFILER_HIP_RUNTIME_API_ID_hipMemcpyWithStream:
return true;
break;
default:;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use {} to more explicitly denote an empty statement, as opposed to just ;.

OO(Memset)
OO(Synchronization)
OO(Generic)
default:;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use {} to more explicitly denote an empty statement, as opposed to just ;.

@dimitar-asenov
Copy link
Member

Please #include in each source file only the files that are used in this file and all the files that are used in this file. E.g. rocm_tracer_utils.cc file at the moment includes only the corresponding header, but instead should include everything it uses directly. Similarly, rocm_tracer_utils.h should not include any files that it does not use directly. Please also do this for all the other files.
Another comment: Do not use the <chrono> library. Use substitutes from absl instead.

Hey @dimitar-asenov, please help have a look as we have addressed your comments now.

btw, I wonder if it is possible to let me know what "Google internal checks FAILED" is?

Thank you for make the changes. I've flagged additional changes from our internal checks. Sorry for the back and forth, I hope this is the last round.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants