Skip to content

Conversation

@dorde-antic
Copy link
Contributor

@dorde-antic dorde-antic commented Oct 23, 2025

Motivation

Last version of the script didn't support GEMM+GEMM and CONV+GEMM configs and didn't support incomplete configs.

Resolves https://github.com/ROCm/rocMLIR-internal/issues/2084

Technical Details

  1. Doesn't use perfRunner's fromCommandLine since we sometimes obtain incomplete configurations.
  2. Introduces support for GEMM+GEMM and CONV+GEMM configs.

Test Plan

Locally

Test Result

Submission Checklist

help="Path to the file containing existing convolution configurations")
parser.add_argument("--gemm", type=str, default=None,
help="Path to the file containing existing GEMM configurations")
parser.add_argument("--gemmgemm", type=str, default=None,
Copy link
Contributor

Choose a reason for hiding this comment

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

let's keep it consistent with rocmlir-gen, gemm_gemm

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do we want to change tier1-gemmgemm-configs to tier1-gemm_gemm-configs as well (same for conv_gemm file)? @dhernandez0

help="Path to the file containing existing GEMM configurations")
parser.add_argument("--gemmgemm", type=str, default=None,
help="Path to the file containing existing GEMM_GEMM configurations")
parser.add_argument("--convgemm", type=str, default=None,
Copy link
Contributor

Choose a reason for hiding this comment

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

conv_gemm


return configs

def detectConfigType(config) -> Optional[str]:
Copy link
Contributor

Choose a reason for hiding this comment

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

can we return Operation here? (perfCommonUtils.py)

return configs

def detectConfigType(config) -> Optional[str]:
"""Detect config type: returns 'conv', 'gemm', or 'attention'."""
Copy link
Contributor

Choose a reason for hiding this comment

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

update or just don't specify conv, gemm, ...

@umangyadav umangyadav requested a review from Copilot October 23, 2025 13:08
Copy link
Contributor

Copilot AI left a comment

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 extends the configuration handling script to support GEMM+GEMM and CONV+GEMM configurations, and simplifies the deduplication logic by removing canonical form conversions that required complete configurations.

Key changes:

  • Added detection and handling for GEMM+GEMM and CONV+GEMM configuration types
  • Removed canonicalization logic that depended on fromCommandLine, enabling support for incomplete configurations
  • Switched from error to warning when encountering unrecognized config types

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@dorde-antic dorde-antic requested a review from Copilot October 29, 2025 12:16
Copy link
Contributor

Copilot AI left a comment

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 1 out of 1 changed files in this pull request and generated 1 comment.


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

@dorde-antic dorde-antic requested a review from Copilot October 29, 2025 12:23
Copy link
Contributor

Copilot AI left a comment

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 1 out of 1 changed files in this pull request and generated 2 comments.


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

existing_conv = load_existing_configs(conv_configs)
existing_gemm = load_existing_configs(gemm_configs)
existing_gemm_gemm = load_existing_configs(gemm_gemm_configs)
existing_conv_gemm = load_existing_configs(conv_gemm_configs)
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

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

Variable name mismatch: the function receives 'conv_gemm_config' (singular) from resolve_paths on line 172, but attempts to use 'conv_gemm_configs' (plural) here. This will cause a NameError at runtime.

Copilot uses AI. Check for mistakes.
_append_configs(conv_configs, new_conv)
_append_configs(gemm_configs, new_gemm)
_append_configs(gemm_gemm_configs, new_gemm_gemm)
_append_configs(conv_gemm_configs, new_conv_gemm)
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

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

Variable name mismatch: attempting to use 'conv_gemm_configs' (plural), but the variable defined on line 172 is 'conv_gemm_config' (singular). This will cause a NameError at runtime.

Copilot uses AI. Check for mistakes.
@dorde-antic dorde-antic requested a review from Copilot October 29, 2025 14:14
Copy link
Contributor

Copilot AI left a comment

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 1 out of 1 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (2)

mlir/utils/performance/handleNewConfigs.py:39

  • These global variables ARCH, CHIP, and NUM_CU are defined but no longer used after removing the canonicalization functions. Consider removing these unused global variables and their corresponding imports if they serve no other purpose in the module.
ARCH = get_arch()
CHIP = get_chip()
NUM_CU = get_num_cu(CHIP)

mlir/utils/performance/handleNewConfigs.py:49

  • The function read_non_empty_lines is no longer called anywhere in the code after refactoring the main loop to directly read from the file. Consider removing this unused function.
def read_non_empty_lines(path: str) -> list[str]:
    if not os.path.exists(path):
        print(f"Error: {path} does not exist")
        sys.exit(-1)
    with open(path, "r") as f:
        return [line.strip() for line in f if line.strip() and not line.strip().startswith("#")]

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

new_conv_gemm.append(config)
existing_conv_gemm.add(config)
else:
print(f"Warning: Could not determine config type for: {config}")
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

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

The message severity changed from 'Error' to 'Warning', but the handling remains the same (just logs and continues). The previous version would print an error and continue, which was effectively a warning. While 'Warning' is more accurate, consider whether unrecognized configs should cause the script to fail (return non-zero exit code) or at least be tracked and reported in the final summary to ensure visibility of potential issues.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

Copy link

Copilot AI commented Oct 29, 2025

@dorde-antic I've opened a new pull request, #2075, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits October 29, 2025 15:56
* Initial plan

* Track and report unrecognized configs with non-zero exit code

Co-authored-by: dorde-antic <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: dorde-antic <[email protected]>
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.

3 participants