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

Remove unnecessary forward decls from MIR, code-gen appropriately #1298

Merged
merged 7 commits into from
Mar 23, 2023

Conversation

WardBrian
Copy link
Member

Submission Checklist

  • Run unit tests
  • Documentation
    • If a user-facing facing change was made, the documentation PR is here:
    • OR, no user-facing changes were made

Release notes

Closes #1297 and fixes an issue where external functions could not be used in higher-order functions without the end-user supplying an implementation of our functor structs.

This uses code we already had since #1277 to remove "unnecessary" forward decls when we go from AST to MIR. This means all remaining forward decls in the MIR must be for external functions, so we can treat them as such later on.

Copyright and Licensing

By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the BSD 3-clause license (https://opensource.org/licenses/BSD-3-Clause)

@WardBrian WardBrian requested a review from nhuurre March 23, 2023 13:34
@WardBrian WardBrian changed the title Fix/remove unnecessary forward decls mir Remove unnecessary forward decls from MIR, code-gen appropriately Mar 23, 2023
src/stan_math_backend/Lower_functions.ml Outdated Show resolved Hide resolved
src/stan_math_backend/Transform_Mir.ml Outdated Show resolved Hide resolved
test/unit/Optimize.ml Outdated Show resolved Hide resolved
@WardBrian WardBrian requested a review from nhuurre March 23, 2023 14:57
@WardBrian
Copy link
Member Author

Huh, I pushed but my commits haven't shown up here. Odd

test/unit/Optimize.ml Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Mar 23, 2023

Codecov Report

Merging #1298 (5ba584f) into master (a490a09) will increase coverage by 0.05%.
The diff coverage is 92.30%.

❗ Current head 5ba584f differs from pull request most recent head 3732675. Consider uploading reports for the commit 3732675 to get more accurate results

@@            Coverage Diff             @@
##           master    #1298      +/-   ##
==========================================
+ Coverage   89.02%   89.08%   +0.05%     
==========================================
  Files          64       64              
  Lines        9752     9754       +2     
==========================================
+ Hits         8682     8689       +7     
+ Misses       1070     1065       -5     
Impacted Files Coverage Δ
src/middle/Program.ml 64.55% <ø> (ø)
src/stan_math_backend/Transform_Mir.ml 95.07% <88.09%> (+0.01%) ⬆️
src/frontend/Ast_to_Mir.ml 92.23% <100.00%> (+0.01%) ⬆️
src/frontend/Canonicalize.ml 96.45% <100.00%> (-0.17%) ⬇️
src/frontend/Deprecation_analysis.ml 92.30% <100.00%> (+0.55%) ⬆️
src/stan_math_backend/Lower_functions.ml 99.45% <100.00%> (+1.63%) ⬆️

... and 2 files with indirect coverage changes

@WardBrian WardBrian merged commit 655d9e8 into master Mar 23, 2023
@WardBrian WardBrian deleted the fix/remove-unnecessary-forward-decls-mir branch March 23, 2023 18:08
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.

[BUG] --standalone-functions ignores undefined functions (external c++)
2 participants