llvm for mesa3d
v2 cover llvm for mesa3d
Hello all,
This series provides LLVM support for Mesa3d, enabling llvmpipe software rasterizer.
It must be considered that it does not provide a full LLVM installation for the host, only the necessary components to cross-compile LLVM for the target. It will install all target components as libLLVM.so.
Changes in v2:
The series has been simplified:
*Build only backend for target architecture by default.
*Support for AMDGPU(PATCH 3/4 in v1) was removed because I cannot test it currently.
*Host: make options modified to build only llvm-config and llvm-tblgen (reduces drastically build time for host).
*Target: support only x86 currently (tested), I will test on ARM soon.
The idea is to add incrementally more options to configure LLVM as soon as I can test them.
Regards,
Valent?n
Romain Naour (3):
package/llvm: new host package
package/llvm: enable target variant
package/mesa3d: enable llvm support
package/Config.in | 1 + package/Config.in.host | 1 + package/llvm/Config.in | 19 +++ package/llvm/Config.in.host | 8 + package/llvm/llvm.hash | 2 + package/llvm/llvm.mk | 360 ++++++++++++++++++++++++++++++++++++++++++++ package/mesa3d/Config.in | 8 + package/mesa3d/mesa3d.mk | 18 ++- 8 files changed, 414 insertions(+), 3 deletions(-) create mode 100644 package/llvm/Config.in create mode 100644 package/llvm/Config.in.host create mode 100644 package/llvm/llvm.hash create mode 100644 package/llvm/llvm.mk
Signature · 1 line
2.14.3
PATCH v2 1/3 package/llvm: new host package
From: Romain Naour <[email protected]>
This patch installs only the necessary components of LLVM for the host that are needed to cross-compile LLVM for the target. The path to host's llvm-tblgen must be specified when cross-compiling using option -DLLVM_TABLEGEN.
Most build options are set to OFF in order to reduce the build time.
--- package/Config.in.host | 1 + package/llvm/Config.in.host | 8 ++ package/llvm/llvm.hash | 2 + package/llvm/llvm.mk | 282 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 293 insertions(+) create mode 100644 package/llvm/Config.in.host create mode 100644 package/llvm/llvm.hash create mode 100644 package/llvm/llvm.mk
package/Config.in.host +1 -0
@@ -27,6 +27,7 @@ menu "Host utilities" source "package/imx-usb-loader/Config.in.host" source "package/jq/Config.in.host" source "package/jsmin/Config.in.host" + source "package/llvm/Config.in.host" source "package/lpc3250loader/Config.in.host" source "package/lttng-babeltrace/Config.in.host" source "package/mfgtools/Config.in.host"
package/llvm/Config.in.host new file +8 -0
@@ -0,0 +1,8 @@ +config BR2_PACKAGE_HOST_LLVM + bool "host llvm" + depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS + help + The LLVM Project is a collection of modular and reusable + compiler and toolchain technologies. + + http://llvm.org
package/llvm/llvm.hash new file +2 -0
@@ -0,0 +1,2 @@ +# locally calculated +sha256 5fa7489fc0225b11821cab0362f5813a05f2bcf2533e8a4ea9c9c860168807b0 llvm-5.0.1.src.tar.xz
package/llvm/llvm.mk new file +282 -0
282 lines not on this page · raw message
Signature · 1 line
2.14.3
PATCH v2 1/3 package/llvm: new host package
Hello,
I have by far not reviewed everything, but noticed one problem.
package/llvm/llvm.mk line 171
Quoted 2 lines · Valentin Korenblit
package/llvm/llvm.mk new file +2
-0+# Get target architecture +HOST_LLVM_TARGET_ARCH = $(call qstrip,$(BR2_PACKAGE_LLVM_TARGET_ARCH))
BR2_PACKAGE_LLVM_TARGET_ARCH does not exist, it is created by PATCH 2/3. This is not good, as it breaks bisectability.
Basically, your series should work even if we apply only PATCH 1/3. Or if we apply only PATCH 1/3 and 2/3, etc.
So using in PATCH 1/3 something that is introduced in PATCH 2/3 is not good.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering http://bootlin.com
PATCH v2 1/3 package/llvm: new host package
Hello,
Thanks Thomas for the review. The problem is fixed for next version but I will wait for some more tests before sending it.
I would appreciate if anyone interested in this package can test/review it(applying the 3 patches at once) and give me some feedback following the guidelines in:
https://buildroot.org/downloads/manual/manual.html#_reviewing_and_testing_patches
Thanks in advance,
Valent?n
Quoted 20 lines · Thomas Petazzoni
Hello,
I have by far not reviewed everything, but noticed one problem.
package/llvm/llvm.mk line 171
Quoted 2 lines · Valentin Korenblit
package/llvm/llvm.mk new file +2
-0+# Get target architecture +HOST_LLVM_TARGET_ARCH = $(call qstrip,$(BR2_PACKAGE_LLVM_TARGET_ARCH))
BR2_PACKAGE_LLVM_TARGET_ARCHdoes not exist, it is created by PATCH 2/3. This is not good, as it breaks bisectability.Basically, your series should work even if we apply only PATCH 1/3. Or if we apply only PATCH 1/3 and 2/3, etc.
So using in PATCH 1/3 something that is introduced in PATCH 2/3 is not good.
Best regards,
Thomas
PATCH v2 1/3 package/llvm: new host package
Quoted 5 lines · Valentin Korenblit
Hello,
Thanks Thomas for the review. The problem is fixed for next version but I will wait for some more tests before sending it.
I can test this today at work, but I am using the same target architecture as you, x86. We use this sw rasturizer with a Qt5 app on an old atom platform (that has no modern kernel support for hw accelerated graphics).
I'd love to see it in 2018.02 if possible as that is BRs next LTS release but Thomas and the team may not be adding anymore packages there as they are already cutting RCs. For older platforms though, llvmpipe is pretty big and should be in there. The difference between that and older sw renderers like softpipe is tremendous.
Quoted 6 lines
I would appreciate if anyone interested in this package can test/review it(applying the 3 patches at once) and give me some feedback following the guidelines in:
Quoted 30 lines
https://buildroot.org/downloads/manual/manual.html#_reviewing_and_testing_patches
Thanks in advance,
Valent?n
Quoted 20 lines · Thomas Petazzoni
Hello,
I have by far not reviewed everything, but noticed one problem.
package/llvm/llvm.mk line 171
Quoted 2 lines · Valentin Korenblit
package/llvm/llvm.mk new file +2
-0+# Get target architecture +HOST_LLVM_TARGET_ARCH = $(call qstrip,$(BR2_PACKAGE_LLVM_TARGET_ARCH))
BR2_PACKAGE_LLVM_TARGET_ARCHdoes not exist, it is created by PATCH 2/3. This is not good, as it breaks bisectability.Basically, your series should work even if we apply only PATCH 1/3. Or if we apply only PATCH 1/3 and 2/3, etc.
So using in PATCH 1/3 something that is introduced in PATCH 2/3 is not good.
Best regards,
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180220/b4974656/attachment.html>
PATCH v2 1/3 package/llvm: new host package
Hello,
Quoted 9 lines · Nimai Mahajan
I can test this today at work, but I am using the same target architecture as you, x86. We use this sw rasturizer with a Qt5 app on an old atom platform (that has no modern kernel support for hw accelerated graphics).
I'd love to see it in 2018.02 if possible as that is BRs next LTS release but Thomas and the team may not be adding anymore packages there as they are already cutting RCs. For older platforms though, llvmpipe is pretty big and should be in there. The difference between that and older sw renderers like softpipe is tremendous.
I do realize the value of llvmpipe, and what it brings compared to softpipe. However, we're already past 2018.02-rc2, and 2018.02 being a LTS release, we really want to avoid introducing major changes that close to the release.
Therefore I don't think llvm and llvmpipe support will make it to 2018.02. However, it should hopefully be in 2018.05, and you can always backport the relevant patches if you want to stick to 2018.02 to benefit from security updates.
Best regards,
Thomas Petazzoni
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering http://bootlin.com
PATCH v2 1/3 package/llvm: new host package
Quoted 9 lines · Thomas Petazzoni
Hello,
Quoted 1 line · Nimai Mahajan
I can test this today at work, but I am using the same target
architecture
Quoted 2 lines
as you, x86. We use this sw rasturizer with a Qt5 app on an old atom platform (that has no modern kernel support for hw accelerated graphics).
Tested! Works just fine on x86. Pulled in BR master, applied the 3 patches successfully, LLVM builds, mesa3d builds and links against it properly.
Quoted 5 lines
Quoted 4 lines
I'd love to see it in 2018.02 if possible as that is BRs next LTS release but Thomas and the team may not be adding anymore packages there as they are already cutting RCs. For older platforms though, llvmpipe is pretty
big
Quoted 9 lines
Quoted 1 line
and should be in there. The difference between that and older sw
renderers
Quoted 1 line
like softpipe is tremendous.
I do realize the value of llvmpipe, and what it brings compared to softpipe. However, we're already past 2018.02-rc2, and 2018.02 being a LTS release, we really want to avoid introducing major changes that close to the release.
Understood, no problem. Thanks for the consideration.
Quoted 6 lines
Therefore I don't think llvm and llvmpipe support will make it to 2018.02. However, it should hopefully be in 2018.05, and you can always backport the relevant patches if you want to stick to 2018.02 to benefit from security updates.
Yes, will do that. It's just a pain in the build process to pre-patch a tagged release rather than just having it committed upstream. But I definitely understand.
Quoted 9 lines
Best regards,
Thomas Petazzoni
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering
http://bootlin.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180220/a25f6a04/attachment.html>
PATCH v2 1/3 package/llvm: new host package
Quoted 7 lines · Nimai Mahajan
Quoted 4 lines · Thomas Petazzoni
Hello,
On Tue, 20 Feb 2018 12:13:54 +0000, Nimai Mahajan wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
I can test this today at work, but I am using the same target
architecture
Quoted 2 lines
as you, x86. We use this sw rasturizer with a Qt5 app on an old atom platform (that has no modern kernel support for hw accelerated graphics).
Tested! Works just fine on x86. Pulled in BR master, applied the 3 patches successfully, LLVM builds, mesa3d builds and links against it properly.
FWIW, in cases like this could you please add a ?Tested-by? tag to your reply, so the tags get picked by the review system (thanks!).
For more info on this, there's a section in the manual about tags used by the Buildroot project:
https://buildroot.org/downloads/manual/manual.html#_reviewing_and_testing_patches
Cheers,
--
Adri?n ?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180220/134439e5/attachment.asc>
PATCH v2 2/3 package/llvm: enable target variant
In reply to Valentin KorenblitFrom: Romain Naour <[email protected]>
This patch installs LLVM libraries for the target (libLLVM*).
Option -DLLVM_BUILD_LLVM_DYLIB=ON allows having all LLVM components in a single shared library. This is used by mesa3d to enable llvmpipe software rasterizer.
Move BR2_PACKAGE_LLVM_ARCH_SUPPORTS and BR2_PACKAGE_LLVM_TARGET_ARCH to package/llvm/Config.in for consistency with other packages.
Define target triple with GNU_TARGET_NAME.
--- package/Config.in | 1 + package/llvm/Config.in | 19 ++++++++++++ package/llvm/llvm.mk | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 package/llvm/Config.in
package/Config.in +1 -0
@@ -1520,6 +1520,7 @@ menu "Other" source "package/libuv/Config.in" source "package/lightning/Config.in" source "package/linux-pam/Config.in" + source "package/llvm/Config.in" if BR2_PACKAGE_LINUX_PAM comment "linux-pam plugins" source "package/libpam-radius-auth/Config.in"
package/llvm/Config.in new file +19 -0
@@ -0,0 +1,19 @@ +config BR2_PACKAGE_LLVM_ARCH_SUPPORTS + bool + # http://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-and-standard-library + # http://llvm.org/docs/GettingStarted.html#local-llvm-configuration + depends on BR2_HOST_GCC_AT_LEAST_4_8 + default y if BR2_i386 || BR2_x86_64 + +config BR2_PACKAGE_LLVM_TARGET_ARCH + string + default "X86" if BR2_i386 || BR2_x86_64 + +config BR2_PACKAGE_LLVM + bool "llvm" + depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS + help + The LLVM Project is a collection of modular and reusable + compiler and toolchain technologies. + + http://llvm.org
package/llvm/llvm.mk +78 -0
278 lines not on this page · raw message
Signature · 1 line
2.14.3
PATCH v2 3/3 package/mesa3d: enable llvm support
In reply to Valentin KorenblitFrom: Romain Naour <[email protected]>
mesa: disable shared libs
--- package/mesa3d/Config.in | 8 ++++++++ package/mesa3d/mesa3d.mk | 18 +++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-)
package/mesa3d/Config.in +8 -0
@@ -25,6 +25,14 @@ menuconfig BR2_PACKAGE_MESA3D if BR2_PACKAGE_MESA3D +config BR2_PACKAGE_MESA3D_LLVM + bool "mesa3d w/ llvm" + depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS + select BR2_PACKAGE_LLVM + +comment "mesa3d w/ llvm needs a llvm compiler" + depends on !BR2_PACKAGE_LLVM_ARCH_SUPPORTS + # inform the .mk file of gallium, dri or vulkan driver selection config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER bool
package/mesa3d/mesa3d.mk +15 -3
@@ -32,6 +32,21 @@ ifeq ($(BR2_SHARED_STATIC_LIBS),y) MESA3D_CONF_OPTS += --disable-static endif +ifeq ($(BR2_PACKAGE_MESA3D_LLVM),y) +# Mesa want to build libgallium.a unconditionally, so it can't be linked dynamically with llvm shared libraries. +MESA3D_DEPENDENCIES += host-llvm llvm +MESA3D_CONF_OPTS += \ + --with-llvm-prefix=$(STAGING_DIR)/usr \ + --disable-llvm-shared-libs \ + --enable-llvm +else +# Avoid automatic search of llvm-config +MESA3D_CONF_OPTS += \ + --with-llvm-prefix=$(STAGING_DIR)/usr \ + --disable-llvm-shared-libs \ + --disable-llvm +endif + # The Sourcery MIPS toolchain has a special (non-upstream) feature to # have "compact exception handling", which unfortunately breaks with # mesa3d, so we disable it here by passing -mno-compact-eh.
@@ -219,7 +234,4 @@ else MESA3D_CONF_OPTS += --disable-lmsensors endif -# Avoid automatic search of llvm-config -MESA3D_CONF_OPTS += --with-llvm-prefix=$(STAGING_DIR)/usr/bin - $(eval $(autotools-package))
Signature · 1 line
2.14.3
v2 cover llvm for mesa3d
In reply to Valentin KorenblitHi Valentin,
Thanks for these patches - I've been looking at getting the llvmpipe mesa3d driver going on the Dragonboard 410C, which uses the freedreno driver. The work you've done here gets me very close, but I'm having one last issue I thought you might know something about.
I'm having to patch in a change to enable this for AARCH64 on top of the changes that you've made, but it looks like I'm ending up with the LLVM tools generating output for the host architecture, x86_64-unknown-linux-gnu, rather than the target architecture. As such I'm getting the "No available targets are compatible with this triple" error when llvmpipe gets initialised.
The changes I made to enable compilation were:
package/llvm/Config.in 2018-02-21 11:49:39.638970682 +1300 renamed from package/llvm/Config.in 2018-02-22 09:49:46.635210136 +1300 +0 -0
@@ -3,11 +3,12 @@ #
http://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-and-standard-library
# http://llvm.org/docs/GettingStarted.html#local-llvm-configuration
depends on BR2_HOST_GCC_AT_LEAST_4_8
- default y if BR2_i386 || BR2_x86_64 + default y if BR2_i386 || BR2_x86_64 || BR2_aarch64
config BR2_PACKAGE_LLVM_TARGET_ARCH
string
default "X86" if BR2_i386 || BR2_x86_64
+ default "AArch64" if BR2_aarch64
config BR2_PACKAGE_LLVM
bool "llvm"
In addition I've tried tinkering with LLVM_NATIVE_ARCH, and LLVM_TARGET_TRIPLE_ENV, but haven't had much luck.
I don't suppose you have any thoughts on what I might have missed? I'm assuming that there is some confusion over the host llvm vs. the target. I appreciate that your initial patch targeted x86 only, so if you're still working on the ARM support then it may be easiest if I wait on that.
Regards,
Andre
Quoted 53 lines · On Tue, 20 Feb 2018 at 06:18 Valentin Korenblit <[email protected]>…
Hello all,
This series provides LLVM support for Mesa3d, enabling llvmpipe software rasterizer.
It must be considered that it does not provide a full LLVM installation for the host, only the necessary components to cross-compile LLVM for the target. It will install all target components as libLLVM.so.
Changes in v2:
The series has been simplified:
*Build only backend for target architecture by default.
*Support for AMDGPU(PATCH 3/4 in v1) was removed because I cannot test it currently.
*Host: make options modified to build only llvm-config and llvm-tblgen (reduces drastically build time for host).
*Target: support only x86 currently (tested), I will test on ARM soon.
The idea is to add incrementally more options to configure LLVM as soon as I can test them.
Regards,
Valent?n
Romain Naour (3):
package/llvm: new host package
package/llvm: enable target variant
package/mesa3d: enable llvm supportpackage/Config.in | 1 + package/Config.in.host | 1 + package/llvm/Config.in | 19 +++ package/llvm/Config.in.host | 8 + package/llvm/llvm.hash | 2 + package/llvm/llvm.mk | 360 ++++++++++++++++++++++++++++++++++++++++++++ package/mesa3d/Config.in | 8 + package/mesa3d/mesa3d.mk | 18 ++- 8 files changed, 414 insertions(+), 3 deletions(-) create mode 100644 package/llvm/Config.in create mode 100644 package/llvm/Config.in.host create mode 100644 package/llvm/llvm.hash create mode 100644 package/llvm/llvm.mk
Quoted 8 lines
--
2.14.3_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180221/7c910628/attachment.html>
v2 cover llvm for mesa3d
Quoted 6 lines · Andre Renaud
Hi Valentin,
Thanks for these patches - I've been looking at getting the llvmpipe mesa3d driver going on the Dragonboard 410C, which uses the freedreno driver. The work you've done here gets me very close, but I'm having one last issue I thought you might know something about.
Quoted 7 lines
I'm having to patch in a change to enable this for AARCH64 on top of the changes that you've made, but it looks like I'm ending up with the LLVM tools generating output for the host architecture, x86_64-unknown-linux-gnu, rather than the target architecture. As such I'm getting the "No available targets are compatible with this triple" error when llvmpipe gets initialised.
Hi Andre,
Today I will start working on aarch64, so I'll check that. I guess that error should be related to TARGETS_TO_BUILD.
Quoted 10 lines
The changes I made to enable compilation were:
package/llvm/Config.in2018-02-21 11:49:39.638970682 +1300 renamed from package/llvm/Config.in2018-02-22 09:49:46.635210136 +1300 +0
-0@@ -3,11 +3,12 @@ #http://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-and-standard-library
# http://llvm.org/docs/GettingStarted.html#local-llvm-configuration
depends onBR2_HOST_GCC_AT_LEAST_4_8package/llvm/Config.in2018-02-21 11:49:39.638970682 +1300 renamed from package/llvm/Config.in2018-02-22 09:49:46.635210136 +1300 +1
-1-default y if BR2_i386 || BR2_x86_64 +default y if BR2_i386 || BR2_x86_64 || BR2_aarch64
Quoted 7 lines
?config
BR2_PACKAGE_LLVM_TARGET_ARCH
string
default "X86" ifBR2_i386||BR2_x86_64
+default "AArch64" ifBR2_aarch64
?configBR2_PACKAGE_LLVM
bool "llvm"
Your changes are ok, it shouldn't be necessary to do other modifications, but I haven't tested it yet.
Quoted 8 lines
In addition I've tried tinkering with
LLVM_NATIVE_ARCH, andLLVM_TARGET_TRIPLE_ENV, but haven't had much luck.I don't suppose you have any thoughts on what I might have missed? I'm assuming that there is some confusion over the host llvm vs. the target. I appreciate that your initial patch targeted x86 only, so if you're still working on the ARM support then it may be easiest if I wait on that.
?I will keep you up to date.
Quoted 61 lines
Regards,
AndreOn Tue, 20 Feb 2018 at 06:18 Valentin Korenblit <valentin.korenblit at smile.fr <mailto:[email protected]>> wrote:
Hello all,
This series provides LLVM support for Mesa3d, enabling llvmpipe software rasterizer.
It must be considered that it does not provide a full LLVM installation for the host, only the necessary components to cross-compile LLVM for the target. It will install all target components as libLLVM.so.
Changes in v2:
The series has been simplified:
*Build only backend for target architecture by default.
*Support for AMDGPU(PATCH 3/4 in v1) was removed because I cannot test it currently.
*Host: make options modified to build only llvm-config and llvm-tblgen (reduces drastically build time for host).
*Target: support only x86 currently (tested), I will test on ARM soon.
The idea is to add incrementally more options to configure LLVM as soon
as I can test them.Regards,
Valent?n
Romain Naour (3):
? package/llvm: new host package
? package/llvm: enable target variant
? package/mesa3d: enable llvm support?package/Config.in? ? ? ? ? ?|? ?1 + ?package/Config.in.host? ? ? |? ?1 + ?package/llvm/Config.in? ? ? |? 19 +++ ?package/llvm/Config.in.host |? ?8 + ?package/llvm/llvm.hash? ? ? |? ?2 + ?package/llvm/llvm.mk <http://llvm.mk> ? | 360
++++++++++++++++++++++++++++++++++++++++++++
?package/mesa3d/Config.in? ? |? ?8 + ?package/mesa3d/mesa3d.mk <http://mesa3d.mk> ? |? 18 ++- ?8 files changed, 414 insertions(+), 3 deletions(-) ?create mode 100644 package/llvm/Config.in ?create mode 100644 package/llvm/Config.in.host ?create mode 100644 package/llvm/llvm.hash ?create mode 100644package/llvm/llvm.mk<http://llvm.mk>
Quoted 8 lines
--
2.14.3_______________________________________________
buildroot mailing list
buildroot at busybox.net <mailto:[email protected]>
http://lists.busybox.net/mailman/listinfo/buildroot
Best regards,
Valent?n
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180222/011265c0/attachment.html>