Discussion: Should functions in lowpp layer be `def` rather than `cpdef`?
维护者通常 1 天内回复
@mdboom 已经在做这个了。
开始于 2026年9月24日。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 重构
- 描述清晰度
- 需要澄清
- 活跃度
- 活跃
- 领域
- backend
调研方向
首先定位 lowpp 层中的函数,并审查它们如何向 Cython 和 Python 公开。将现有的 cpdef 行为与所述的 .pyi 和性能约束进行比较,然后查看讨论以确认是否已有决定。项目就是否应保留 Cython 公开达成一致后,即视为完成;该 issue 未指出具体的文件或测试。
由索引模型根据 Issue 内容生成。
描述
Functions in the lowpp layer are currently declared with cpdef, so they are exposed to both Cython and Python. However, we have always claimed that the Cython interface is not stable, and shouldn't be relied on.
A couple discoveries today are making me wonder whether we want to keep exposing the lowpp layer to Cython at all:
- Calling a
cpdeffunction from Python has an additional 50ns of overhead vs. adeffunction (the Python layer delegates to an underlying layer and there is additional work done at that boundary). cpdeffunctions can not have their return type annotated, which is a blocker for proper.pyisupport for the lowpp layer.
Is Cython access at the lowpp layer providing any value here? Could we just s/cpdef/def/g and get more performance and a more Pythonic experience?
- 主要语言
- Cython
- 星标
- 3.4k
- 派生
- 334
- 平均合并
- 1 天 18 小时
- 30 天内合并 PR
- 143
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NVIDIA/cuda-python 的其他 Issue
-
triage
难度 2/5 1-3 小时 新手友好度 84/100
NVIDIA/cuda-python#2952 ·
维护者通常 1 天内回复
-
[DOC]: cuda.core 1.1.1 note misstates program cache permissions可能已有人在做 @leofang 于 13 天前认领。 未关闭documentation P1
难度 1/5 1 小时以内 新手友好度 88/100
NVIDIA/cuda-python#2717 · 已指派 1 人 ·
维护者通常 1 天内回复
-
[DOC]: `PinnedMemoryResource.allocate` documents no parameters可能已有人在做 @Andy-Jost 于 13 天前认领。 未关闭cuda.core documentation P1
难度 1/5 1-3 小时 新手友好度 90/100
NVIDIA/cuda-python#2712 · 已指派 1 人 ·
维护者通常 1 天内回复
-
[BUG]: LocatedHeaderDir is mutable, so callers can poison the cached header-directory lookup可能已有人在做 @rwgk 于 13 天前认领。 未关闭triage
难度 2/5 1-3 小时 新手友好度 82/100
NVIDIA/cuda-python#2646 · 1 个 reaction ·
维护者通常 1 天内回复
-
[FEA]: Support inheritance from Buffer可能已有人在做 @leofang 于 13 天前认领。 未关闭cuda.core triage
难度 2/5 1-3 小时 新手友好度 62/100
NVIDIA/cuda-python#2435 · 1 条评论 ·
维护者通常 1 天内回复
查看 NVIDIA/cuda-python 的全部 Issue
相似的 Issue
-
Bug Enhancement Performance
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
needs-triage
难度 2/5 1-3 小时 新手友好度 70/100
flashinfer-ai/flashinfer#6212 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
zenstackhq/zenstack#2873 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
activescott/lessmsi#306 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
Jason-Vaughan/TangleClaw#2195 ·
维护者通常 1 天内回复