Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update numba/cuda/cudadecl.py
Use fleshed out comment description suggested by @gmarkall

Co-authored-by: Graham Markall <535640+gmarkall@users.noreply.github.com>
  • Loading branch information
testhound and gmarkall authored Jul 21, 2022
commit 8be1d0c9c2d4290880e3605c625c9c53495572e6
16 changes: 12 additions & 4 deletions numba/cuda/cudadecl.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,18 @@ class Cuda_fp16_cmp(ConcreteTemplate):
return Cuda_fp16_cmp


# Until issue 7863 is resolved, if multiple concrete templates are utilized
# function resolution will pick the wrong implementation and errors will occur.
# We avoid this by using ConcreteTempalte for the intrinisics and
# AbstractTemplate
# If multiple ConcreteTemplates provide typing for a single function, then
# function resolution will pick the first compatible typing it finds even if it
# involves inserting a cast that would be considered undesirable (in this
# specific case, float16s could be cast to float32s for comparisons).
#
# To work around this, we instead use an AbstractTemplate that implements
# exactly the casting logic that we desire. The AbstractTemplate gets
# considered in preference to ConcreteTemplates during typing.
#
# This is tracked as Issue #7863 (https://github.com/numba/numba/issues/7863) -
# once this is resolved it should be possible to replace this AbstractTemplate
# with a ConcreteTemplate to simplify the logic.
def _genfp16_comparison_operator(l_key):
@register_global(l_key)
class Cuda_fp16_operator_cmp(AbstractTemplate):
Expand Down