Skip to content

Comments

Add failing test for fmod autodiff gradient bug (#10071)#10072

Open
rkoivunen-sw wants to merge 1 commit intoshader-slang:masterfrom
rkoivunen-sw:test/fmod-autodiff-gradient
Open

Add failing test for fmod autodiff gradient bug (#10071)#10072
rkoivunen-sw wants to merge 1 commit intoshader-slang:masterfrom
rkoivunen-sw:test/fmod-autodiff-gradient

Conversation

@rkoivunen-sw
Copy link

Adds failing test for #10071

The test verifies fmod(x, y) backward-mode autodiff gradient w.r.t. y. Currently returns 0, should return -floor(x/y).

This test will fail CI until the bug is fixed.

Expected output:

type: float
-2.000000  <- d/dy (currently wrong: 0)
1.000000   <- d/dx (correct)
1.500000   <- primal (correct)

@rkoivunen-sw rkoivunen-sw requested a review from a team as a code owner February 18, 2026 21:18
@coderabbitai
Copy link

coderabbitai bot commented Feb 18, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

A new regression test for backward-mode automatic differentiation of the fmod operation is added to the Slang test suite, consisting of a compute shader test and its expected output file.

Changes

Cohort / File(s) Summary
Test Implementation
tests/autodiff/fmod-backward-diff.slang
New test file verifying backward-mode autodiff for fmod operation. Includes a differentiable test function, compute kernel with differential pair construction, and backward differentiation invocation via __bwd_diff. Expected derivatives documented as comments.
Test Expectations
tests/autodiff/fmod-backward-diff.slang.expected.txt
New expected output file containing float type values and numerical results from the fmod backward-diff test execution.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A fmod test hops into the fold,
Backward diff derivatives taking hold,
dx and dy dance in harmony,
Regression caught, now safe and free! 🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a failing test for a specific autodiff bug with issue reference.
Description check ✅ Passed The description is directly related to the changeset, explaining the test's purpose, expected vs current behavior, and expected output.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant