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

Optimizations #12

Open
wants to merge 31 commits into
base: lp5.1
Choose a base branch
from
Open

Optimizations #12

wants to merge 31 commits into from

Conversation

Moludos
Copy link

@Moludos Moludos commented Sep 22, 2015

No description provided.

lozo2010 and others added 30 commits July 28, 2015 22:22
(https://developer.qualcomm.com/mobile-development/increase-app-performance/snapdragon-llvm-compiler-android)
for Android Lollipop 5.x for devices with Qualcomm CPU

As far as I know nobody has done that yet. Except me :)

This changes the toolchain for CLANG from the default one which comes
with Android (aCLANG) to the Qualcomm Snapdragon LLVM Compiler 3.6
(qCLANG) mentioned above. The toolchain will be used for almost all
places where the default Android CLANG (aCLANG) is used for compiling
TARGET MODULES. BUT ONLY if "USE_CLANG_QCOM := true" is set. Otherwise
it is using aCLANG. So you can merge this commit and the build will be
the same as before except you specifically define "USE_CLANG_QCOM :=
true"!

WARNING: THIS IS NOT FULLY TESTED FOR STABILITY YET. READ CAREFULLY It
is very likely that using this toolchain, especially with the
optimizations flags, will introduce BUGS!

I would suggest: IF YOU USE IT DONT MAKE BUG REPORTS FOR YOUR OFFICIAL
ROM OR KERNEL OR ANY APPS. Make reports in the development thread. The
ROM compiles, boots and starts. Also if Bionic and other modules are
compiled with Qualcomm Snapdragon LLVM Compiler 3.6 (qCLANG).
Androbench, Antutu, Basemark 2.0 , Geekbench 3, Vellamo are 'completing'
the benchmarks. This is a work in progress. There is confirmation that
it works for Sony Z Ultra and Samsung Galaxy Note 4 and after some
months of testing everything seems good.

At the moment this is only tested with Qualcomm Snapdragon but in theory
this should also work with any Krait and even Scorpion CPU. According to
Documentation there is also support for armv8/aarch64 (Snapdragon 810)
and you should gain a real performance bump but support is not yet
implemented! If you have a Snapdragon 810 device and want to try this
out contact me please.

Install instructions:

