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

Support u8 and i8 tensors in operator inputs, outputs and model files #345

Merged
merged 5 commits into from
Sep 6, 2024

Conversation

robertknight
Copy link
Owner

This is the first step in adding 8-bit quantization support. It adds support for u8 and i8 tensors in:

  • RTen model files
  • Operator inputs
  • Operator outputs

Int8 support has not been added to most operators yet. Done naively this would require two instantiations of the code for u8 and i8 tensors even though many operators could use the same code for both. This could be addressed with #244. For the moment I am adding support for i8 and u8 tensors to operators on an as-needed basis.

In preparation for adding new int tensor types, rename the existing ones to
specify the size.
This will make adding new input types easier.
Initially these are not supported by any operators. They can only be created and
passed around as graph constants and values.
When adding a new tensor, the returned offset was the end of the previous tensor
instead of the start of the new tensor. These offsets may differ if padding
bytes are added for alignment. The problem went unnoticed before because all the
supported data types had the same size (32bit), and that has now changed.
@robertknight robertknight merged commit 3d50c14 into main Sep 6, 2024
2 checks passed
@robertknight robertknight deleted the rten-model-u8i8 branch September 6, 2024 06:59
@robertknight robertknight mentioned this pull request Sep 6, 2024
10 tasks
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.

1 participant