[PATCH] D123810: [Cuda] Add initial support for wrapping CUDA images in the new driver.
Artem Belevich via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 10 15:58:40 PDT 2022
tra added inline comments.
================
Comment at: clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp:193
+ }
+ static unsigned getHashValue(const OffloadKind &Val) { return Val * 37U; }
+
----------------
jhuber6 wrote:
> tra wrote:
> > Is there a particular reason for multiplying by 37? Enum values by themselves should do the job just fine.
> That's what LLVM does for the regular `DenseMapInfo<uint16_t>::getHashValue()` so I just copied it here.
It would make sense for mapping the full range of uint16_t into a much smaller set of entries. In this case we're already dealing with a very small densely packed set of values. For all practical purposes is a convenient overkill We could get by with just using a vector+direct indexing. We also don't care about hash collisions even if they happen.
Removing multiplication would not make much of a difference, but it would be one less question for the reader to ask, when they look at this code.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123810/new/
https://reviews.llvm.org/D123810
More information about the cfe-commits
mailing list