-
Notifications
You must be signed in to change notification settings - Fork 37
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 functions that prepare tensors as input args for IREE tools #418
Conversation
2a159db
to
2c5eb6e
Compare
2c5eb6e
to
8979355
Compare
8979355
to
680995d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, having more helper functions in the installable tools will be great. I'd love to have enough of these utils available for test suites too, so we don't constantly rewrite them downstream:
680995d
to
21ba9a8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Please resolve the DCO check
One drawback of using npy files is that they don't support some datatypes. This change adds functionality to prepare arguments from Torch tensors in the form --input=1x2xbf16=@arg0.bin These can then be passed to tools like iree-run-module and iree-benchmark-module. Signed-off-by: Boian Petkantchin <boian.petkantchin@amd.com>
528d5fd
to
6930b12
Compare
"""Write the raw contents of tensors to files without any metadata. | ||
Returns the CLI input args description. | ||
|
||
If file_path_prefix is given, will chose a default naming for argument files. | ||
It is treated as a string prefix and not as directory. | ||
Example: | ||
``` | ||
file_path_prefix="/some/path/arg" | ||
``` | ||
|
||
returns | ||
``` | ||
[ | ||
"1x2x3xf32=@/some/path/arg0.bin", | ||
"4x5xi8=@/some/path/arg1.bin" | ||
] | ||
``` | ||
|
||
This results can be prefixed with "--input=" to arrive at the final CLI flags | ||
expected by IREE tools. | ||
|
||
Exactly one of file_paths and file_path_prefix must be provided. | ||
Does not create parent directory(s). | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI this did not format correctly on the website: https://iree-turbine.readthedocs.io/en/latest/core/support.html#iree.turbine.support.tools.iree_tool_prepare_input_args
One drawback of using npy files is that they don't support some datatypes.
This change adds functionality to prepare arguments from Torch tensors in the form
--input=1x2xbf16=@arg0.bin
These can then be passed to tools like iree-run-module and iree-benchmark-module.