Skip to content

Commit

Permalink
Fix bug in sinking.
Browse files Browse the repository at this point in the history
  • Loading branch information
athas committed Feb 3, 2025
1 parent f2de3ed commit 7ad26ab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

* `futhark fmt`: correct file name in parse errors.

* A bug in the "sink" optimisation pass could cause compiler crashes.

## [0.25.26]

### Fixed
Expand Down
11 changes: 11 additions & 0 deletions tests/sinking6.fut
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- At one point this did an incorrect sinking due to not looking
-- properly at WithAccs.

def pointToRoller (model: [2]f32) (p: f32) : f32 =
let radius = model[0]
let alpha = model[1]
let p' = map (p *) [f32.sin alpha, 0.0]
in (p'[0] - radius) ** 2

entry pointsToRollerGrad [n] (model: [2]f32) (pcd: [n]f32) : [2]f32 =
vjp (\m -> map (pointToRoller m) pcd |> f32.sum) model 1

0 comments on commit 7ad26ab

Please sign in to comment.