Skip to content

[AIROCMLIR-1030] Port recent enhancements in tuning scripts from rocMLIR to rocmlirTriton - #390

Merged
erizheng-amd merged 11 commits into
developfrom
eric-1030
Aug 25, 2026
Merged

erizheng-amd merged 11 commits into
developfrom
eric-1030

Conversation

@erizheng-amd

@erizheng-amd erizheng-amd commented Jul 30, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

This PR examines the new changes on tuning scripts from rocMLIR side since the last porting in PR #192, this includes tuningRunner.py, perfRunner.py, and quickTuningGen.py. This PR ports the new changes and also add new tests while keeping the rocmlirTriton specific changes.

Technical Details

This PR includes several major changes on the rocMLIR side:

Also includes the two new pytests in MLIR test_tuningRunner.py and test_perfRunner.py, rewired and refactored them into LIT test:

Original class New file Tests
TestParseTuningDbLine, TestReadTuningDb, TestParseDataTypes, TestLayoutHelpers, TestGetNanoseconds, TestGetProfilerOutputPath, TestGetMetricArgsForRocprof, TestGetMiliseconds perfRunner-test.py 27
TestFormatError, TestGetConfigClass, TestParseArguments, TestNumaTopologyParseCpuList tuningRunner-arg-validation.py 16
TestGetStateFilepath, TestTuningState, TestTuningStateFile, TestTunedConfigsCache, TestDebugFileWriter, TestGetGitCommitHash tuningRunner-state.py 21
TestCanonicalizeTestVector tuningRunner-canonicalization.py 9
TestNumaNodeLock tuningRunner-numa-lock.py 6
TestFindBestPerfconfig, TestTuneConfig tuningRunner-driver-results.py 3

Changes are intentionally left out:

Divergence still presenting due to specific rocmlirTriton work:

Test Plan

  • ninja check-rocmlir
  • PR CI passed
  • nightly CI running
  • Tuning on a few configs and make sure it is working

Test Result

  • ninja check-rocmlir passes
  • PR CI and nightly CI running
  • Tuning and perfRunner works

Submission Checklist

@erizheng-amd
erizheng-amd requested a review from Copilot July 30, 2026 21:32
@erizheng-amd erizheng-amd added the claude-review Request a Claude PR review label Jul 30, 2026
@rocmlir-pr-reviewer rocmlir-pr-reviewer Bot added the modifies-ci-paths PR modifies the Claude review CI security perimeter; audit before applying claude-review label Jul 30, 2026
@rocmlir-pr-reviewer

Copy link
Copy Markdown
Contributor

⚠️ This PR modifies the Claude-review CI security perimeter

The following files in this PR control whether and how the
claude-review workflow protects its LLM Gateway secrets at
runtime (see .github/workflows/CLAUDE_AUTO_REVIEW.md):

  • .github/workflows/ci.yml

Before applying the claude-review label on this PR, please:

  1. Audit the diff in these paths line-by-line. A malicious or
    accidental change could disable the --allowedTools
    restriction, the overlay step, the sanitizer, or the
    review/post job split -- any of which would expose the
    secrets in env to the PR-modified workflow.
  2. If the changes are legitimate and you want a Claude review,
    do NOT apply the claude-review label. Instead, run via
    Actions → Claude Auto Review → Run workflow and enter
    this PR's number. The dispatch path runs from the trusted,
    code-owner-approved version of the workflow on
    develop, so a malicious PR-side
    modification cannot affect the run.

(This banner is automated. The modifies-ci-paths label
will be removed automatically if a future push removes the
perimeter modifications. The Layer-3 in-workflow guard will
additionally fail the claude-review label-triggered run
on this PR if the label is applied while perimeter changes
are present.)

@rocmlir-pr-reviewer rocmlir-pr-reviewer Bot removed the claude-review Request a Claude PR review label Jul 30, 2026

Copilot AI 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.

Pull request overview

This PR ports recent rocMLIR performance/tuning script enhancements into rocmlirTriton, including more consistent config canonicalization, improved verification behavior (timeouts + NUMA-aware locking), expanded quick-tuning generation for additional ops, and adds CI-ready Python tests for these scripts.

