Skip to content

增加算子库基准清单结构化输出#32

Open
ghangz wants to merge 2 commits into
MetaX-MACA:mainfrom
ghangz:mengz/add-mcoplib-benchmark-list-json
Open

增加算子库基准清单结构化输出#32
ghangz wants to merge 2 commits into
MetaX-MACA:mainfrom
ghangz:mengz/add-mcoplib-benchmark-list-json

Conversation

@ghangz

@ghangz ghangz commented Jun 10, 2026

Copy link
Copy Markdown

这次改动补上了算子库基准清单结构化输出,主要是为了解决算子库构建和诊断流程里相关信息不够集中、人工整理成本较高的问题,让日常排查、验证和结果归档更直接。

实现上补充了对应工具或脚本逻辑,同时尽量保持现有用法不变,避免影响已有流程。

这一分支已经在沐曦算力环境完成实际验证,相关检查均已通过,现提交合入。

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the benchmark script to allow listing supported operators even when the 'nvbench' library is not installed, and introduces a new --list-json command-line argument to output the operator list in JSON format. The review feedback suggests directing the runtime error message to sys.stderr instead of sys.stdout to prevent interfering with JSON parsing, and updating the help text of the --op argument to mention --list-json as an alternative to --list.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread benchmark/mcoplib_mxbenchmark_ops.py Outdated
sys.exit(1)

if bench is None:
print("[ERROR] Runtime environment missing 'nvbench'. Please check configuration.")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

在命令行工具中,错误信息应当输出到标准错误流(sys.stderr)而不是标准输出流(sys.stdout)。特别是当用户使用 --list-json 等结构化输出功能时,将错误信息输出到标准输出可能会干扰下游脚本对 JSON 的解析。建议将此处的错误打印重定向到 sys.stderr

Suggested change
print("[ERROR] Runtime environment missing 'nvbench'. Please check configuration.")
print("[ERROR] Runtime environment missing 'nvbench'. Please check configuration.", file=sys.stderr)

parser = argparse.ArgumentParser(description="MCOPLIB Operator Performance Benchmark")
parser.add_argument("--op", type=str, default=None, help="Operator name (Required, unless --list is used)")
parser.add_argument("--list", action="store_true", help="List all supported operators and exit")
parser.add_argument("--list-json", action="store_true", help="Print supported operators as JSON and exit")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

由于新增了 --list-json 参数,第 581 行中 --op 参数的帮助信息 (Required, unless --list is used) 变得不够准确。建议将其更新为 (Required, unless --list or --list-json is used),以避免误导用户。

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.

1 participant