-
Notifications
You must be signed in to change notification settings - Fork 63
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
Fix flambda_o3 and flambda_oclassic attributes #536
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gretay-js
reviewed
Feb 18, 2022
lukemaurer
force-pushed
the
fix-o3-and-oclassic
branch
from
February 21, 2022 17:45
0e10761
to
e823176
Compare
poechsel
approved these changes
Feb 24, 2022
mshinwell
approved these changes
Feb 24, 2022
This is ok to merge once rebased + CI passes. |
The implementations of the `flambda_o3` and `flambda_oclassic` attributes were calling into `Clflags`, but the flambda backend implements optimization flags by circumventing `Clflags` entirely. The only obvious solution is to add a hook to `Clflags` so we can simply override what `Clflags.set_o3 ()` does. Fortunately, doing it this way means that the other two ways of setting the flags - the command line and `OCAMLPARAM` - no longer need to do anything special. Tested manually using the included .ml source file. Note that `[@@@flambda_o3]` does nothing if `-Oclassic` is on. This actually reflects existing behavior: `-Oclassic -O3` and `-O3 -Oclassic` are, as far as I can tell, effectively the same as `-Oclassic`.
Also document the test more thoroughly.
Now `-flambda2-cse-depth 7 -O3` will do the same thing as `-O3 -flambda2-cse-depth 7`.
The explicit setting of `fallback_inlining_heuristic` to `false` in the old `o2_flags` was redundant, but it's easier to review this way.
lukemaurer
force-pushed
the
fix-o3-and-oclassic
branch
from
February 24, 2022 15:22
f737e7a
to
2c18ae3
Compare
mshinwell
pushed a commit
that referenced
this pull request
Mar 3, 2022
* Fix flambda_o3 and flambda_oclassic attributes The implementations of the `flambda_o3` and `flambda_oclassic` attributes were calling into `Clflags`, but the flambda backend implements optimization flags by circumventing `Clflags` entirely. The only obvious solution is to add a hook to `Clflags` so we can simply override what `Clflags.set_o3 ()` does. Fortunately, doing it this way means that the other two ways of setting the flags - the command line and `OCAMLPARAM` - no longer need to do anything special. Tested manually using the included .ml source file. Note that `[@@@flambda_o3]` does nothing if `-Oclassic` is on. This actually reflects existing behavior: `-Oclassic -O3` and `-O3 -Oclassic` are, as far as I can tell, effectively the same as `-Oclassic`. * Make later -O flags completely override earlier ones Also document the test more thoroughly. * Don't have -O* clobber earlier options Now `-flambda2-cse-depth 7 -O3` will do the same thing as `-O3 -flambda2-cse-depth 7`. * Minimize the diff a bit * Install optimization-flag handler in native toplevel * Restore the behavior that -Oclassic implies -linscan * Add missing settings to O levels The explicit setting of `fallback_inlining_heuristic` to `false` in the old `o2_flags` was redundant, but it's easier to review this way. * Formatting
stedolan
added a commit
to stedolan/flambda-backend
that referenced
this pull request
Mar 7, 2022
64235a382a flambda-backend: Change Float.nan from sNaN to qNaN (ocaml-flambda#466) 14a8e27063 flambda-backend: Track GC work for all managed bigarray allocations (upstream 11022) (ocaml-flambda#569) c3cda96154 flambda-backend: Add two new methods to targetint for dwarf (ocaml-flambda#560) e6f1fed2f5 flambda-backend: Handle arithmetic overflow in select_addr (ocaml-flambda#570) dab7209a12 flambda-backend: Add Target_system to ocaml/utils (ocaml-flambda#542) 82d5044871 flambda-backend: Enhance numbers.ml with more primitive types (ocaml-flambda#544) 216be99334 flambda-backend: Fix flambda_o3 and flambda_oclassic attributes (ocaml-flambda#536) 4b56e07c1d flambda-backend: Test naked pointer root handling (ocaml-flambda#550) 40d69cef86 flambda-backend: Stop local function optimisation from moving code into function bodies; opaque_identity fixes for class compilation (ocaml-flambda#537) f08ae5851c flambda-backend: Implemented inlining history and use it inside inlining reports (ocaml-flambda#365) ac496bf52e flambda-backend: Disable the local keyword in typing (ocaml-flambda#540) 7d46712f7a flambda-backend: Bugfix for Typedtree generation of arrow types (ocaml-flambda#539) 61a7b47773 flambda-backend: Insert missing page table check in roots_nat.c (ocaml-flambda#541) 323bd36d98 flambda-backend: Compiler error when -disable-all-extensions and -extension are used (ocaml-flambda#534) d8956b09e4 flambda-backend: Persistent environment and reproducibility (ocaml-flambda#533) 4a0c89f117 flambda-backend: Revert "Revert bswap PRs (480 and 482)" (ocaml-flambda#506) 7803705828 flambda-backend: Cause a C warning when CAMLreturn is missing in C stubs. (ocaml-flambda#376) 6199db5b26 flambda-backend: Improve unboxing during cmm for Flambda (ocaml-flambda#295) 96b9e1ba6d flambda-backend: Print diagnostics at runtime for Invalid (ocaml-flambda#530) 42ab88e8a1 flambda-backend: Disable bytecode compilers in ocamltest (ocaml-flambda#504) 58c72d5476 flambda-backend: Backport ocaml/ocaml#10595 from upstream/trunk (ocaml-flambda#471) 10105394de flambda-backend: Use C++ name mangling convention (ocaml-flambda#483) 81881bbf88 flambda-backend: Local allocation test no longer relies on lifting (ocaml-flambda#525) f5c47190f6 flambda-backend: Fix an assertion in Closure that breaks probes (ocaml-flambda#505) c2cf2b2a14 flambda-backend: Add some missing command line arguments to ocamlnat (ocaml-flambda#499) git-subtree-dir: ocaml git-subtree-split: 64235a382a0424cced40eed328ddf1dfb9645f87
stedolan
added a commit
that referenced
this pull request
Mar 7, 2022
64235a382a flambda-backend: Change Float.nan from sNaN to qNaN (#466) 14a8e27063 flambda-backend: Track GC work for all managed bigarray allocations (upstream 11022) (#569) c3cda96154 flambda-backend: Add two new methods to targetint for dwarf (#560) e6f1fed2f5 flambda-backend: Handle arithmetic overflow in select_addr (#570) dab7209a12 flambda-backend: Add Target_system to ocaml/utils (#542) 82d5044871 flambda-backend: Enhance numbers.ml with more primitive types (#544) 216be99334 flambda-backend: Fix flambda_o3 and flambda_oclassic attributes (#536) 4b56e07c1d flambda-backend: Test naked pointer root handling (#550) 40d69cef86 flambda-backend: Stop local function optimisation from moving code into function bodies; opaque_identity fixes for class compilation (#537) f08ae5851c flambda-backend: Implemented inlining history and use it inside inlining reports (#365) ac496bf52e flambda-backend: Disable the local keyword in typing (#540) 7d46712f7a flambda-backend: Bugfix for Typedtree generation of arrow types (#539) 61a7b47773 flambda-backend: Insert missing page table check in roots_nat.c (#541) 323bd36d98 flambda-backend: Compiler error when -disable-all-extensions and -extension are used (#534) d8956b09e4 flambda-backend: Persistent environment and reproducibility (#533) 4a0c89f117 flambda-backend: Revert "Revert bswap PRs (480 and 482)" (#506) 7803705828 flambda-backend: Cause a C warning when CAMLreturn is missing in C stubs. (#376) 6199db5b26 flambda-backend: Improve unboxing during cmm for Flambda (#295) 96b9e1ba6d flambda-backend: Print diagnostics at runtime for Invalid (#530) 42ab88e8a1 flambda-backend: Disable bytecode compilers in ocamltest (#504) 58c72d5476 flambda-backend: Backport ocaml/ocaml#10595 from upstream/trunk (#471) 10105394de flambda-backend: Use C++ name mangling convention (#483) 81881bbf88 flambda-backend: Local allocation test no longer relies on lifting (#525) f5c47190f6 flambda-backend: Fix an assertion in Closure that breaks probes (#505) c2cf2b2a14 flambda-backend: Add some missing command line arguments to ocamlnat (#499) git-subtree-dir: ocaml git-subtree-split: 64235a382a0424cced40eed328ddf1dfb9645f87
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The implementations of the
flambda_o3
andflambda_oclassic
attributes were calling intoClflags
, but the flambda backend implements optimization flags by circumventingClflags
entirely. The only obvious solution is to add a hook toClflags
so we can simply override whatClflags.set_o3 ()
does. Fortunately, doing it this way means that the other two ways of setting the flags - the command line andOCAMLPARAM
- no longer need to do anything special.Tested manually using the included .ml source file.