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
Rounding Convert and ConvertSat added. #1068
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JanuszL
approved these changes
Jul 11, 2019
!build |
CI MESSAGE: [810254]: BUILD STARTED |
JanuszL
approved these changes
Jul 11, 2019
CI MESSAGE: [810254]: BUILD PASSED |
Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
szalpal
reviewed
Jul 12, 2019
* Add ./include to directory list processed by Doxygen. Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
!build |
Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
CI MESSAGE: [811538]: BUILD STARTED |
CI MESSAGE: [811541]: BUILD STARTED |
CI MESSAGE: [811541]: BUILD PASSED |
szalpal
approved these changes
Jul 12, 2019
haoxintong
pushed a commit
to haoxintong/DALI
that referenced
this pull request
Jul 16, 2019
* Rounding Convert and ConvertSat added. * Add a Converter helper class to avoid excessive number of `enable_if`s. * Add documentation for `Convert[Sat][Norm]` function family. * Add ./include to directory list processed by Doxygen. Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Michal Zientkiewicz michalz@nvidia.com
Why we need this PR?
What happend in this PR?
Convert
andConvertSat
cuda_round_helper
and use intrinsic functions for rounding conversion.Converter
class to avoid excessive number ofenable_if
variants ofConvert[Norm][Sat]
.Converter
Usage:
Convert<OutputType, [InputType]>(value)
- converts value from (possibly inferred) InputType to OutputType, rounding if necessaryConvertNorm<OutputType, [InputType]>(value)
- converts value from (possibly inferred) InputType to OutputType, rounding if necessary and normalizing range.Range normalization rules:
ConvertSat<OutputType, [InputType]>(value)
- converts value and clamp it to the range ofOutputType
ConvertSatNorm<OutputType, [InputType]>(value)
- scale value from input to output type, with appropriate clamping.With normalization, clamping is not necessary when converting:
These cases are recognized and handled efficiently.
Clamping is still necessary when converting unsigned to signed integers and floating point values to integers.