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

Implement ConvInteger operator #566

Merged
merged 3 commits into from
Feb 3, 2025
Merged

Implement ConvInteger operator #566

merged 3 commits into from
Feb 3, 2025

Conversation

robertknight
Copy link
Owner

@robertknight robertknight commented Jan 31, 2025

Implement the ConvInteger operator.

This follows the implementation of Conv for f32, with the addition of zero point inputs and the removal of the bias input.

In the process fix handling of padding elements in int8 im2col packing when conversion from i8 -> u8 is enabled.

TODO:

  • Implement depthwise convolution
  • Decide which int8 formats to support and implement necessary conversions. This PR currently implements input=i8, weights=u8 because that conveniently maps to the already supported u8 x i8 -> i32 GEMM support, but this is not a super useful combination. ORT only supports input=u8, weights=u8 and there are issues open to support input=u8, weights=i8.
  • Benchmark
  • Decide what to do on x64 systems if ConvInteger weights are not in the safe range (i7/u7). Validate weights at load time? (deferred to Improve handling of weights with a non-reduced range in ConvInteger #574)

@robertknight robertknight force-pushed the conv-integer branch 10 times, most recently from 4270f88 to 29a7121 Compare February 3, 2025 08:08
Implement the ConvInteger operator for all combinations of int8 input
signed-ness, with the caveat that combinations other than (input=int8,
weights=uint8) will result in a shift-conversion of the input and/or weights to
`input=int8`, `weights=uint8` which maps to the currently supported GEMM
kernels.

Depthwise convolution for int8 uses a naive conversion of the f32 depthwise
kernel and both have significant room for optimization.
@robertknight robertknight marked this pull request as ready for review February 3, 2025 08:55
@robertknight robertknight merged commit e48df48 into main Feb 3, 2025
2 checks passed
@robertknight robertknight deleted the conv-integer branch February 3, 2025 08:55
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