Skip to content

Add 7 new difftests and push constants support #321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

LegNeato
Copy link
Collaborator

@LegNeato LegNeato commented Jul 4, 2025

I wanted to increase coverage, so I worked with AI to bang out some tests and infra changes.

New tests:

  • bitwise_ops: bit manipulation operations
  • trig_ops: trigonometric functions
  • control_flow_complex: nested loops and complex control flow
  • vector_swizzle: vector component access and swizzling
  • memory_barriers: workgroup memory synchronization
  • vector_extract_insert: dynamic vector element access
  • push_constants: push constants in compute shaders

Infrastructure changes:

  • Add WgpuComputeTestPushConstants for push constant support
  • Enable PUSH_CONSTANTS feature in wgpu when needed

@Firestar99
Copy link
Member

I'd love to have these for testing my const folding in #317

@Firestar99
Copy link
Member

CI Ubuntu reports these failures:
difftests::lang::core::ops::math_ops
difftests::lang::core::ops::matrix_ops
difftests::lang::core::ops::vector_ops

On my machine I get these failures:
difftests::lang::core::ops::math_ops
difftests::lang::core::ops::matrix_ops

Could this be float inaccuracies between vendors?

@LegNeato
Copy link
Collaborator Author

LegNeato commented Jul 4, 2025

Yeah, I think it is floats because they all passed locally after I took care of some existing float issues. I'll take a look and either round or omit.

@LegNeato LegNeato marked this pull request as draft July 5, 2025 16:44
LegNeato added 5 commits July 6, 2025 17:17
New tests:
- bitwise_ops: bit manipulation operations
- trig_ops: trigonometric functions
- control_flow_complex: nested loops and complex control flow
- vector_swizzle: vector component access and swizzling
- memory_barriers: workgroup memory synchronization
- vector_extract_insert: dynamic vector element access
- push_constants: push constants in compute shaders

Infrastructure changes:
- Add WgpuComputeTestPushConstants for push constant support
- Enable PUSH_CONSTANTS feature in wgpu when needed
- Register all existing unregistered tests in workspace
- Add a round macro for cross-plat compat
- Add epsilon-based floating point comparison
- Add human-readable output for float/int data
- Add test coverage for new stuff
- Update documentation
@LegNeato
Copy link
Collaborator Author

LegNeato commented Jul 6, 2025

I added a compat_round! macro that handled most of the differences, but could not get all of them. So I added epsilon support when comparing. And then because I was debugging with python scripts I added better debug output when dealing with f32s. And because I did that I reworked all the output cases to match.

This is a lot of code and I don't really expect you to review it...AI wrote a lot of it and I reviewed and tweaked. I figure we'll iterate on main as it is super self-contained. I can probably break it up if you want though!

As an aside, I think some of these should be runtests, as I am not sure what value we get diffing with glsl for all of them. BTW, if test times get long we can shard in CI as theoretically we could have 1 job for each test as they are unrelated.

@LegNeato LegNeato marked this pull request as ready for review July 6, 2025 15:45
@LegNeato
Copy link
Collaborator Author

LegNeato commented Jul 6, 2025

(note it is not set to automerge as I'll want to squash first)

@LegNeato
Copy link
Collaborator Author

LegNeato commented Jul 7, 2025

Ok, the windows issue is definitely a wgpu + naga (dxc) bug.

@LegNeato
Copy link
Collaborator Author

LegNeato commented Jul 8, 2025

I've pulled out the repo for the wgpu/naga bug: https://github.com/LegNeato/wgpu-workgroup-memory-bug

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.

2 participants