Skip to content

Fixes #9283 : firstLeadingBit returns signed semantics result instead…#9299

Merged
teoxoy merged 4 commits intogfx-rs:trunkfrom
39ali:firstLeadingBit
Mar 26, 2026
Merged

Fixes #9283 : firstLeadingBit returns signed semantics result instead…#9299
teoxoy merged 4 commits intogfx-rs:trunkfrom
39ali:firstLeadingBit

Conversation

@39ali
Copy link
Contributor

@39ali 39ali commented Mar 25, 2026

… of unsigned for u32 input 0xFFFFFFFF on Metal backend

Connections
Fixes #9283

Description
fixes a small logic bug between u32 and i32 in firstLeadingBit

Testing
ran all tests

Squash or Rebase?

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy --tests. If applicable, add:
    • --target wasm32-unknown-unknown
  • Run cargo xtask test to run tests.
  • If this contains user-facing changes, add a CHANGELOG.md entry.

@teoxoy
Copy link
Member

teoxoy commented Mar 25, 2026

The snapshots need to be regenerated.
Also, is there a CTS test we could enable for this?

@andyleiserson
Copy link
Contributor

There is a CTS test, webgpu:shader,validation,expression,call,builtin,firstLeadingBit:*. To me it looks like it does cover this case, but it's not failing either before or after this change, which is odd. (There is one failure unrelated to this fix prior to #9262.)

You can run it with:

cargo xtask cts 'webgpu:shader,validation,expression,call,builtin,firstLeadingBit:*'

@39ali
Copy link
Contributor Author

39ali commented Mar 26, 2026

@andyleiserson i was gonna checkout why but the cts cmd needs some fixing on macos

panicked at xtask/src/util.rs:91:52:git --versiondid not have the expected structure: failed to parse version number 2 ("3 (Apple Git-146)") asu8

@teoxoy
Copy link
Member

teoxoy commented Mar 26, 2026

I think webgpu:shader,validation,expression,call,builtin,firstLeadingBit:* should be passing, this should be tested by the execution test instead: webgpu:shader,execution,expression,call,builtin,firstLeadingBit:*.

Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good!

@teoxoy
Copy link
Member

teoxoy commented Mar 26, 2026

Could you addd webgpu:shader,execution,expression,call,builtin,firstLeadingBit:* to the list of passing tests? And I will merge this.

@teoxoy
Copy link
Member

teoxoy commented Mar 26, 2026

Thanks!

@teoxoy teoxoy merged commit a071a4d into gfx-rs:trunk Mar 26, 2026
58 checks passed
@andyleiserson
Copy link
Contributor

I was reading the source for the execution test but running the validation test. 🫠

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

firstLeadingBit returns signed semantics result instead of unsigned for u32 input 0xFFFFFFFF on Metal backend

3 participants