Support any hash constructor in hash_test.cu::check_hash_result
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
调研方向
打开 hash_test.cu,定位 check_hash_result 以及文件中的每个调用点。检查提议的可变参数构造函数接口,将每个 seed 参数移到末尾,然后运行哈希测试,以确认现有结果仍然通过,并且无需 seed 也能完成构造。
由索引模型根据 Issue 内容生成。
描述
I see why you made this: Because we have hash functions that don't take a seed. However, we'll eventually have the `SigBitHash` that takes not a seed but rather a list or a range or whatever.
I think that it would be better to not write a million of these functions. The right way to do it is with a variadic template. Also, you could make that a different PR. The code would look like this:
template <typename Hash, typename... HashConstructorArgs>
static __host__ __device__ bool check_hash_result(typename Hash::argument_type const& key,
typename Hash::result_type expected,
HashConstructorArgs&&... hash_constructor_args) noexcept
{
Hash h(std::forward<HashConstructorArgs>(hash_constructor_args)...);
return (h(key) == expected);
}
The seed is now the last argument so you need to find all occurrences of check_hash_result in this file and make the seed the last argument.
After doing this change, the function will now be compatible with all hash construction.
If you want to read more about std::forward, these are good:
- https://stackoverflow.com/questions/16447951/how-to-forward-variable-number-of-arguments-to-another-function
- https://stackoverflow.com/questions/7257144/when-to-use-stdforward-to-forward-arguments
The short of it is that std::forward written this way with a "universal reference" makes it so that this code works well when:
- you pass in something that has a name, like
check_hash_result(my_key, my_expected, my_seed). (my_seedhas a "name", it's a left-value aka l-value aka something that can be on the left side of an assignment) - you pass in something nameless, like check_hash_result(my_key, my_expected,
12345). (12345has no "name", it's a right-value aka r-value aka something that can not be on the left side of an assignment statement)
When used like this, the compiler will correctly optimize if the value of the seed or whatever is passed in there needs to be copied or moved.
Originally posted by @esoha-nvidia in https://github.com/NVIDIA/cuCollections/pull/514#discussion_r1653534402
- 主要语言
- Cuda
- 星标
- 674
- 派生
- 123
- 平均合并
- 4 天 19 小时
- 30 天内合并 PR
- 10
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NVIDIA/cuCollections 的其他 Issue
-
Add cuco::detail::stream_sync(cuda::stream_ref) to centralize CCCL version-specific API naming可能重新可做 @0z5a 于 28 天前认领,目前没有进行中的 PR。 未关闭
难度 2/5 1-3 小时 新手友好度 74/100
NVIDIA/cuCollections#840 · 1 条评论 ·
维护者通常 2 天内回复
-
nvidia-runners
难度 1/5 1-3 小时 新手友好度 25/100
NVIDIA/cuCollections#853 ·
维护者通常 2 天内回复
-
topic: performance type: feature request
难度 5/5 一周以上 新手友好度 35/100
NVIDIA/cuCollections#817 · 7 条评论 · 1 个 reaction ·
维护者通常 2 天内回复
-
good first issue P2: Nice to have type: improvement
难度 4/5 3-5 天 新手友好度 38/100
NVIDIA/cuCollections#805 · 4 条评论 ·
维护者通常 2 天内回复
-
[FEA] Add MPSC/MPMC concurrent queue可能重新可做 @sleeepyjack 于 267 天前认领,目前没有进行中的 PR。 未关闭type: feature request
NVIDIA/cuCollections#791 · 已指派 1 人 ·
维护者通常 2 天内回复
查看 NVIDIA/cuCollections 的全部 Issue
相似的 Issue
-
StepExamBenchmarkTest runs a loop and prints a timing but asserts nothing可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭jules
难度 1/5 1 小时以内 新手友好度 82/100
open-learning-exchange/myplanet#18199 · 1 条评论 ·
维护者通常 4 天内回复
-
area:core-platform effort:S priority:P3 status:in-review type:test
难度 2/5 1 小时以内 新手友好度 80/100
randomparity/kdive#3246 · 1 条评论 ·
维护者通常 1 天内回复
-
cleanup go hacktoberfest NWO priority: low skill: good first issue status: ready for dev
难度 2/5 1-3 小时 新手友好度 70/100
hyperledger-labs/fabric-smart-client#2135 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
Exa-Networks/exabgp#1436 ·
-
internal
难度 2/5 1-3 小时 新手友好度 70/100
frostney/GocciaScript#1715 ·
维护者通常 1 天内回复