enh(pmc_l2_analyzer): support rocpd SQLite DB input (rocprofv3 >= ROCm 7.x)#658
Draft
Arist12 wants to merge 1 commit into
Draft
enh(pmc_l2_analyzer): support rocpd SQLite DB input (rocprofv3 >= ROCm 7.x)#658Arist12 wants to merge 1 commit into
Arist12 wants to merge 1 commit into
Conversation
…m 7.x)
rocprofv3 --pmc on ROCm >= 7.x writes SQLite databases (pmc_*_results.db)
instead of CSV files. The previous version of pmc_l2_analyzer.py only
accepted CSV, requiring a manual export step to query the DB and produce a
compatibility CSV before any analysis could run.
Add native rocpd SQLite DB support:
_load_counters_from_db(path, kernel):
Discovers the UUID-suffixed table set (rocpd_pmc_event_<uuid>,
rocpd_info_pmc_<uuid>, rocpd_kernel_dispatch_<uuid>,
rocpd_info_kernel_symbol_<uuid>) by scanning sqlite_master. Joins the
four tables to aggregate counter values for dispatches whose kernel name
matches the --kernel substring filter, then returns the same
(agg, dispatches) pair as the CSV path.
load_counters() dispatches on file extension:
.db → rocpd path
anything else → existing CSV path (unchanged behavior)
Multiple files of mixed types can be passed in a single invocation, which
is the normal workflow: two separate --pmc runs (one for L2 counters, one
for EA/bandwidth counters) produce two DBs that are analyzed together.
Prints "Input format(s): rocpd" or "csv" so users can tell which path ran.
Also removes the dead req = agg.get("TCC_REQ_sum", 0) assignment that was
present in the original but never used.
Usage with DB input:
python pmc_l2_analyzer.py pmc_l2_results.db pmc_ea_results.db \\
--kernel pa_mqa_logits_fp4_kernel_0
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
rocprofv3 --pmcon ROCm >= 7.x writes PMC counter results to a SQLitedatabase (
pmc_*_results.db) rather than a flat CSV file. The previouspmc_l2_analyzer.pyonly accepted CSV input, so any analysis on a ROCm 7.xsystem required a manual intermediate step: open the DB, query the four rocpd
tables, export to a compatibility CSV, then run the analyzer.
Solution
Add native rocpd SQLite DB support alongside the existing CSV path.
New internal function
_load_counters_from_db(path, kernel):sqlite3.connect("file:...?mode=ro", uri=True).sqlite_masterforrocpd_pmc_event_<uuid>. The UUID suffix is opaque and changes betweenruns, so table names cannot be hard-coded.
--kernelsubstring on the kernel symbol name.(agg, dispatches)pair as the CSV path so the rest ofmain()is unchanged.load_counters()dispatches on file extension:.db→ rocpd pathMultiple files of mixed types can be passed in one invocation (the typical
workflow: two separate
--pmcruns produce two DBs):python pmc_l2_analyzer.py pmc_l2_results.db pmc_ea_results.db \ --kernel pa_mqa_logits_fp4_kernel_0Also removes the pre-existing dead assignment
req = agg.get("TCC_REQ_sum", 0)that was never used.
Usage comparison
Testing
Eight unit tests using
tempfilemock DBs and CSVs:All eight pass.