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

feat: implement -o flags for disabling optimizations #5385

Merged
merged 25 commits into from
Jan 20, 2024

Conversation

kayagokalp
Copy link
Member

@kayagokalp kayagokalp commented Dec 12, 2023

Description

This PR implements -o flags so that we can disable optimizations. This will be useful as we are working towards debugger support and optimizations pollute source map generated.

Provide option to the e2e test binary to specify build profile. For tests that have their ABI tested, or rely on their compiled
hashes (for deployment), since that changes with build profile, the tests are marked as unsupported for debug profile.
(better to test with and have expected results for release than the debug profile).

Add testing release profile in CI since the default is now debug. Two tests in should_fail that are expected to fail due to
overflows are disabled because there's a bug in our IR gen. A new Issue will be opened for this.

@kayagokalp kayagokalp added enhancement New feature or request compiler General compiler. Should eventually become more specific as the issue is triaged forc forc-pkg Everything related to the `forc-pkg` crate. labels Dec 12, 2023
@kayagokalp kayagokalp self-assigned this Dec 12, 2023
@kayagokalp
Copy link
Member Author

After discussing it with @vaivaswatha, this is blocked as some optimizations are currently needed for producing correct output, so we cannot directly chug them depending on the o flag, we will have to be more careful about that.

@kayagokalp kayagokalp added the compiler: ir IRgen and sway-ir including optimization passes label Dec 15, 2023
@vaivaswatha vaivaswatha self-assigned this Jan 1, 2024
@vaivaswatha
Copy link
Contributor

vaivaswatha commented Jan 4, 2024

@kayagokalp I've updated the PR to disable as many optimizations as possible on -O0 (which is the default path). Can you check if the location information has improved for you with this?

The testsuite mostly passes. The ones failing are related to changed ABIs or checksums (for deployment ones).

This brings us to the task of supporting two paths in our testsuite, i.e., testing both -O0 and -O1, which I believe should be part of this PR. We can get to it after you confirm that disabling some of these optimizations indeed did help you.

@kayagokalp
Copy link
Member Author

Thanks for the help @vaivaswatha I will be reporting before and after changes here today 🙌

For tests that have their ABI tested, or rely on their compiled
hashes (for deployment), since that changes with build profile,
the tests are marked as unsupported for debug profile.
(better to test with and have expected results for release
than the debug profile).

Add testing release profile in CI since the default is now debug.

Two tests in `should_fail` that are expected to fail due to
overflows are disabled because there's a bug in our IR gen.
A new Issue will be opened for this.
@vaivaswatha
Copy link
Contributor

Thanks for the help @vaivaswatha I will be reporting before and after changes here today 🙌

@kayagokalp does having fewer optimizations improve the quality of source location information?

@vaivaswatha vaivaswatha marked this pull request as ready for review January 18, 2024 12:05
@vaivaswatha vaivaswatha requested a review from a team January 18, 2024 14:04
.github/workflows/ci.yml Outdated Show resolved Hide resolved
forc-pkg/src/manifest.rs Outdated Show resolved Hide resolved
sdankel
sdankel previously approved these changes Jan 19, 2024
Copy link
Member

@sdankel sdankel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you!!

@vaivaswatha
Copy link
Contributor

@tritao if this is ok, except for #5486 related changes, we can merge it and update that PR. Or we can wait till that is merged.

@tritao
Copy link
Contributor

tritao commented Jan 19, 2024

@tritao if this is ok, except for #5486 related changes, we can merge it and update that PR. Or we can wait till that is merged.

Cool by me but that PR was already merged anyway

@vaivaswatha vaivaswatha requested a review from a team January 19, 2024 14:08
@vaivaswatha vaivaswatha enabled auto-merge (squash) January 19, 2024 14:09
@vaivaswatha vaivaswatha merged commit ef7a7e4 into master Jan 20, 2024
37 checks passed
@vaivaswatha vaivaswatha deleted the kayagokalp/o-flags branch January 20, 2024 11:12
sdankel added a commit that referenced this pull request Jan 24, 2024
This PR implements `-o` flags so that we can disable optimizations. This
will be useful as we are working towards debugger support and
optimizations pollute source map generated.

Provide option to the e2e test binary to specify build profile. For
tests that have their ABI tested, or rely on their compiled
hashes (for deployment), since that changes with build profile, the
tests are marked as unsupported for debug profile.
(better to test with and have expected results for release than the
debug profile).

Add testing release profile in CI since the default is now debug. Two
tests in `should_fail` that are expected to fail due to
overflows are disabled because there's a bug in our IR gen. This is
tracked by #5449

---------

Co-authored-by: Vaivaswatha Nagaraj <vaivaswatha.nagaraj@fuel.sh>
Co-authored-by: Vaivaswatha N <vaivaswatha@users.noreply.github.com>
Co-authored-by: Sophie Dankel <47993817+sdankel@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked compiler: ir IRgen and sway-ir including optimization passes compiler General compiler. Should eventually become more specific as the issue is triaged enhancement New feature or request forc forc-pkg Everything related to the `forc-pkg` crate.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants