instanceNormalizationPlugin: use public __half2float instead of private __internal_half2float#4819
Draft
pctablet505 wants to merge 1 commit into
Draft
Conversation
…alf2float Both instanceNormalizationPlugin.cu and instanceNormalizationPluginLegacy.cu convert half-precision scale/bias weights to float using __internal_half2float, a private static inline helper defined inside cuda_fp16.hpp rather than part of the public CUDA API. This compiles under nvcc, which brings the helper into scope, but fails under other CUDA-compatible compilers such as clang-CUDA with an undeclared identifier error, and would block a HIP/ROCm port. Wrap the raw bits in a __half_raw and call the public __half2float instead. This performs the same conversion with no change in numeric behavior, but only relies on documented public API. Signed-off-by: pctablet505 <pctablet505@gmail.com>
This file contains hidden or 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
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.
Fixes #4810.
Both
instanceNormalizationPlugin.cuandinstanceNormalizationPluginLegacy.cuconvert half-precision scale/bias weights to float with__internal_half2float, a privatestatic inlinehelper defined insidecuda_fp16.hpprather than part of the public CUDA API. It compiles under nvcc, which brings the helper into scope, but fails under other CUDA-compatible compilers (e.g. clang-CUDA) with an undeclared-identifier error, and would also block a HIP/ROCm port.This wraps the raw bits in a
__half_rawand calls the public__half2floatinstead, which performs the same conversion (verified against all bit patterns of interest — zero, subnormal, normal, infinities). No behavior change under nvcc, just a documented public API instead of a private header internal.