Typo in the addition kernel in muladd.cu
还没有人认领这个 Issue。
评估
调研方向
该错误位于 CUDA 文件 muladd.cu 中的 add_kernel,其逐元素运算是乘法而不是加法。请先阅读该内核,然后在 CUDA 设备上运行 issue 中的 Python 检查,将 ext.ops.myadd_out 与 a+b 进行比较。当 CUDA 输出与 CPU 输出一致且 torch.equal 返回 True 时,即完成。
由索引模型根据 Issue 内容生成。
描述
There is a typo in the add_kernel routine in the CUDA file muladd.cu. I assumed that this kernel should compute the sum of two tensors, but it acually computes the multiplication:
__global__ void add_kernel(int numel, const float* a, const float* b, float* result) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < numel) result[idx] = a[idx] * b[idx];
}
This bug can be tested by running the following python script:
import extension_cpp as ext
import torch
device = 'cuda'
n=100
a = torch.rand(n).to(device)
b = torch.rand(n).to(device)
add2 = torch.zeros(n).to(device)
add1=a+b
ext.ops.myadd_out(a,b,add2)
print(torch.equal(add1,add2))
The CPU implementation gives the correct result (with device="cpu" in the code above).
- 主要语言
- Python
- 星标
- 1.2k
- 派生
- 250
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
pytorch/extension-cpp 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 78/100
pytorch/extension-cpp#82 ·
-
难度 4/5 3-5 天 新手友好度 45/100
pytorch/extension-cpp#124 ·
-
难度 3/5 1-2 天 新手友好度 35/100
pytorch/extension-cpp#123 ·
-
难度 4/5 1-2 天 新手友好度 12/100
pytorch/extension-cpp#121 · 3 条评论 ·
-
难度 3/5 1-2 天 新手友好度 45/100
pytorch/extension-cpp#120 ·
查看 pytorch/extension-cpp 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
hermes hooks doctor smoke test never checks the hook exit code — a crashing hook (exit=1) renders ✓ "ran clean" and "All shell hooks look healthy"可能已有人在做 @cestercian 今天认领。 未关闭comp/cli P2 type/bug
难度 2/5 1-3 小时 新手友好度 75/100
NousResearch/hermes-agent#162259 · 1 条评论 ·
维护者通常 1 天内回复
-
upstream update
难度 2/5 1-3 小时 新手友好度 72/100
conan-io/conan-center-index#31597 ·
维护者通常 1 天内回复
-
bug enhancement
难度 1/5 1 小时以内 新手友好度 90/100
AOSSIE-Org/PictoPy#1802 · 2 条评论 ·
维护者通常 3 天内回复
-
community-request
难度 2/5 1-3 小时 新手友好度 78/100
NVIDIA-NeMo/Run#727 ·
维护者通常 1 天内回复