u64 with `trailing_zeros` returns incorrect values
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- rust
调研方向
首先跟踪编译 shader 时使用的 u64 trailing_zeros() 入口点,并将其行为与 Rust 标准库实现进行比较。使用列出的三个 u64 值运行 shader 复现,并添加或使用覆盖结果 0、32 和 63 的测试。完成的标准是所有示例都返回预期的末尾零位数量。
由索引模型根据 Issue 内容生成。
描述
Expected Behaviour
We expect the trailing_zeros() function on u64 values to match the behavior of Rust's standard library implementation, returning the count of trailing zero bits.
For example:
0x0000000000000001_u64.trailing_zeros()should return 00x0000000100000000_u64.trailing_zeros()should return 320x8000000000000000_u64.trailing_zeros()should return 63
Example & Steps To Reproduce
0x0000000000000001Expected: 0, Result: 320x0000000100000000Expected: 32, Result: 00x8000000000000000Expected: 63, Result: 31
Run a shader that calculates trailing zeros on a u64. I am creating a pull request that contains test to validate the function and a fix for this issue.
#![no_std]
use spirv_std::spirv;
#[spirv(compute(threads(1)))]
pub fn main_cs(
#[spirv(storage_buffer, descriptor_set = 0, binding = 0)] output: &mut [u32],
) {
// Expected: 0, Actual: 32
output[0] = 0x0000000000000001_u64.trailing_zeros();
// Expected: 32, Actual: 0
output[1] = 0x0000000100000000_u64.trailing_zeros();
}
- 主要语言
- Rust
- 星标
- 3.4k
- 派生
- 126
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Rust-GPU/rust-gpu 的其他 Issue
-
enhancement
难度 1/5 1 小时以内 新手友好度 68/100
-
enhancement
-
bug
难度 4/5 3-5 天 新手友好度 48/100
-
bug
难度 3/5 1-2 天 新手友好度 48/100
-
bug
难度 4/5 3-5 天 新手友好度 48/100
查看 Rust-GPU/rust-gpu 的全部 Issue
相似的 Issue
-
risk:low runtime status:in-progress type:test
难度 1/5 1 小时以内 新手友好度 92/100
zeroclaw-labs/zeroclaw#11023 ·
-
good first issue refactor
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
难度 2/5 1-3 小时 新手友好度 84/100
-
难度 1/5 1 小时以内 新手友好度 72/100
bevyengine/bevy#25861 ·