yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] prstorero:
Ah i see. So i guess if -O2 works it may not be worth the effort to try and fix the error that -O3 causes for me? Hopefully it doesn't cause the same or similar one for -O2. I'm building it as we speak so I should know within the next couple of hours. If it causes an issue I'll probably be asking you for any insight if you're up to explaining it. If it were to give the same (mm_camera.o) in the target directory, would there be a way to apply -Os to just that portion and let the rest of the system continue with -O2 and do the same for any other errors that may occur?
[Android Software/Hacking General [Developers Only]] JustArchi:
Maybe some part of your ROM gets wrongly optimized, there's a nasty loop hidden, I don't know. In my case, O2/O3 made things only better, in terms of battery life and mostly performance. As I stated in the OP, everybody WILL get different results, there's no one scenario for every ROM and every device and everybody should modify these flags to his own liking/requirements.

Optimization:

In my case, optimization is being as effective as possible, and by effective I mean that it should complete a specific task as fast as possible. And in this matter, O3 wins. At least in my case.

Also, take a look at my blind tests - http://xdaforums.com/galaxy-s3/general/justarchis-mysterious-builds-beta-t2638691. It's nice to know that users didn't know what is a difference between both of those builds, because I wanted to get rid of potential placebo effect of something "being better".

In terms of battery, O3 and Os is a tie for most of the users. If there was any battery drain, definitely users would notice that and make proper vote, same as they did in terms of performance for O3 build, 9 votes versus 1 vote. If you ask me, such blind test of two builds without telling users what has been changed and which build is the "original" one is one of the most practical tests that can be done. It is user who should feel a difference after all.
[Android Software/Hacking General [Developers Only]] sparksco:
Out of curiosity how long did each person perform the test? If it's less than one day it won't be accurate results IMO. Let the device be up and running normally for a day with lots of processes running in the background. The normal way a android user uses their phone. Then perform all test and compare battery results.
[Android Software/Hacking General [Developers Only]] sparksco:
Hey all, I just noticed this patch doesn't include graphite optimizations. Any reason why?
[Android Software/Hacking General [Developers Only]] JustArchi:
A poll was open for 7 days and I even mentioned that every build should be tested at least for 2 or 3 days. While I can't prove that everybody did the test as suggested, I think that most of them did.
[Android Software/Hacking General [Developers Only]] JustArchi:
Linaro is not built with them natively, but I have in plans to take a look at them and your awesome toolchain :).
[Android Software/Hacking General [Developers Only]] metalspring:
Also, I'll bet most of the people using this commit havent even tried -O3 and linaro toolchains yet, which by themselves can greatly improve performance.

And, while all those extra cflags may work great for your device and rom, it may not work as well on all devices and roms, I know I always stick to the most common optimized cflags (-O3, fstrict-aliasing, and a few others used in several multi-device roms, such as vanir and liquidsmooth)
[Android Software/Hacking General [Developers Only]] spanish33:
Were you successful compiling rom with it?
[Android Software/Hacking General [Developers Only]] JustArchi:
I totally agree on that and this is the reason why I compiled my mysterious builds with the same toolchain (Google's GCC), same environment, and even the same commits. I wanted to check if standalone O3 really makes a big difference when put instead of default Os for target thumb (only). Community said that it does :).
[Android Software/Hacking General [Developers Only]] sparksco:
I think the only issue with graphite is -ffast-math (one of the -O3), causes a internal compiled error. So -O3 and graphite might not be the best combo.
[Android Software/Hacking General [Developers Only]] metalspring:
I dont think graphite in a rom is really possible, I tried it before and bionic errors out with it (it specifically says bionic cannot be built with graphite cflags), the only way to work around it is to disable the graphite optimizations for libdl and libc in bionic, and in abi/cpp (which I think effectively completely disables the graphite optimizations anyway), ffast-math caused errors in external/chromium for me (also said chromium cannot be built with ffast-math).

Link time optimization does work if you disable it in a few places (libdl and libc in bionic and the libc reference in ART).

For kernels however, graphite optimizations tend to work just fine and improve performance in multi-core devices
[Android Software/Hacking General [Developers Only]] JustArchi:
-ffast-math is not enabled on O3 level, it's enabled on -Ofast level. And you're right, Android is not compatible with Ofast.
[Android Software/Hacking General [Developers Only]] sparksco:
It is possible and it works great.

https://github.com/AOSPAL/android_build/blob/kitkat/core/binary.mk#L170

You need two Linux toolchains for prebuilts/gcc/linux-x86/host in addition to the two arm toolchains. All with graphite enabled or it won't work. I use 4.8.4 for Linux and android but 4.10 for the kernel.
[Android Software/Hacking General [Developers Only]] sparksco:
I wanted to make a guide on how to compile SaberMod toolchains. But probably won't have time to write it all up until later tonight or tomorrow. And it's fairly simple.

There's three packages extra needed to compile them in addition to the normal android packages.

sudo apt-get install libcloog-isl-dev texinfo libcap-dev

After that sync the repo

repo init -u https://github.com/SaberMod/toolchain_manifest.git -b master

repo sync

After that cd to build (cd build). Type ls to see the executable scripts to build the targets. Run the script of choice (./arm-eabi-4.10). Toolchains should be in home directory (~/tmp).
[Android Software/Hacking General [Developers Only]] JustArchi:
I always wanted to ask you. Could you briefly tell me how SaberMod differs from Linaro? Do you follow their commits, add your own, what's your goal in maintaining your own toolchain, why did you decide to create it? I'm always wondering whether I should use Linaro or SaberMod, because both are great, both are performing awesome and it's a really tough choice for me to choose one. If you could spend a few minutes on writing SaberMod advantages over Linaro then I'd highly appreciate it, and probably other developers as well.
[Android Software/Hacking General [Developers Only]] sparksco:
I use to build linaro at first but I wasn't a fan of how their build system worked compared to aosp with the toolchains for arm-eabi and androideabi being in the same install location. So I decided to try aosp. After that I'd like newer gcc and other tools that are part of building the toolchains since Google doesn't update very often. I applied most of the android gcc patches in all the branches. Some of them needed modified to work on newer gcc versions based on gnu gcc. Mostly I just wanted newer gcc and use flags from linaro like strict-aliasing. Then I decided I wanted to try graphite and that's when I realized I couldn't do to it being disabled by default. And now lately I've been working on getting the Linux toolchains to build and function properly which I have done now. But only 4.8.4 is currently stable for the Linux SDK toolchains. 4.9 and up causes ROM to bootloop.

So with Linux toolchains I found there's a bug in android that needs this workaround with SaberMod Linux and maybe why Google hasn't updated their Linux from i686-linux-4.6 to newer version. Even on master branch they still use 4.6.

https://github.com/AOSPAL/android_build/commit/a809f62c49ecc9b49d74e77ab98fd2bb0359b9ab

And also in order to use the Linux SDK you'll need to change this file.

https://github.com/AOSPAL/android_prebuilts_tools/commit/54754e13254218dc28638ebf15cef33d41c6856a

About linaro I honestly don't know anymore since I haven't used it in so long. But no I don't use commits from linaro just aosp.
[Android Software/Hacking General [Developers Only]] sparksco:
There's other ROM fixes needed which I'll get a list on the guide when I write it up but all of them are on AOSPAL github. I'd recommend using the art repo from there on kitkat-exp branch which I've patched a lot for gcc 4.8 Linux.
[Android Software/Hacking General [Developers Only]] denzel09:
So there are not linaro optimization in your toolchain right?

For you your tc is better than linaro?
[Android Software/Hacking General [Developers Only]] sparksco:
I don't feel the need to compare. And no I don't know that it's better just different. I can't make a fair comparison since I don't use linaro. I love their ROM flags like strict because it seems to add a lot of performance to the ROM. SaberMod is over a year now of development and testing which is a lot of hours for testing toolchains and ROM building :cool:
[Android Software/Hacking General [Developers Only]] nasty007:
Tried today again, switched from Linux Mint 16 to Buildubuntu but im stuck at same error like yesterday

http://pastebin.com/3t6uqrnc

Dont know if i make something wrong or is it something else
[Android Software/Hacking General [Developers Only]] Nico_60:
clang: error: no such file or directory: 'f'
[Android Software/Hacking General [Developers Only]] shoey63:
If, when building CM11 on Yuga, I change TARGET_thumb_CFLAGS from -Os to -O2 or -O3, I cant see my exFat external SD card in rom or recovery after a successful build.

Anyone else? Any fix?
[Android Software/Hacking General [Developers Only]] Nico_60:
I think that'll help you...

https://github.com/SlimSaber/android_external_fuse/commit/b3ec5cf1e4e46cd5a27ae9809274e9e2105fcd03

https://github.com/SlimSaber/android_external_exfat/commit/2177942e28a20bd743029ed23ac7ba6fa5619e0b

Edit: credit to [MENTION=3306843]kantjer[/MENTION] for the idea
[Android Software/Hacking General [Developers Only]] McDope:
Can't offer a fix, but doesn't happen when building PAC (but PAC source is screwed for now, bootloops since 10 days ago :P) for yuga

edit: the commits posted by Nico looks like your fix :)
[Android Software/Hacking General [Developers Only]] denzel09:
Understood. Hard to choice honestly at this point buddy. It would be nice by someone expert a comparison. I think that many appreciate this.
[Android Software/Hacking General [Developers Only]] shoey63:
That fixes it:good:
[Android Software/Hacking General [Developers Only]] valentijn_venus:
Nexus 5 rom

