Skip to content
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

Interchange histogram with inner maps during reverse AD #2031

Merged
merged 9 commits into from
Oct 25, 2023

Conversation

nhey
Copy link
Member

@nhey nhey commented Oct 12, 2023

Implementation of the ISWIM/IRWIM rewrite rule for reverse mode AD on histograms. Programs like the following enjoy significant speed-ups.

-- ==
-- entry: vecmul vecmin
-- compiled random input { [10000000]i64 [10000000][30]f32 [50000][30]f32 }

entry vecmul [n][d][bins] (is: [n]i64) (vs: [n][d]f32) (adj_out: [bins][d]f32) =
  vjp (hist (map2 (*)) (replicate d 1f32) bins is) vs adj_out

entry vecmin [n][d][bins] (is: [n]i64) (vs: [n][d]f32) (adj_out: [bins][d]f32) =
  vjp (hist (map2 f32.min) (replicate d f32.highest) bins is) vs adj_out

@nhey nhey marked this pull request as draft October 12, 2023 11:37
@nhey
Copy link
Member Author

nhey commented Oct 12, 2023

Tests also fail locally; I must've run them with the wrong compiler before creating this PR.

nhey added 4 commits October 12, 2023 15:55
Revert "Remove debug tracing."

This reverts commit bfe3d93.

More debug printing.
@nhey nhey marked this pull request as ready for review October 24, 2023 15:14
@athas athas added the run-benchmarks Makes GA run the benchmark suite. label Oct 25, 2023
@athas athas merged commit 65e8df9 into diku-dk:master Oct 25, 2023
34 of 35 checks passed
CKuke pushed a commit to CKuke/futhark-seq that referenced this pull request Nov 8, 2023
Also fixes a bug in code generation for segmented intra-group SegHists
requiring spinlocks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run-benchmarks Makes GA run the benchmark suite.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants