[Mesa-dev] [Mesa-stable] [PATCH] automake: add SWR LLVM gen_builder.hpp workaround

Rowley, Timothy O timothy.o.rowley at intel.com
Fri May 19 19:50:44 UTC 2017


Thanks for doing this; I would have been hunting for the dist-hook: magic for a while.

Tested “make dist” on llvm-3.9.0 (works) and llvm-4.0/llvm-svn (fails, expected desired behavior).

Built result of llvm-3.9.0 “make dist” with llvm-4.0 and llvm-svn and it compiles/works.

Reviewed-by: Tim Rowley <timothy.o.rowley at intel.com<mailto:timothy.o.rowley at intel.com>>

On May 19, 2017, at 12:31 PM, Emil Velikov <emil.l.velikov at gmail.com<mailto:emil.l.velikov at gmail.com>> wrote:

From: Emil Velikov <emil.velikov at collabora.com<mailto:emil.velikov at collabora.com>>

As gen_builder.hpp file is generated, it contains information that is
specific to the LLVM version it originates from.

As suggested by Tim, the file seems to be forwards compatible. So in
order to produce ship a file which will work everywhere we should be
using earlies supported LLVM - 3.9.

With this we're back on track and can build all of mesa without
python/mako/flex and friends.

In the long term we might want to see if the python generators can be
updated to produce LLVM version agnostic files. At least within the
range supported by SWR.

Cc: <mesa-stable at lists.freedesktop.org<mailto:mesa-stable at lists.freedesktop.org>>
Cc: Chuck Atkins <chuck.atkins at kitware.com<mailto:chuck.atkins at kitware.com>>
Cc: Tim Rowley <timothy.o.rowley at intel.com<mailto:timothy.o.rowley at intel.com>>
Signed-off-by: Emil Velikov <emil.velikov at collabora.com<mailto:emil.velikov at collabora.com>>
---
configure.ac                        |  4 ++++
src/gallium/drivers/swr/Makefile.am | 41 ++++++++++---------------------------
2 files changed, 15 insertions(+), 30 deletions(-)

diff --git a/configure.ac b/configure.ac
index ce5301f3e45..3d10a4b8935 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2472,6 +2472,10 @@ if test -n "$with_gallium_drivers"; then
    done
fi

+# XXX: Keep in sync with LLVM_REQUIRED_SWR
+AM_CONDITIONAL(SWR_INVALID_LLVM_VERSION, test "x$LLVM_VERSION" != x3.9.0 -a \
+                                              "x$LLVM_VERSION" != x3.9.1)
+
if test "x$enable_llvm" = "xyes" -a "$with_gallium_drivers"; then
    llvm_require_version $LLVM_REQUIRED_GALLIUM "gallium"
    llvm_add_default_components "gallium"
diff --git a/src/gallium/drivers/swr/Makefile.am b/src/gallium/drivers/swr/Makefile.am
index 0d71f52b1e6..7b2da074162 100644
--- a/src/gallium/drivers/swr/Makefile.am
+++ b/src/gallium/drivers/swr/Makefile.am
@@ -56,6 +56,7 @@ BUILT_SOURCES = \
rasterizer/codegen/gen_knobs.cpp \
rasterizer/codegen/gen_knobs.h \
rasterizer/jitter/gen_state_llvm.h \
+ rasterizer/jitter/gen_builder.hpp \
rasterizer/jitter/gen_builder_x86.hpp \
rasterizer/archrast/gen_ar_event.hpp \
rasterizer/archrast/gen_ar_event.cpp \
@@ -168,20 +169,6 @@ COMMON_LDFLAGS = \
$(LLVM_LDFLAGS)


-# XXX: As we cannot use BUILT_SOURCES (the files will end up in the dist
-# tarball) just annotate the dependency directly.
-# As the single direct user of gen_builder.hpp is a header (builder.h) trace all
-# the translusive users (one that use the latter header).
-rasterizer/jitter/blend_jit.cpp: rasterizer/jitter/gen_builder.hpp
-rasterizer/jitter/builder.cpp: rasterizer/jitter/gen_builder.hpp
-rasterizer/jitter/builder_misc.cpp: rasterizer/jitter/gen_builder.hpp
-rasterizer/jitter/fetch_jit.cpp: rasterizer/jitter/gen_builder.hpp
-rasterizer/jitter/streamout_jit.cpp: rasterizer/jitter/gen_builder.hpp
-swr_shader.cpp: rasterizer/jitter/gen_builder.hpp
-
-CLEANFILES = \
- rasterizer/jitter/gen_builder.hpp
-
lib_LTLIBRARIES = libswrAVX.la<http://libswrAVX.la> libswrAVX2.la<http://libswrAVX2.la>

libswrAVX_la_CXXFLAGS = \
@@ -192,14 +179,6 @@ libswrAVX_la_CXXFLAGS = \
libswrAVX_la_SOURCES = \
$(COMMON_SOURCES)

-# XXX: Don't ship these generated sources for now, since they are specific
-# to the LLVM version they are generated from. Thus a release tarball
-# containing the said files, generated against eg. LLVM 3.8 will fail to build
-# on systems with other versions of LLVM eg. 3.7 or 3.6.
-# Move these back to BUILT_SOURCES once that is resolved.
-nodist_libswrAVX_la_SOURCES = \
- rasterizer/jitter/gen_builder.hpp
-
libswrAVX_la_LIBADD = \
$(COMMON_LIBADD)

@@ -214,14 +193,6 @@ libswrAVX2_la_CXXFLAGS = \
libswrAVX2_la_SOURCES = \
$(COMMON_SOURCES)

-# XXX: Don't ship these generated sources for now, since they are specific
-# to the LLVM version they are generated from. Thus a release tarball
-# containing the said files, generated against eg. LLVM 3.8 will fail to build
-# on systems with other versions of LLVM eg. 3.7 or 3.6.
-# Move these back to BUILT_SOURCES once that is resolved.
-nodist_libswrAVX2_la_SOURCES = \
- rasterizer/jitter/gen_builder.hpp
-
libswrAVX2_la_LIBADD = \
$(COMMON_LIBADD)

@@ -230,6 +201,16 @@ libswrAVX2_la_LDFLAGS = \

include $(top_srcdir)/install-gallium-links.mk

+# Generated gen_builder.hpp is not backwards compatible. So ship only one
+# created with the oldest supported version of LLVM.
+dist-hook:
+if SWR_INVALID_LLVM_VERSION
+ @echo "*******************************************************"
+ @echo "LLVM 3.9.0 or LLVM 3.9.1 required to create the tarball"
+ @echo "*******************************************************"
+ @test
+endif
+
EXTRA_DIST = \
SConscript \
rasterizer/archrast/events.proto \
--
2.12.2

_______________________________________________
mesa-stable mailing list
mesa-stable at lists.freedesktop.org<mailto:mesa-stable at lists.freedesktop.org>
https://lists.freedesktop.org/mailman/listinfo/mesa-stable

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170519/fb206c60/attachment-0001.html>


More information about the mesa-dev mailing list