Skip to content

fix: IRType.erased.isObj should be true - #9433

Closed
zwarich wants to merge 2 commits into
leanprover:masterfrom
zwarich:erased-tobject
Closed

zwarich wants to merge 2 commits into
leanprover:masterfrom
zwarich:erased-tobject

Conversation

@zwarich

@zwarich zwarich commented Jul 18, 2025

Copy link
Copy Markdown
Contributor

This PR changes IRType.isObj to return true for erased. This is correct because when erased is forced to have a runtime representation, it is a tagged scalar.

This has a side effect of allowing erased parameters to be marked borrowed, which fixes correctness problems where relevant data is passed for an erased parameter.

@zwarich zwarich added the changelog-no Do not include this PR in the release changelog label Jul 18, 2025
@zwarich
zwarich requested a review from leodemoura as a code owner July 18, 2025 21:09
@zwarich

zwarich commented Jul 18, 2025

Copy link
Copy Markdown
Contributor Author

!bench

@leanprover-bot

Copy link
Copy Markdown
Collaborator

Here are the benchmark results for commit 12f920e.
There were significant changes against commit 5cd5885:

  Benchmark          Metric                Change
  ========================================================
- iterators          branches                1.2% (68.3 σ)
- iterators          instructions            1.2% (74.7 σ)
- libleanshared.so   binary size             1.8%
- stdlib             grind canon             2.5% (57.8 σ)
- stdlib size        bytes .ir               2.1%
- stdlib size        max dynamic symbols     3.2%
- tests/compiler     sum binary sizes        3.3%

@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Jul 18, 2025
@ghost

ghost commented Jul 18, 2025

Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 5cd5885da4a46ba6f55da77e98c8f95c2af51470 --onto cdab726e3d289b80860ae9f5a7de21d990c8b95f. You can force Mathlib CI using the force-mathlib-ci label. (2025-07-18 21:52:04)

@leanprover-bot

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 5cd5885da4a46ba6f55da77e98c8f95c2af51470 --onto d3dda9f6d4428a906c096067ecb75e432afc4615. You can force reference manual CI using the force-manual-ci label. (2025-07-18 21:52:06)

@zwarich

zwarich commented Jul 18, 2025

Copy link
Copy Markdown
Contributor Author

!bench

@zwarich

zwarich commented Jul 18, 2025

Copy link
Copy Markdown
Contributor Author

I was hoping to do more followup patches to avoid generating more code for erased, but due to these code size regressions it seems I'll need to do them first before landing this.

@leanprover-bot

Copy link
Copy Markdown
Collaborator

Here are the benchmark results for commit f703e77.
There were significant changes against commit 5cd5885:

  Benchmark          Metric                       Change
  =================================================================
- bv_decide_mod      task-clock                     2.8%   (21.8 σ)
- bv_decide_mod      wall-clock                     2.7%  (425.9 σ)
- iterators          branches                       1.2%   (48.1 σ)
- iterators          instructions                   1.2%   (50.7 σ)
- libleanshared.so   binary size                    1.8%
+ riscv-ast.lean     wall-clock                    -7.8%  (-50.2 σ)
+ stdlib             let-to-have transformation    -4.2% (-169.3 σ)
- stdlib size        bytes .ir                      2.1%
- stdlib size        max dynamic symbols            3.2%
- tests/compiler     sum binary sizes               3.3%

@zwarich

zwarich commented Jul 20, 2025

Copy link
Copy Markdown
Contributor Author

This causes code bloat no matter how I try to slice it, and thus is probably not the right solution to the problem I was having.

@zwarich zwarich closed this Jul 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-no Do not include this PR in the release changelog toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants