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

Disable POLLY (polyhedral optimisation) #2327

Closed
wants to merge 3 commits into from
Closed

Conversation

gunir
Copy link
Contributor

@gunir gunir commented Oct 26, 2024

It's not that great, and it's risky on non-compatible devices, that's why most projects don't use it, it's only meant for personal use with perfect hardware setup only.

Firefox itself has already implemented similar mechanics to optimize for repetitive tasks, for Javascript it's dom.script_loader.bytecode_cache.enabled, for smooth scroll/zooming it's APZ, we don't really need POLLY.

In simple terms, polyhedral optimisation tunes the browser's inner loops to make maximum use of the CPU and memory. This speeds up repetitive tasks like rendering, scrolling, and video playback that rely on loops. The end result is a faster, smoother browsing experience for the user.

As previously mentioned, when you use a web browser, it has to repeat similar tasks over and over - like rendering webpage elements, running JavaScript code, scrolling the page, and displaying videos.

These tasks involve loops, where the browser does the same kind of work over and over. Polyhedral optimisation makes the browser's loops run faster by reorganizing them. It finds the best way to access data repeatedly in the most efficient order.

For example, when scrolling a page with lots of images, polyhedral optimisation could optimise the loops that decode and display the image data. It finds the fastest way to reuse image data in the CPU cache.

This means scrolling feels much smoother. The images decode quicker as you scroll up and down. The browser feels snappier.

So in simple terms, polyhedral optimisation tunes the browser's inner loops to make maximum use of the CPU and memory. This speeds up repetitive tasks like rendering, scrolling, and video playback that rely on loops. The end result is a faster, smoother browsing experience for the user.

@gunir gunir requested a review from mauro-balades as a code owner October 26, 2024 03:07
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Oct 26, 2024
@mauro-balades
Copy link
Member

What if we just do it for generic builds?

@gunir
Copy link
Contributor Author

gunir commented Oct 26, 2024

What if we just do it for generic builds?

Not sure, but the value of POLLY isn't that high, it's too new to be guaranteed safe, programmers have confirmed about the double-edged sword of POLLY:

the speedup is great, but the massive performance regressions are rather ugly.. do you know where they might come from?

I think it's because polly is optimizing throughput instead of latency. Some of the regressions either vanish or turn to speedups if you increase the input array size.

It comes with several drawbacks.

Builds marked with the "+polly" tag utilize the Polly "high-level loop and data-locality optimizer and optimization infrastructure for LLVM."

To correctly provide software with POLLY build, they usually create a separate build for POLLY apart from the "normal" builds, like above Chromium Build's repo

@mauro-balades
Copy link
Member

This has already been done by another commit, sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants