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

Adds verify utility for kernels #31

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

Conversation

manupak
Copy link
Contributor

@manupak manupak commented Nov 7, 2024

This is a helper script verify
e2e numerical equivalence of
two MLIR programs.

This is a helper script verify
e2e numerical equivalence of
two MLIR programs.
@manupak
Copy link
Contributor Author

manupak commented Nov 7, 2024

Im looking for a place to park this script.
Since it was quite handy to use exisiting utility here to get the script working, I thought this might be a good place. Do let me know.

This would allow us to compare two MLIR programs -- numerically.

"--device_allocator=caching",
f"--module={vmfb_file}",
"--function=main",
f"--input=@{inputs[0].name}",
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems hardcoded for 3 inputs for attention. Want to generalize that?

import argparse
from utils import *

def compile_attention_mlir_file(mlir_file : str, target_device: str, hip_target: str, extra_flags: list):
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 change to just compile_mlir_file

return vmfb_file

def get_output_npy(vmfb_file : str, inputs : List[str], target_device: str):
with tempfile.NamedTemporaryFile(suffix='.npy', delete=False) as out:
Copy link
Contributor

Choose a reason for hiding this comment

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

We usually use bin files for validation. (We've actually noticed a difference between the two in some special cases 😄). Want to change to bin?

@saienduri
Copy link
Contributor

Yeah this would definitely be helpful and seems like a good spot for it to go

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