1. You have to make an account in order to download the toolchain!
2. You need to download the toolchain and extract it to {your android
dir}/prebuilts/clang/linux-x86/host/*
3. Add the repo (https://github.com/mustermaxmueller/clanglibs) to your
manifest. For example: <project path="vendor/clanglibs"
name="mustermaxmueller/clanglibs" remote="github"
revision="clang_qcom_3.6"/>
4. Replace the compiler-rt repo with this one
https://github.com/mustermaxmueller/compiler-rt in your manifest For
example: <project path="external/compiler-rt"
name="mustermaxmueller/compiler-rt" remote="github"
revision="clang_qcom_3.6"/>
5. Add my build repo https://github.com/mustermaxmueller/android_build/
or merge my changes. For example: <project path="build"
name="mustermaxmueller/android_build" remote="github"
revision="master"/>
6. Add my frameworks_rs repo
https://github.com/mustermaxmueller/android_frameworks_rs or merge my
changes. For example: <project path="build"
name="mustermaxmueller/android_build" remote="github"
revision="master"/>

    You need the Qualcomm Snapdragon LLVM Compiler 3.5 for this to
work!!!
    OR
    Make changes to
frameworks/rs/driver/runtime/build_bc_lib_internal.mk like stated here:
http://forum.xda-developers.com/showpost.php?p=59626153&postcount=47

7. Change following line in following files:

prebuilts/ndk/current/platforms/android-14/arch-arm/usr/include/math.h
prebuilts/ndk/current/platforms/android-8/arch-arm/usr/include/math.h
from
#if !defined(__clang__) || __clang_major__ > 3 || (__clang_major__ == 3
&& __clang_minor__ >= 6)
to
#if !defined(__clang__) || __clang_major__ > 3 || (__clang_major__ == 3
&& __clang_minor__ >= 7)

8. Set "USE_CLANG_QCOM := true" e.g. in Boardconfig.mk

    OPTIONAL (set these options in your Boardconfig.mk):
    USE_CLANG_QCOM_VERBOSE := true (give extra output when compiling)
    USE_CLANG_QCOM_LTO := true (use LTO; not working at the moment)
    CLANG_QCOM_COMPILE_ART := true (compile art with qclang; not working
at the moment!)
    CLANG_QCOM_COMPILE_BIONIC := true (compile bionic with qclang)
    CLANG_QCOM_COMPILE_MIXED := true (compile defined modules with
qclang)
    CLANG_QCOM_FORCE_COMPILE_MODULES += (Here you can overwrite which
modules should be compiled with qCLANG instead of GCC)
    CLANG_QCOM_FORCE_COMPILE_ACLANG_MODULES += (Here you can overwrite
which modules should be compiled with aCLANG instead of qCLANG)
    CLANG_QCOM_DONT_REPLACE_WITH_Ofast_MODULES += (Here you can
overwrite which modules shouldnt be compiled with -Ofast)

9. Add "USE_CLANG_QCOM := true" to your
Boardconfig.mk/BoardconfigCommon.mk of your device.
   (If you want to be certain that qclang is used,also set
"USE_CLANG_QCOM_VERBOSE := true" in your Boardconfig.mk and you will see
the verbose output while compiling.)

10. Make a clean compile! Also delete ccache!

Annotation:
1. You should only get measurable performance benefits if you compile
Bionic with CLANG!
2. Documentation for the toolchain: {your android
dir}/prebuilts/clang/linux-x86/host/llvm-Snapdragon_LLVM_for_Android_3.6/Snapdragon_LLVM_ARM_36_User_Guide.pdf
3. The Flags "-muse-optlibc" and "-ffuse-loops" are not Documented.
(http://pastebin.com/PZtk6WHB)
4. The implementation is not beautiful but it works
5. HOST is compiled with aCLANG because qCLANG does not understand x86
6. You can make performance and size comparisons by removing/commenting
"USE_CLANG_QCOM := true"
7. I could have made the installation easier by uploading the toolchain
to Github but I do not know if I am allowed to. And I am no lawyer so...

TODO:
-Make more performance comparisons to aCLANG and GCC. It seems good even
compared to GCC
-Use ccache -Where does it make sense to use qCLANG instead of GCC?
-Compile Android with qCLANG wherever possible.
http://www.linuxplumbersconf.org/2013/ocw/system/presentations/1131/original/LP2013-Android-clang.pdf
and
https://events.linuxfoundation.org/sites/events/files/slides/2014-ABS-LLVMLinux.pdf

Development Thread:
http://forum.xda-developers.com/android/software-hacking/wip-compile-android-5-0-2-qualcomm-llvm-t3035162
(https://developer.qualcomm.com/mobile-development/increase-app-performance/snapdragon-llvm-compiler-android)
for Android Lollipop 5.x for devices with Qualcomm CPU

As far as I know nobody has done that yet. Except me :)

This changes the toolchain for CLANG from the default one which comes
with Android (aCLANG) to the Qualcomm Snapdragon LLVM Compiler 3.6
(qCLANG) mentioned above. The toolchain will be used for almost all
places where the default Android CLANG (aCLANG) is used for compiling
TARGET MODULES. BUT ONLY if "USE_CLANG_QCOM := true" is set. Otherwise
it is using aCLANG. So you can merge this commit and the build will be
the same as before except you specifically define "USE_CLANG_QCOM :=
true"!

WARNING: THIS IS NOT FULLY TESTED FOR STABILITY YET. READ CAREFULLY It
is very likely that using this toolchain, especially with the
optimizations flags, will introduce BUGS!

I would suggest: IF YOU USE IT DONT MAKE BUG REPORTS FOR YOUR OFFICIAL
ROM OR KERNEL OR ANY APPS. Make reports in the development thread. The
ROM compiles, boots and starts. Also if Bionic and other modules are
compiled with Qualcomm Snapdragon LLVM Compiler 3.6 (qCLANG).
Androbench, Antutu, Basemark 2.0 , Geekbench 3, Vellamo are 'completing'
the benchmarks. This is a work in progress. There is confirmation that
it works for Sony Z Ultra and Samsung Galaxy Note 4 and after some
months of testing everything seems good.

At the moment this is only tested with Qualcomm Snapdragon but in theory
this should also work with any Krait and even Scorpion CPU. According to
Documentation there is also support for armv8/aarch64 (Snapdragon 810)
and you should gain a real performance bump but support is not yet
implemented! If you have a Snapdragon 810 device and want to try this
out contact me please.

Install instructions:

1. You have to make an account in order to download the toolchain!
2. You need to download the toolchain and extract it to {your android
dir}/prebuilts/clang/linux-x86/host/*
3. Add the repo (https://github.com/mustermaxmueller/clanglibs) to your
manifest. For example: <project path="vendor/clanglibs"
name="mustermaxmueller/clanglibs" remote="github"
revision="clang_qcom_3.6"/>
4. Replace the compiler-rt repo with this one
https://github.com/mustermaxmueller/compiler-rt in your manifest For
example: <project path="external/compiler-rt"
name="mustermaxmueller/compiler-rt" remote="github"
revision="clang_qcom_3.6"/>
5. Add my build repo https://github.com/mustermaxmueller/android_build/
or merge my changes. For example: <project path="build"
name="mustermaxmueller/android_build" remote="github"
revision="master"/>
6. Add my frameworks_rs repo
https://github.com/mustermaxmueller/android_frameworks_rs or merge my
changes. For example: <project path="build"
name="mustermaxmueller/android_build" remote="github"
revision="master"/>

    You need the Qualcomm Snapdragon LLVM Compiler 3.5 for this to
work!!!
    OR
    Make changes to
frameworks/rs/driver/runtime/build_bc_lib_internal.mk like stated here:
http://forum.xda-developers.com/showpost.php?p=59626153&postcount=47

7. Change following line in following files:

prebuilts/ndk/current/platforms/android-14/arch-arm/usr/include/math.h
prebuilts/ndk/current/platforms/android-8/arch-arm/usr/include/math.h
from
#if !defined(__clang__) || __clang_major__ > 3 || (__clang_major__ == 3
&& __clang_minor__ >= 6)
to
#if !defined(__clang__) || __clang_major__ > 3 || (__clang_major__ == 3
&& __clang_minor__ >= 7)

8. Set "USE_CLANG_QCOM := true" e.g. in Boardconfig.mk

    OPTIONAL (set these options in your Boardconfig.mk):
    USE_CLANG_QCOM_VERBOSE := true (give extra output when compiling)
    USE_CLANG_QCOM_LTO := true (use LTO; not working at the moment)
    CLANG_QCOM_COMPILE_ART := true (compile art with qclang; not working
at the moment!)
    CLANG_QCOM_COMPILE_BIONIC := true (compile bionic with qclang)
    CLANG_QCOM_COMPILE_MIXED := true (compile defined modules with
qclang)
    CLANG_QCOM_FORCE_COMPILE_MODULES += (Here you can overwrite which
modules should be compiled with qCLANG instead of GCC)
    CLANG_QCOM_FORCE_COMPILE_ACLANG_MODULES += (Here you can overwrite
which modules should be compiled with aCLANG instead of qCLANG)
    CLANG_QCOM_DONT_REPLACE_WITH_Ofast_MODULES += (Here you can
overwrite which modules shouldnt be compiled with -Ofast)

9. Add "USE_CLANG_QCOM := true" to your
Boardconfig.mk/BoardconfigCommon.mk of your device.
   (If you want to be certain that qclang is used,also set
"USE_CLANG_QCOM_VERBOSE := true" in your Boardconfig.mk and you will see
the verbose output while compiling.)

10. Make a clean compile! Also delete ccache!

Annotation:
1. You should only get measurable performance benefits if you compile
Bionic with CLANG!
2. Documentation for the toolchain: {your android
dir}/prebuilts/clang/linux-x86/host/llvm-Snapdragon_LLVM_for_Android_3.6/Snapdragon_LLVM_ARM_36_User_Guide.pdf
3. The Flags "-muse-optlibc" and "-ffuse-loops" are not Documented.
(http://pastebin.com/PZtk6WHB)
4. The implementation is not beautiful but it works
5. HOST is compiled with aCLANG because qCLANG does not understand x86
6. You can make performance and size comparisons by removing/commenting
"USE_CLANG_QCOM := true"
7. I could have made the installation easier by uploading the toolchain
to Github but I do not know if I am allowed to. And I am no lawyer so...

TODO:
-Make more performance comparisons to aCLANG and GCC. It seems good even
compared to GCC
-Use ccache -Where does it make sense to use qCLANG instead of GCC?
-Compile Android with qCLANG wherever possible.
http://www.linuxplumbersconf.org/2013/ocw/system/presentations/1131/original/LP2013-Android-clang.pdf
and
https://events.linuxfoundation.org/sites/events/files/slides/2014-ABS-LLVMLinux.pdf

Development Thread:
http://forum.xda-developers.com/android/software-hacking/wip-compile-android-5-0-2-qualcomm-llvm-t3035162 (reverted from commit e4323ac)
(https://developer.qualcomm.com/mobile-development/increase-app-performance/snapdragon-llvm-compiler-android)
for Android Lollipop 5.x for devices with Qualcomm CPU

As far as I know nobody has done that yet. Except me :)

This changes the toolchain for CLANG from the default one which comes
with Android (aCLANG) to the Qualcomm Snapdragon LLVM Compiler 3.6
(qCLANG) mentioned above. The toolchain will be used for almost all
places where the default Android CLANG (aCLANG) is used for compiling
TARGET MODULES. BUT ONLY if "USE_CLANG_QCOM := true" is set. Otherwise
it is using aCLANG. So you can merge this commit and the build will be
the same as before except you specifically define "USE_CLANG_QCOM :=
true"!

WARNING: THIS IS NOT FULLY TESTED FOR STABILITY YET. READ CAREFULLY It
is very likely that using this toolchain, especially with the
optimizations flags, will introduce BUGS!

I would suggest: IF YOU USE IT DONT MAKE BUG REPORTS FOR YOUR OFFICIAL
ROM OR KERNEL OR ANY APPS. Make reports in the development thread. The
ROM compiles, boots and starts. Also if Bionic and other modules are
compiled with Qualcomm Snapdragon LLVM Compiler 3.6 (qCLANG).
Androbench, Antutu, Basemark 2.0 , Geekbench 3, Vellamo are 'completing'
the benchmarks. This is a work in progress. There is confirmation that
it works for Sony Z Ultra and Samsung Galaxy Note 4 and after some
months of testing everything seems good.

At the moment this is only tested with Qualcomm Snapdragon but in theory
this should also work with any Krait and even Scorpion CPU. According to
Documentation there is also support for armv8/aarch64 (Snapdragon 810)
and you should gain a real performance bump but support is not yet
implemented! If you have a Snapdragon 810 device and want to try this
out contact me please.

Install instructions:

1. You have to make an account in order to download the toolchain!
2. You need to download the toolchain and extract it to {your android
dir}/prebuilts/clang/linux-x86/host/*
3. Add the repo (https://github.com/mustermaxmueller/clanglibs) to your
manifest. For example: <project path="vendor/clanglibs"
name="mustermaxmueller/clanglibs" remote="github"
revision="clang_qcom_3.6"/>
4. Replace the compiler-rt repo with this one
https://github.com/mustermaxmueller/compiler-rt in your manifest For
example: <project path="external/compiler-rt"
name="mustermaxmueller/compiler-rt" remote="github"
revision="clang_qcom_3.6"/>
5. Add my build repo https://github.com/mustermaxmueller/android_build/
or merge my changes. For example: <project path="build"
name="mustermaxmueller/android_build" remote="github"
revision="master"/>
6. Add my frameworks_rs repo
https://github.com/mustermaxmueller/android_frameworks_rs or merge my
changes. For example: <project path="build"
name="mustermaxmueller/android_build" remote="github"
revision="master"/>

    You need the Qualcomm Snapdragon LLVM Compiler 3.5 for this to
work!!!
    OR
    Make changes to
frameworks/rs/driver/runtime/build_bc_lib_internal.mk like stated here:
http://forum.xda-developers.com/showpost.php?p=59626153&postcount=47

7. Change following line in following files:

prebuilts/ndk/current/platforms/android-14/arch-arm/usr/include/math.h
prebuilts/ndk/current/platforms/android-8/arch-arm/usr/include/math.h
from
#if !defined(__clang__) || __clang_major__ > 3 || (__clang_major__ == 3
&& __clang_minor__ >= 6)
to
#if !defined(__clang__) || __clang_major__ > 3 || (__clang_major__ == 3
&& __clang_minor__ >= 7)

8. Set "USE_CLANG_QCOM := true" e.g. in Boardconfig.mk

    OPTIONAL (set these options in your Boardconfig.mk):
    USE_CLANG_QCOM_VERBOSE := true (give extra output when compiling)
    USE_CLANG_QCOM_LTO := true (use LTO; not working at the moment)
    CLANG_QCOM_COMPILE_ART := true (compile art with qclang; not working
at the moment!)
    CLANG_QCOM_COMPILE_BIONIC := true (compile bionic with qclang)
    CLANG_QCOM_COMPILE_MIXED := true (compile defined modules with
qclang)
    CLANG_QCOM_FORCE_COMPILE_MODULES += (Here you can overwrite which
modules should be compiled with qCLANG instead of GCC)
    CLANG_QCOM_FORCE_COMPILE_ACLANG_MODULES += (Here you can overwrite
which modules should be compiled with aCLANG instead of qCLANG)
    CLANG_QCOM_DONT_REPLACE_WITH_Ofast_MODULES += (Here you can
overwrite which modules shouldnt be compiled with -Ofast)

9. Add "USE_CLANG_QCOM := true" to your
Boardconfig.mk/BoardconfigCommon.mk of your device.
   (If you want to be certain that qclang is used,also set
"USE_CLANG_QCOM_VERBOSE := true" in your Boardconfig.mk and you will see
the verbose output while compiling.)

10. Make a clean compile! Also delete ccache!

Annotation:
1. You should only get measurable performance benefits if you compile
Bionic with CLANG!
2. Documentation for the toolchain: {your android
dir}/prebuilts/clang/linux-x86/host/llvm-Snapdragon_LLVM_for_Android_3.6/Snapdragon_LLVM_ARM_36_User_Guide.pdf
3. The Flags "-muse-optlibc" and "-ffuse-loops" are not Documented.
(http://pastebin.com/PZtk6WHB)
4. The implementation is not beautiful but it works
5. HOST is compiled with aCLANG because qCLANG does not understand x86
6. You can make performance and size comparisons by removing/commenting
"USE_CLANG_QCOM := true"
7. I could have made the installation easier by uploading the toolchain
to Github but I do not know if I am allowed to. And I am no lawyer so...

TODO:
-Make more performance comparisons to aCLANG and GCC. It seems good even
compared to GCC
-Use ccache -Where does it make sense to use qCLANG instead of GCC?
-Compile Android with qCLANG wherever possible.
http://www.linuxplumbersconf.org/2013/ocw/system/presentations/1131/original/LP2013-Android-clang.pdf
and
https://events.linuxfoundation.org/sites/events/files/slides/2014-ABS-LLVMLinux.pdf

Development Thread:
http://forum.xda-developers.com/android/software-hacking/wip-compile-android-5-0-2-qualcomm-llvm-t3035162
 	envsetup: remove entries in hmm descriptive
…o SlimRoms-lp5.1

Conflicts:
	tools/releasetools/ota_from_target_files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants