Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PROTON] Refactor GPU profilers #4056

Merged
merged 17 commits into from
Jun 4, 2024
Merged

[PROTON] Refactor GPU profilers #4056

merged 17 commits into from
Jun 4, 2024

Conversation

Jokeren
Copy link
Contributor

@Jokeren Jokeren commented Jun 3, 2024

  1. Extract duplicated code into GPUProfiler.h
  2. Track finished correlation ids for both cupti and amd profilers

@Jokeren Jokeren marked this pull request as ready for review June 3, 2024 18:09
@Jokeren Jokeren requested a review from ptillet as a code owner June 3, 2024 18:09
@Jokeren Jokeren requested a review from antiagainst June 3, 2024 18:10
@Jokeren
Copy link
Contributor Author

Jokeren commented Jun 4, 2024

Waiting for @CRobeck's feedback

Copy link
Contributor

@CRobeck CRobeck left a comment

Choose a reason for hiding this comment

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

LGTM. Few minor comments.

}
cupti::activityFlushAll<true>(CUPTI_ACTIVITY_FLAG_FLUSH_FORCED);
profiler.correlation.flush(
/*maxRetries=*/100, /*sleepMs=*/10,
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we do any testing of these maxRetries and sleepMs values? maxRetries is probably fine at 100 but is the 10 ms from a documented latency value from somewhere? Maybe worth a command line argument to set these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There isn't a documentation for it. In general increase it may get more valid records in corner cases. Unfortunately we don't support passing configurations through the command line or python function in proton. We would like to keep a very small number of profiling knobs to avoid increasing the learning curve.

I think may could use environment variables to control it though.

I can leave it to you to do a bit investigation and add the support. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure. Will look into it.

std::set<Data *> &dataSet,
const roctracer_record_t *record) {
void processActivity(std::mutex &corrIdToExternIdMutex,
std::map<uint64_t, size_t> &corrIdToExternId,
Copy link
Contributor

@CRobeck CRobeck Jun 4, 2024

Choose a reason for hiding this comment

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

Is this data type inconsistency with above expected? Is it a known difference that cupti uses uint32_t and roctracer uint64_t?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(symbol != NULL)
? abi::__cxa_demangle(symbol, NULL, &funcnamesize, &status)
? abi::__cxa_demangle(symbol, NULL, &funcNameSize, &status)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Maybe move this into a check around abi::__cxa_demangle:
if (const char* name = abi::__cxa_demangle(symbol, NULL, &funcnamesize, &status))
and then just return the unmangled name if unsuccessful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved

@@ -173,10 +146,10 @@ struct CuptiProfiler::CuptiProfilerPimpl {
static void callbackFn(void *userData, CUpti_CallbackDomain domain,
CUpti_CallbackId cbId, const void *cbData);

const inline static size_t AlignSize = 8;
const inline static size_t BufferSize = 64 * 1024 * 1024;
inline const static size_t AlignSize = 8;
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe constexpr instead of/in addition inline to here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved

@Jokeren Jokeren merged commit 328b86d into main Jun 4, 2024
6 checks passed
@Jokeren Jokeren deleted the keren/gpuprofiler branch June 4, 2024 17:57
jataylo pushed a commit to ROCm/triton that referenced this pull request Jun 19, 2024
1. Extract duplicated code into GPUProfiler.h
2. Track finished correlation ids for both cupti and amd profilers

(cherry picked from commit 328b86d)
ptillet pushed a commit that referenced this pull request Jun 20, 2024
Cherry picks for release/3.0.x

General:
- e8bc45d [BACKEND][AMD] Disable linear layout due to perf regression
(#4126)
- 9a0a7c2 [AMD] Add basic verification to MFMA encoding (#4117)
 
for RDNA:
- 100e2aa [AMD][WMMA] Support dot3d (#3674)
- 4a1ea8e [AMD][gfx11] Fix BF16 wmma instr generation (#4135)
 
Proton HIP PRs:
- 328b86d [PROTON] Refactor GPU profilers (#4056)
- 60613fb [PROTON] Roctracer: convert agent id to gpu id for gpu ops
(#4090)
- c1776fa [PROTON][AMD] Add Proton HIP GPU Utilization Metrics (#4119)

---------

Co-authored-by: Lei Zhang <antiagainst@gmail.com>
Co-authored-by: Alexander Efimov <efimov.alexander@gmail.com>
Co-authored-by: Ilya V <152324710+joviliast@users.noreply.github.com>
Co-authored-by: Keren Zhou <kerenzhou@openai.com>
Co-authored-by: mwootton <michael.wootton@amd.com>
Co-authored-by: Corbin Robeck <corbin.robeck@amd.com>
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.

None yet

3 participants