forked from ggml-org/llama.cpp
-
Notifications
You must be signed in to change notification settings - Fork 8
ggml-cuda: add per-op GPU roofline profiling for the HIP backend #33
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| #pragma once | ||
|
|
||
| // Per-op GPU roofline profiling for the HIP/ROCm backend (see ggml-cuda-roofline.cpp). | ||
| // Compiled only when GGML_HIP_ROOFLINE is defined and activated at runtime by the | ||
| // environment variable GGML_ROOFLINE_OUT=<path.json>. Every entry point is a no-op | ||
| // unless that variable is set. | ||
|
|
||
| #include "ggml.h" | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| // Load and configure rocprofiler-sdk when GGML_ROOFLINE_OUT is set. Call once during | ||
| // backend registration, before any GPU stream is created. Idempotent; no-op otherwise. | ||
| void ggml_cuda_roofline_init(void); | ||
|
|
||
| // Record the GPU architecture (e.g. "gfx1151") stored in the report. No-op unless active. | ||
| void ggml_cuda_roofline_set_device(const char * arch); | ||
|
|
||
| // Discard everything captured so far (drains pending records first). Call after a | ||
| // warmup run so the report covers only the measured run. No-op unless active. | ||
| void ggml_cuda_roofline_reset(void); | ||
|
|
||
| // Tag the GPU kernels launched for this op so their device time is attributed to it. | ||
| // Call once per op, before its kernel(s) are dispatched. No-op unless active. | ||
| void ggml_cuda_roofline_begin_op(const struct ggml_tensor * node); | ||
|
|
||
| // Override the record of the op tagged by the last begin_op so it covers a fused span of | ||
| // node_count nodes (cgraph->nodes[node_idx .. node_idx+node_count-1]): lists every fused op | ||
| // and reports the fused group's HBM traffic with intermediates discarded. Call right after a | ||
| // successful fusion, before advancing the loop. No-op unless active. | ||
| void ggml_cuda_roofline_fuse_ops(const struct ggml_cgraph * cgraph, int node_idx, int node_count); | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.