[Bugfix][feat]: add support for fp16 and bf16 dtype aliases for collective operations.
#46
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.
Problem
Running perftest with
-d fp16or-d bf16fails with:Root Cause
collective_on_bufferconstructs binding function names using the user-provided dtype directly (e.g.,fp16_sum_reduce_on_stream), but the actual bindings use:halffor fp16bfloat16for bf16Solution
Added a dtype alias mapping in
nvshmem4py/nvshmem/core/collective.pyto normalize user-friendly shorthand names to their binding-compatible equivalents:fp16→halfbf16→bfloat16Changes
nvshmem4py/nvshmem/core/collective.py: Added adtype_aliasesdict and applied normalization before constructing binding function names.Testing
fp16
Command:
Former error:
Now:
bf16
Command:
Former error:
Now:
Known Issue (Out of Scope)
The following dtypes are listed in the perftest argument parser choices but have no corresponding bindings:
ulonglong— missingulonglong_*_reduce_on_streambindingsptrdiff— missingptrdiff_*_reduce_on_streambindingsThese will fail at runtime if used. Consider adding bindings or removing these from the supported choices in a future PR.
Dtype Compatibility Analysis