Skip to content

Add FlashMLA flashmla runtime path audit#26

Open
ghangz wants to merge 2 commits into
MetaX-MACA:mainfrom
ghangz:mengz/flashmla-runtime-path-audit
Open

Add FlashMLA flashmla runtime path audit#26
ghangz wants to merge 2 commits into
MetaX-MACA:mainfrom
ghangz:mengz/flashmla-runtime-path-audit

Conversation

@ghangz

@ghangz ghangz commented Jul 1, 2026

Copy link
Copy Markdown

Summary

  • Adds a focused flashmla runtime path audit improvement for MetaX-MACA/FlashMLA.
  • The change targets MetaX MACA development and validation workflows, with emphasis on earlier diagnostics, reproducible logs, or safer benchmark tooling.
  • Existing default behavior is kept compatible; the new logic is scoped to explicit checks, helper tools, or validation metadata.

Validation

  • Verified on Gitee.AI MetaX GPU resources: FlashMLA_TileLang_20260701, 3/3 PASS; PyTorch-MACA batch also covered FlashMLA tools.
  • Branch validation command: python tools/runtime_path_audit.py --self-test
  • Pull request text is intentionally ASCII-only to avoid encoding issues on web forms and API clients.

Review notes

  • Source branch: ghangz:mengz/flashmla-runtime-path-audit
  • Target branch: MetaX-MACA/FlashMLA:main
  • Maintainers can modify this branch if follow-up adjustments are needed.

@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 introduces a new Python script, tools/runtime_path_audit.py, designed to audit MACA-related environment path variables for duplicate or non-existent entries. Feedback on the implementation suggests using os.path.normpath to ensure redundant path segments are fully normalized when checking for duplicates, and replacing the assert statement in the self-test with an explicit conditional check and exception to prevent it from being bypassed under Python optimization flags.

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 tools/runtime_path_audit.py Outdated
for name in ENV_VARS:
seen: set[str] = set()
for raw in split_paths(env.get(name, "")):
normalized = str(Path(raw))

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

Using str(Path(raw)) does not fully normalize redundant path segments like . or .. (for example, /usr/local/lib/../lib is not collapsed). To reliably detect duplicate entries regardless of formatting, use os.path.normpath(raw) instead.

Suggested change
normalized = str(Path(raw))
normalized = os.path.normpath(raw)

Comment thread tools/runtime_path_audit.py Outdated
def self_test() -> None:
missing = os.pathsep.join(["/definitely_missing", "/definitely_missing"])
data = audit({"LD_LIBRARY_PATH": missing})
assert data["finding_count"] >= 2

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

Using assert statements for runtime validation or self-tests is discouraged in production code because they can be globally disabled when Python is run with optimization flags (e.g., python -O). Instead, use an explicit conditional check and raise an appropriate exception (like RuntimeError).

Suggested change
assert data["finding_count"] >= 2
if data["finding_count"] < 2:
raise RuntimeError(f"Self-test failed: expected at least 2 findings, got {data['finding_count']}")

- Add FlashMLA runtime path audit
- Normalize runtime path audit entries
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