Any one successfully used ArchiDroid opts to build a custom Nexus 5 rom? Would like to compare performance with default AOSP.
[Android Software/Hacking General [Developers Only]] Markox89:
[MENTION=5161352]JustArchi[/MENTION], consider adding -fno-tree-vectorize to TARGET_thumb_CFLAGS, this solves the ril crashes for the Exynos 4210 family I've PMed you about in the past days.

Credits goes also to fusionjack, IAmTheOneTheyCallNeo and Myself5.
[Android Software/Hacking General [Developers Only]] JustArchi:
Added to the OP.
[Android Software/Hacking General [Developers Only]] Orphee:
Hi,

Just built latest CM11 for moto_msm8960 without any problems with linaro 4.8 and google 4.8 too and V3 optimisation.

Latest playstore still glitch with linaro 4.8

It works well.

Still set -Os for display-caf qcom hardware.

---------- Post added at 04:53 PM ---------- Previous post was at 04:51 PM ----------

What are you RIL crash ? what happens on your phone ?
[Android Software/Hacking General [Developers Only]] shoey63:
Running cm11 on Yuga, with full v3 optimisations by [MENTION=5161352]JustArchi[/MENTION] + [MENTION=4328678]metalspring[/MENTION]'s graphite optimisations for kernel and his LTO's, compiled with graphite enabled sabermod toolchains:beer:

Art enabled and working flawlessly and no SD card issues. Thanks to all for your bug fixes and contributions:thumbup:

Edit: and yes, it is running butter-smooth;)
[Android Software/Hacking General [Developers Only]] prstorero:
I have one with slim. I'll upload it and pm you a link.

---------- Post added at 10:51 AM ---------- Previous post was at 10:19 AM ----------

Well I'm happy to say I have a build running with the thumb changed to -O2 successfully :)
[Android Software/Hacking General [Developers Only]] JustArchi:
Doesn't compile for me.

Memory usage goes highly to 100% and it crashes with typical OOM error. And yes, I have 4 GB of RAM and 1 GB of swap, so definitely it's more than enough.

I've seen similar error when compiling dalvik with Linaro 4.9, so it may be something deeper than I think.