Changes:

  • Add NUMA-node reader/writer locking to reduce CPU-verification interference during parallel tuning, and introduce a configurable verification timeout.
  • Canonicalize and validate configs more consistently across tuningRunner.py and perfRunner.py, including stricter parsing/canonicalization in DB/config loaders.
  • Add new pytest-based unit tests (GPU-less via HIP mocking) and wire them into GitHub Actions CI; update CLI flag spellings and related docs/tests.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pip_requirements.txt Adds pytest dependency for new test suite.
mlir/utils/performance/tuningRunner.py Ports tuning enhancements: verification timeout, NUMA locking, canonicalization/state handling, debug schema checks, CLI tweaks.
mlir/utils/performance/perfRunner.py Ports canonicalization + DB parsing improvements; updates CLI flags (with backward-compatible aliases).
mlir/utils/performance/perfCommonUtils.py Minor regex literal fix (raw string).
mlir/utils/performance/analysis/quickTuningGen.py Adds GemmGemm/ConvGemm support and kernel-type mapping updates.
mlir/utils/jenkins/Jenkinsfile Updates perfRunner invocation flags to new dashed forms.
mlir/test/perf-scripts/runtime/perfRunner-help.py Updates help-output checks for new dashed flags.
mlir/test/perf-scripts/attention-tuning-db-compat.py Updates read_tuning_db call signature to include config class and fallback params.
.github/workflows/ci.yml Adds a new containerized pytest job for performance scripts.
mlir/utils/performance/tests/test_tuningRunner.py New unit tests for tuningRunner (mock HIP/GPU).
mlir/utils/performance/tests/test_perfRunner.py New unit tests for perfRunner (mock HIP/GPU).
mlir/utils/performance/tests/mock_hip.py New HIP + amd_arch_db mock module for CI environments without ROCm.
mlir/utils/performance/tests/init.py New test package marker and brief description.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mlir/utils/performance/tuningRunner.py Outdated
Comment thread mlir/utils/performance/tuningRunner.py
Comment thread .github/workflows/ci.yml Outdated
Comment thread pip_requirements.txt
Comment thread mlir/utils/performance/perfRunner.py Outdated
Comment thread mlir/utils/performance/perfRunner.py Outdated
@rocmlir-pr-reviewer rocmlir-pr-reviewer Bot removed the modifies-ci-paths PR modifies the Claude review CI security perimeter; audit before applying claude-review label Aug 10, 2026
@erizheng-amd erizheng-amd added the claude-review Request a Claude PR review label Aug 10, 2026
@erizheng-amd
erizheng-amd requested a lite review from Copilot August 10, 2026 20:50
@erizheng-amd

Copy link
Copy Markdown
Collaborator Author

Note for reviewers: I will rebase onto the develop branch after #306 merged.

Copilot AI 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.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.

Suppressed comments (1)

mlir/utils/performance/tuningRunner.py:1112

  • DebugFileWriter currently rejects appending when the column order differs from the existing header, even if the schemas are identical. This can happen when the existing file was produced by a different pandas/Python version (or any code path that emits the same columns in a different order), and it prevents safe resumption even though the data could be re-ordered to match the existing header.

Instead of requiring new_columns == existing_columns, consider treating it as a mismatch only when the column sets differ, and when they match, reindex the DataFrame to existing_columns before writing so appended rows align with the on-disk header.

        df = pd.DataFrame(result.entries)
        new_columns = list(df.columns)
        if self._existing_columns is not None and new_columns != self._existing_columns:
            raise ValueError(
                f"Debug file '{self.filepath}' has a schema that does not match the current "

Comment thread mlir/utils/performance/analysis/quickTuningGen.py
Comment thread mlir/utils/performance/perfRunner.py
@umangyadav umangyadav removed the claude-review Request a Claude PR review label Aug 18, 2026
@erizheng-amd erizheng-amd added the claude-review Request a Claude PR review label Aug 19, 2026
erizheng-amd and others added 2 commits August 24, 2026 20:34
[AIROCMLIR-673] Canonicalize tuningRunner output

Co-authored-by: Cursor <cursoragent@cursor.com>

@bogdan-petkovic bogdan-petkovic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM now

@erizheng-amd
erizheng-amd enabled auto-merge (squash) August 25, 2026 12:59
@erizheng-amd
erizheng-amd merged commit 2b4f6b6 into develop Aug 25, 2026
6 of 8 checks passed
@erizheng-amd
erizheng-amd deleted the eric-1030 branch August 25, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude-review Request a Claude PR review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants