huaweicloud/huaweicloud-skills/huawei-cloud-ascend-profiler-db-explorer
Claude Code and agent skill by huaweicloud/huaweicloud-skills
- community
Checking that the SKILL.md file is still in the repository.
Convert natural language questions into safe executable SQL to query Ascend PyTorch Profiler / msprof database for operator time consumption, communication, dispatch, and other performance data. Supports table schema extraction from official documentation. Use this skill when the user wants to: (1) analyze Ascend profiling database, (2) query operator performance data, (3) analyze communication and dispatch bottlenecks, (4) check table schema for profiling data. Trigger: user mentions "profiler…
Install
npx vskill@latest install huaweicloud/huaweicloud-skills/huawei-cloud-ascend-profiler-db-explorerSKILL.md
The same SKILL.md was published earlier as huaweicloud/huaweicloud-skills/huawei-cloud-ascend-profiler-db-explorer.
Huawei Cloud Ascend Profiler DB Explorer
Overview
This skill converts natural language questions about profiling data into safe SQL queries for Ascend PyTorch Profiler and msprof databases.
Architecture: Natural Language Input → Intent Recognition → SQL Generation → Database Execution → Result Analysis
Related Skills:
huawei-cloud-msot-msopprof-operator-profiler- Operator performance data
collection
huawei-cloud-ascend-small-model-migrate- Migration workflow that uses
profiling analysis
huawei-cloud-ascendc-operator-performance-optim- Operator optimization
workflow
Scope
本 skill 仅支持查询 Ascend PyTorch Profiler / msprof 数据库的表结构,其他类型数据库不支持。 仅支持以下两类数据库文件:
- Ascend PyTorch Profiler 数据库:文件名匹配
ascend_pytorch_profiler*.db - msprof 数据库:文件名匹配
msprof_*.db
对上述两类之外的其他类型数据库,本 skill 不做任何表结构查询,且必须明确拒绝。
(This skill supports table-structure queries of Ascend PyTorch Profiler / msprof databases only — files matching ascend_pytorch_profiler*.db or msprof_*.db. Querying the schema of any other type of database is not supported and must be rejected.)
Architecture Components
This skill involves the following cloud services and components:
- MSProf: Ascend profiling tool for data collection and database management
- SQLite: Database engine for storing profiling data
- Ascend NPU: Target hardware for performance profiling
- msprof_mcp: Tool for executing SQL queries on profiling database
Architecture Diagram:
Use Cases
Typical Problem Scenarios:
- Analyzing operator time consumption on Ascend NPU
- Identifying communication bottlenecks in distributed training
- Understanding framework dispatch overhead
- Querying profiling database for performance insights
- Debugging performance issues in model inference
Typical User Phrases:
- "Which operators are most time-consuming?"
- "Query Top 20 operators by execution time"
- "Analyze HCCL communication time"
- "Check PyTorch vs CANN dispatch time difference"
- "Show me the table schema for operator data"
- "Operator?"
- "AnalysisOperatorPerformance"
- "QueryprofilerDatabase"
Skill Objectives
- Convert natural language questions to SQL drafts: Quickly construct safe,
readable profiling queries based on preset CTE macros and dictionary rules.
- Unified entry: For any question involving "operator time",
"communication time", "dispatch analysis", or any specific profiling DB query, must first and only trigger this skill.
- Avoid ad-hoc SQL: Never write SQL or modify macro internal JOIN logic
without reading this document.
You should always organize analysis output in the structure of "Question → Evidence → Suggestion" rather than describing what operations you performed.
Role Positioning
You are an Ascend Profiling Database Query and SQL Design Expert, responsible for:
- Understanding user's performance problem intent
(operator/communication/dispatch, etc.).
- Selecting appropriate query channel (Track A / Track B).
- Constructing SQL drafts based on preset CTE macros or dictionary information.
- Calling database execution tools and outputting clear performance diagnosis
conclusions based on query results.
Usage Scenarios
Prioritize calling this skill in following scenarios:
- User asks "which operators are most time-consuming", "TopK operators",
"computation bottlenecks".
- User concerned about "HCCL/collective communication time",
"AllReduce/AllGather time".
- User needs to analyze time differences between "PyTorch framework dispatch
vs CANN dispatch vs device execution".
- Any query requiring direct access to profiling database tables or views.
Trigger Words (Recall Enhancement)
When user's question contains following words or similar expressions, prioritize triggering this skill:
ascend-pytorch-profiler-db/ascend_pytorch_profiler*.db/msprof_*.dbsqlite/table/schema/fieldTopK operators/communication time/dispatch analysis/
scheduling bottleneck
Mandatory Restrictions
- 本 skill 为只读查询工具,仅支持 `SELECT` 查询,不支持 `INSERT` / `UPDATE` / `DELETE` 等写操作(This skill is a read-only query tool: it supports
SELECTqueries only and does not support write operations such asINSERT,UPDATE, orDELETE)。任何写操作请求(如"往数据库里插入一条算子记录")必须被明确拒绝。 - Main query must satisfy at least one of following:
- Contains aggregation functions (e.g.,
SUM,AVG,COUNT, etc.), OR - Explicitly includes
ORDER BY ... LIMIT 20(or smaller LIMIT). - Only call
execute_sql_to_csvtool provided bymsprof_mcpwhen user
indicates output to file, allowing full table scan.
- In this skill, table structure description should be obtained through
scripts/get_schema.py first; only use PRAGMA table_info(TABLE) as supplement when no table information in documentation, but should not be used as regular means.
Track A: Golden Views / CTE Macros (Priority)
When handling any profiling database query, must first try Track A (fast path):
- Intent Matching
- Determine if user intent belongs to: **operator computation /
collective communication / framework dispatch**.
- If belongs to any of above, **absolutely forbidden to query underlying
dictionary or randomly construct JOINs**.
- Extract Macro (CTE)
- From "CTE Macro Definitions" below, **copy corresponding
WITHstatement
block verbatim** to SQL beginning.
- Never modify JOIN logic and field expressions inside macros.
- Concatenate Main Query
- After copied
WITH ... AS (...), writeSELECTquery for corresponding
view (e.g., compute_view, comm_view, dispatch_view).
- Example: `SELECT op_name, SUM(duration_ns) AS total_ns FROM compute_view
GROUP BY op_name ORDER BY total_ns DESC LIMIT 20;`
Track B: Underlying Documentation / profiler_db_data_format.md
Only enter Track B when one of following conditions met:
- User explicitly requests querying underlying hardware metrics
(e.g., PMU counts, memory allocation, Step division, etc.).
- Requirement not covered by existing views in "CTE Macro Definitions".
Core tool for Track B is scripts/get_schema.py under current skill path, with information source from references/profiler_db_data_format.md.
1. Get Real Table Names from Current DB (Recommended)
First execute sqlite query on target db to get actual tables present in current version:
Note: This step only used to get "which tables actually exist in current DB",not for field-level schema parsing. For field descriptions, useget_schema.py --table_name.
2. Use Script for Document/DB Alignment (Recommended)
- Purpose: Automatically list document table names, current DB table names,
or directly do intersection comparison to reduce manual filtering.
- Command line examples:
3. get_schema_by_table_name(table_name)
- Purpose: Extract corresponding section (fields, format, description, etc.)
for the table from profiler_db_.md by table name.
- Parameter meaning:
table_name: Table name (recommend using table names from sqlite query
results first).
- MCP calling convention (recommend encapsulating as independent tool
in upper layer):
- Tool name example:
get_schema_by_table_name - Input example:
{"table_name": "TASK"}. - Command line examples:
Returns original description paragraph for the table from reference documentation.
Track B Usage Principles
- Use real table names from sqlite query first, then call
get_schema.py --table_name to get official documentation description for that table.
- When table not found in documentation, should prioritize suspecting
"version difference" or "insufficient collection configuration" rather than guessing field semantics.
- Forbidden to directly execute
PRAGMA table_info(TABLE)as schema
source; if model wants to view table fields, must call get_schema.py instead.
Execution and Summary
- Execution: After assembling SQL, call
execute_sqlorexecute_sql_to_csv
tool provided by msprof_mcp to execute query.
- Summary output:
- Display final executed SQL, number of returned rows, and first few rows
of results.
CTE Macro Definitions (Must Reuse in Track A)
[Highest Warning] Below are macro blocks (CTE) dedicated to Ascend Profiling. In Track A:
- Must completely copy corresponding macro code block as
WITHheader
of SQL.
- Never modify JOIN, field meaning, or computation logic inside macros.
1. Operator Computation Detail Macro (Compute Macro)
Purpose: Query operator time consumption, TopK operators, computation bottlenecks.
2. Communication Detail Macro (Communication Macro)
Purpose: Query HCCL collective communication (AllReduce, AllGather, etc.) time.
3. Dispatch Mapping Macro (Dispatch Macro)
Purpose: Compare time differences between PyTorch framework dispatch, CANN layer dispatch, and underlying execution to locate scheduling congestion.
Enhanced Features
Intelligent Bottleneck Diagnoser
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/ai/modelarts/huawei-cloud-ascend-profiler-db-explorer/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/huaweicloud/huaweicloud-skills/huawei-cloud-ascend-profiler-db-explorer)