Reproduced on latest Debian Testing and Ubuntu (Utopic Unicorn).
[Android Software/Hacking General [Developers Only]] sparksco:
Yeah the memory goes really high. I've honestly never seen that error before but I use a SaberMod server that builds them pretty fast. Also I pushed a bug fix for machines that use Intel yesterday. Others have compiled it successfully as well on Ubuntu 14.04 (Trusty). It comes with system installed gcc 4.8 by default which is nice.
[Android Software/Hacking General [Developers Only]] Markox89:
I successfully build every week, using SaberMod with 4 GB + 2 GB of swap on Ubuntu 14.04, give this setup a try ;)
[Android Software/Hacking General [Developers Only]] sparksco:
I've only tested for fully graphite ROM/kernel for two days now. There is a nice boost in benchmarks for memory which is what graphite does. Graphite is a high-end memory optimizer.

This is on ART but it helps dalvik too and ART has a higher battery drain.
[Android Software/Hacking General [Developers Only]] Fred6681:
Hi,

Optimizations v3 not work for me :crying:

I use linaro 4.8

4 Go ram, 1 Go swap, kubuntu 14.4

the optimizations v2 work for me with Linaro 4.8 and 4.9.

Edit:

if I redo the sprained it gives me this

someone has an idea to solve this problem ?
[Android Software/Hacking General [Developers Only]] JustArchi:
Hell this is the issue I'm talking about. Who finds a root of it gets a cookie.

And no, it's not connected with my optimizations, neither Linaro I guess.
[Android Software/Hacking General [Developers Only]] prstorero:
So I tried building for another device, and ran into some issues. Does anyone know how to fix this?

