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

Replace _type with widenconst #429

Merged
merged 4 commits into from
Dec 20, 2024
Merged

Replace _type with widenconst #429

merged 4 commits into from
Dec 20, 2024

Conversation

willtebbutt
Copy link
Member

In my adventures to make everything in #426 work properly, I discovered that the compiler has a function Core.Compiler.widenconst, which is almost exactly what my Mooncake._type function does.

This PR looks at replacing Mooncake's _type functionalitywithwidenconst`, as this is obviously a better thing to do.

There's a slight discrepancy between how CC.widentconst and Mooncake._type handle CC.Conditionals, but I suspect my version is just wrong.

In this PR I've replaced the various methods of _type with a single method that just defers the call to CC.widenconst. This was the quickest way to make a PR and see if it works. If CI passes, I'll remove the _type function entirely, and replace all calls to _type with widenconst before merging.

Copy link

codecov bot commented Dec 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
src/interpreter/abstract_interpretation.jl 83.33% <ø> (+0.28%) ⬆️
src/interpreter/ir_normalisation.jl 90.07% <100.00%> (ø)
src/interpreter/ir_utils.jl 87.50% <100.00%> (ø)
src/interpreter/s2s_reverse_mode_ad.jl 91.63% <100.00%> (+0.01%) ⬆️

Copy link
Contributor

github-actions bot commented Dec 20, 2024

Performance Ratio:
Ratio of time to compute gradient and time to compute function.
Warning: results are very approximate! See here for more context.

┌────────────────────────────┬──────────┬─────────┬─────────────┬─────────┐
│                      Label │ Mooncake │  Zygote │ ReverseDiff │  Enzyme │
│                     String │   String │  String │      String │  String │
├────────────────────────────┼──────────┼─────────┼─────────────┼─────────┤
│                   sum_1000 │     70.0 │     1.0 │        5.61 │    8.21 │
│                  _sum_1000 │     6.69 │  1420.0 │        34.2 │    1.09 │
│               sum_sin_1000 │     2.26 │    1.68 │        10.7 │     2.0 │
│              _sum_sin_1000 │     2.75 │   247.0 │        13.8 │    2.51 │
│                   kron_sum │     80.4 │    10.7 │       309.0 │    10.2 │
│              kron_view_sum │     32.3 │    5.26 │       142.0 │    53.6 │
│      naive_map_sin_cos_exp │      2.5 │ missing │        7.15 │    2.33 │
│            map_sin_cos_exp │     2.74 │    1.52 │        6.13 │    2.91 │
│      broadcast_sin_cos_exp │     2.59 │    2.33 │        1.46 │    2.26 │
│                 simple_mlp │     5.06 │    3.11 │        7.49 │    3.48 │
│                     gp_lml │     13.3 │    6.69 │     missing │    6.56 │
│ turing_broadcast_benchmark │     3.31 │ missing │        24.9 │ missing │
│         large_single_block │     4.03 │  4340.0 │        42.7 │    2.18 │
└────────────────────────────┴──────────┴─────────┴─────────────┴─────────┘

@willtebbutt willtebbutt merged commit 8c478a8 into main Dec 20, 2024
72 checks passed
@willtebbutt willtebbutt deleted the wct/use-widenconst branch December 20, 2024 14:05
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