Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[ENHANCEMENT]: `for_each` on containers without duplicates keeps probing after the match

已关闭 适合新手
#858 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

已经有一个关联 PR 被合并了。

  • #859 来自 @PointKernel —— 已合并

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
cpp
领域
databases

调研方向

从 open_addressing_ref_impl 中标量版和协作版的 for_each 开始,定位到 equal_result::EQUAL 分支,并阅读 allows_duplicates 在那里是如何使用的。拟议的修改会在不允许重复的容器上,于回调之后停止探测,并保持 multiset 和 multimap 路径不变。运行 static_set、static_map、static_multiset 和 static_multimap 测试;测试通过且命中查找变快即完成。

由索引模型根据 Issue 内容生成。

描述

Is your feature request related to a problem? Please describe.

On static_set/static_map, ref.for_each(key, cb) keeps probing after calling cb on the match, up to the next empty slot, although a key is held at most once there (find and contains already stop at the match). Every hit pays for the rest of its cluster:

// static_map<uint64_t, uint64_t> ref with cuco::op::for_each, 64 dependent lookups per thread
for (int i = 0; i < 64; ++i) {
  uint64_t next = ~0ull;
  ref.for_each(key, [&](auto const& slot) { next = slot.second; });
  key = next;
}

RTX 4090, load factor 0.5, 167,936 threads, 2^17 slots: hits take 0.589 ms, 0.226 ms with the change below; misses are unchanged (0.34 ms).

Describe the solution you'd like

End the probe at the match when the container has no duplicates, in the scalar and cooperative for_each of open_addressing_ref_impl:

             case detail::equal_result::EQUAL: {
               callback_op(bucket_slots[i()]);
+              if constexpr (not allows_duplicates) { should_return = true; }  // cooperative: empty = true

The multiset and multimap paths are unchanged. With it the static_set, static_map, static_multiset and static_multimap tests pass (415/415, sm_89).

🤖 Generated with Claude Code

主要语言
Cuda
星标
674
派生
123
平均合并
3 天 9 小时
30 天内合并 PR
10

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

NVIDIA/cuCollections 的其他 Issue

查看 NVIDIA/cuCollections 的全部 Issue

相似的 Issue

更多 Databases Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。