frameworks/native/libs/ui/GraphicBuffer.cpp:145:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (handle && w==width && h==height && f==format && reqUsage==usage)
^
frameworks/native/libs/ui/GraphicBuffer.cpp:145:67: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (handle && w==width && h==height && f==format && reqUsage==usage)
^
frameworks/native/libs/ui/GraphicBufferAllocator.cpp: In member function 'android::status_t android::GraphicBufferAllocator::alloc(uint32_t, uint32_t, android::PixelFormat, int, const native_handle_t**, int32_t*, uint32_t)':
frameworks/native/libs/ui/GraphicBufferAllocator.cpp:115:26: error: 'alloc_device_t' has no member named 'allocSize'
err = mAllocDev->allocSize(mAllocDev, w, h,
^
make: *** [/home/scott/Slim/out/target/product/xt926/obj/SHARED_LIBRARIES/libui_intermediates/GraphicBufferAllocator.o] Error 1
make: *** Waiting for unfinished jobs....
frameworks/base/core/res/AndroidManifest.xml:1679: warning: No comment for public symbol android:permission/SUBSCRIBED_FEEDS_WRITE
[Android Software/Hacking General [Developers Only]] ne0zone75:
Question about v3...

Hi, i am just wondering if the v3 code below :

# [COLOR="Red"]Release[/COLOR] CPPFLAGS. Usually you don't need to change anything here
TARGET_[COLOR="Red"]GLOBAL[/COLOR]_CPPFLAGS += -O3 -DNDEBUG -funsafe-loop-optimizations -fsection-anchors -fivopts -ftree-loop-im -ftree-loop-ivcanon -ffunction-sections -fdata-sections -funswitch-loops -frename-registers -fomit-frame-pointer -fgcse-sm -fgcse-las -fweb -ftracer -Wno-error=unused-parameter -Wno-error=unused-but-set-variable -Wno-error=maybe-uninitialized -Wstrict-aliasing=3

... is Okay or if there is a typo...,

Thank you and kind regards
[Android Software/Hacking General [Developers Only]] Fred6681:
It seems that the problem comes from Dvm.mk file that is in dalvik / vm.

There are a lot of flags inside and probably that one or more may not be compatible with your optimizations.

What is certain is that this is the file that manages the compilation of the files that causes the problem (line 88 up to 190)

After I is not the level to fix this problem :(
[Android Software/Hacking General [Developers Only]] shoey63:
Anyone know how to solve to following errors?

gcc version 4.8.4 20140531 (prerelease) (SaberMod-4.8.4_android-graphite)

configure:3358: $? = 0

configure:3347: /home/shoey63/saber/build/gcc-SaberMod/./gcc/xgcc -B/home/shoey63/saber/build/gcc-SaberMod/./gcc/ -B/home/shoey63/tmp/arm-linux-androideabi-4.8/arm-linux-androideabi/bin/ -B/home/shoey63/tmp/arm-linux-androideabi-4.8/arm-linux-androideabi/lib/ -isystem /home/shoey63/tmp/arm-linux-androideabi-4.8/arm-linux-androideabi/include -isystem /home/shoey63/tmp/arm-linux-androideabi-4.8/arm-linux-androideabi/sys-include -V >&5

xgcc: error: unrecognized command line option '-V'

xgcc: fatal error: no input files

compilation terminated.

configure:3358: $? = 1

configure:3347: /home/shoey63/saber/build/gcc-SaberMod/./gcc/xgcc -B/home/shoey63/saber/build/gcc-SaberMod/./gcc/ -B/home/shoey63/tmp/arm-linux-androideabi-4.8/arm-linux-androideabi/bin/ -B/home/shoey63/tmp/arm-linux-androideabi-4.8/arm-linux-androideabi/lib/ -isystem /home/shoey63/tmp/arm-linux-androideabi-4.8/arm-linux-androideabi/include -isystem /home/shoey63/tmp/arm-linux-androideabi-4.8/arm-linux-androideabi/sys-include -qversion >&5

xgcc: error: unrecognized command line option '-qversion'

xgcc: fatal error: no input files

compilation terminated.

Taken from /build/gcc-SaberMod/arm-linux-androideabi/libgcc/config.log after a failed build of arm-androideabi-4.8.

I'm on Ubuntu 12.04 running GCC 4.8 with c++
[Android Software/Hacking General [Developers Only]] sparksco:
Unfortunately Ubuntu 12.04 is too old to build this :(

Need to update
[Android Software/Hacking General [Developers Only]] lozohcum:
I tried this but it gave me lots of errors, I had to remove most of flags,

Spróbowałem tej optymalizacji ale musiałem usunąć większość flag bo wywalało mi błędy na każdym kroku.
[Android Software/Hacking General [Developers Only]] JustArchi:
No, I tested V3 before publishing and it works okay, problem is with the compiler, as it runs out of memory very quickly in my vbox, the same thing happens when compiling sabermod toolchain, and this is without any flags.
[Android Software/Hacking General [Developers Only]] t4n017:
Same here with V3 and Linaro 4.9:

target thumb C++: libdvm <= dalvik/vm/Exception.cpp

cc1plus: out of memory allocating 1529430280 bytes after a total of 46292992 bytes
make: *** [/home/t4n017/android/AOSPA/out/target/product/janice/obj/SHARED_LIBRARIES/libdvm_intermediates/mterp/out/InterpC-portable.o] Error 1
make: *** Se espera a que terminen otras tareas....
target thumb C++: libdvm <= dalvik/vm/Hash.cpp

4GB RAM + 4GB SWAP
[Android Software/Hacking General [Developers Only]] JustArchi:
You can try without V3 but like I said, I'm getting the same issue when compiling SaberMod toolchain (and it's not even in android tree, neither uses any of my optimizations) so I think it's far deeper issue, maybe in Linux itself.
[Android Software/Hacking General [Developers Only]] t4n017:
No, I don't think V3 is the problem, but I wanted to report the commit and toolchain I've used.

By the way, I confirm V3 worked fine while using GCC 4.8 and Linaro 4.8.
[Android Software/Hacking General [Developers Only]] JustArchi:
So perhaps GCC 4.9 is faulty then, that's possible as well.

(Speaking of gcc, my debian just got an update to 4.8 and 4.9)
[Android Software/Hacking General [Developers Only]] t4n017:
Yes, maybe is that.

Anyway, the boost after your optimization and GCC 4.8 is really great.

Thanks for sharing it!
[Android Software/Hacking General [Developers Only]] nasty007:
I successfully compiled Sabermod toolchain last night, and it is really memory hungry, I have 4 Gig of RAM and 8 Gig SWAP, it was using all the RAM and 4 gig of Swap, plus computer was totally useless until it was finished
[Android Software/Hacking General [Developers Only]] JustArchi:
When you use over 1 GB of swap then it already becomes ultra laggy and impossible to do anything, your I/O is overused. Swap is nice but it may end up like this :D.
[Android Software/Hacking General [Developers Only]] judas1977:
I compiled with sabermod too on my old laptop (3/4 GB ram + 4 swap) and i don't see any difference in laptop behavior, only waking up lasts little longer. I can use laptop during compilation without problem...

Btw, carbon compiled with justArchi optimisations v3, and have random reboots (but it's possible that this is my kernel sources issue). Anyway, i see performance boost, on v2 too. Great job!
[Android Software/Hacking General [Developers Only]] denzel09:
Sorry, i don't know if i remember correctly, i think i read somewhere here that there was a bug with sdcard in one situation? Or i wrong?
[Android Software/Hacking General [Developers Only]] t4n017:
Maybe this: http://xdaforums.com/showpost.php?p=53071286&postcount=323?
[Android Software/Hacking General [Developers Only]] Fred6681:
To me the problem that arises with Linaro 4.8 so it is not the fault version 4.9

and as I said before with optimization v2 no problem with linaro 4.8 or 4.9.
[Android Software/Hacking General [Developers Only]] JustArchi:
I told you, this problem is not connected with my optimizations.
[Android Software/Hacking General [Developers Only]] sparksco:
It's definitely a issue with your setup. Maybe the Linux distro your using or VM. I've never once had this issue while running Ubuntu.

Essentially this is the problem everyone will face. I used to compile on a old laptop to, and had to reboot after each build. If you use a ssd the build will compile much faster.
[Android Software/Hacking General [Developers Only]] JustArchi:
I know it, but it's nice to see that other people experience this kind of issue as well, looks like a bug in Linux itself...
[Android Software/Hacking General [Developers Only]] MeloEbbasta:
[MENTION=5161352]JustArchi[/MENTION] ei I read the long changelog of the update to Android 4.4.3, and among other things there is "b3e06c0 : ninja/win: Set /O2 compiler flag by default if no 'Optimization' specified". It is not by chance something very similar to your optimization? There are other lines like this, discussing flag and O2
[Android Software/Hacking General [Developers Only]] JustArchi:
Show me link to proper commit and I'll see what is this about.

Also, probably not, because THUMB already specifies Os.
[Android Software/Hacking General [Developers Only]] Orphee:
Hi, I see I have a new play store version on my phone : 4.8.20

Did someone try Linaro GCC with this version ? (I'm currently with Google GCC)
[Android Software/Hacking General [Developers Only]] MeloEbbasta:
https://funkyandroid.com/aosp-KOT49H-KTU84L.html here you go .. look yourself and let me know :)

EDIT: https://android.googlesource.com/platform/external/chromium_org/tools/gyp/+/b3e06c0 and other..
[Android Software/Hacking General [Developers Only]] JustArchi:
Nothing interesting, doesn't change nearly anything as it's only chromium.
[Android Software/Hacking General [Developers Only]] MeloEbbasta:
mmh sorry I am newbie
[Android Software/Hacking General [Developers Only]] JustArchi:
Regarding last strange OOM bug, I couldn't reporoduce it today. Looks like indeed something was wrong with Linux at that time.

If you're using Debian Testing as I do, apt-get update && apt-get dist-upgrade should fix it :).
[Android Software/Hacking General [Developers Only]] shoey63:
[MENTION=2394329]sparksco[/MENTION] Thanks for the tip:)

Ubuntu 14.04 compiles SaberMod tool chain without issue. :good: