Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script to generate tripy integration test stablehlo ir #490

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jhalakpatel
Copy link
Collaborator

This script can be run periodically (or during CI/CD) to generate Tripy integration test IRs. For now, we generate stablehlo IR but script itself is IR agonistic. This will generate a file test_tripy_integration.py which can be copied to mlir-tensorrt/compiler/test/python/IntegrationTests/test_tripy_integration.py and committed to mitigating Tripy related regressions in MLIR-TensorRT.

Comment on lines +79 to +81
for test_name, asm in test_assemblies.items():
f.write(f' "{test_name}": """{asm}""",\n')

Copy link
Collaborator

Choose a reason for hiding this comment

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

How large is the generated code usually? Wondering if we might need to split them across tests instead of just test files?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have not generated the code for the complete test suit (WIP). I will update once done.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Generated code is about 30k lines and takes around 15 minutes to run end to end in MLIR-TRT. May be we can perform some deduplication i.e. just include first test case in a class. or may be just include a single test per module.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Does a naive deduplication help at all? e.g. just comparing the generated StableHLO textual representation directly

module_match = re.search(r'<Module (.*?)>', relevant_output)
module_name = module_match.group(1) if module_match else ''
class_match = re.search(r'<Class (.*?)>', relevant_output)
class_name = class_match.group(1) if class_match else ''
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This might be incorrect if we have more than one class per module.

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.

2 participants