Commit Graph

83216 Commits

Author SHA1 Message Date
Francisco Jerez 1942490bae clover: Unify program::build_* into a single method returning a struct.
This gets rid of the program::build_* query methods and replaces them
with the program::build() method that returns a single data structure
containing all parameters for the last build done on the given target
device (including build logs, options and the binary itself).

[ Serge Martin: Fix inverted opts and log build ctor args ]

Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:34:34 -07:00
Serge Martin 7f6a4a4342 clover: Change program::build opts argument to std::string.
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:34:34 -07:00
Francisco Jerez 2a73ae662c clover: Define error subclass to signal build option parse failure.
Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:34:34 -07:00
Francisco Jerez 4ef1c0918d clover: Move back to using build_error to signal compilation failure.
This partially reverts 7e0180d57d.
Having two different exception subclasses for compilation and linking
makes it more difficult to share or move code between the two
codepaths, because the exact same function under the same error
condition would need to throw one exception or the other depending on
what top-level API is being implemented with it.  There is little
benefit anyway because clCompileProgram() and clLinkProgram() can tell
whether they are linking or compiling a program.

Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:34:34 -07:00
Serge Martin 70fe6267a3 clover: Override ret_object.
Return an API object from an intrusive reference to a Clover object,
incrementing the reference count of the object.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:34:34 -07:00
Francisco Jerez 85309e8b55 clover/tgsi: Add stub link_program() function.
Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:34:34 -07:00
Francisco Jerez ba613636e8 clover/tgsi: Move compiler entry point declaration into tgsi directory and namespace.
Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:34:34 -07:00
Francisco Jerez fb3eeb1314 clover/llvm: Implement the -create-library linker option.
[ Serge Martin: disable internalize pass when building a library.
  Otherwise some functions may be inlined and removed ]

Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:34:34 -07:00
Francisco Jerez 9de3f4a59f clover/llvm: Implement linkage of multiple clover modules.
Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:34:34 -07:00
Francisco Jerez 132b6ccd4f clover/llvm: Split compilation and linking.
Split the work previously done by compile_program_llvm() into
compile_program() (which simply runs the front-end and serializes the
resulting LLVM IR) and link_program() (which takes care of everything
else down to binary codegen).

[ Serge Martin: allow LLVM IR dump after compilation ]

Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:34:34 -07:00
Francisco Jerez 1a7d11aa3d clover/llvm: Implement library bitcode codegen.
Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:34:34 -07:00
Francisco Jerez 86100e13ab clover/llvm: Trivial assorted cleanups for invocation.cpp.
Drop a few include and using directives which are no longer necessary.

Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:34:34 -07:00
Francisco Jerez 520cc26859 clover/llvm: Split native codegen into separate file.
Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:34:34 -07:00
Francisco Jerez 8195637363 clover/llvm: Split bitcode codegen into separate file.
Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:34:33 -07:00
Francisco Jerez 71ac9820d6 clover/llvm: Split shared codegen support code into separate file.
This is the common part of the code used to generate a clover::module
from LLVM bitcode, shared between the native and LLVM paths.

Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:34:33 -07:00
Francisco Jerez 26fa9bfd0d clover/llvm: Define function for bitcode print-out.
Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:34:33 -07:00
Francisco Jerez f0721020ad clover/llvm: Split native codegen and assembly print-out into separate functions.
Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:34:33 -07:00
Francisco Jerez 1d042adc0a clover/llvm: Clean up bitcode codegen.
Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:34:33 -07:00
Francisco Jerez 952d1e6fd6 clover/llvm: Use metadata introspection utils for kernel enumeration.
Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:34:33 -07:00
Francisco Jerez d37d5842c1 clover/llvm: Use metadata introspection utils for kernel argument set-up.
Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:34:33 -07:00
Francisco Jerez 3ed31bbf05 clover/llvm: Add simplified utility functions for metadata introspection.
v2: Fix for latest LLVM from SVN.

Reviewed-by: Serge Martin <edb+mesa@sigluy.net> (v1)
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:34:30 -07:00
Francisco Jerez 7da2c1ff0f clover/llvm: Clean up codestyle of get_kernel_args().
Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:22:59 -07:00
Francisco Jerez 0601fe7438 clover/llvm: Fold compile_native() call into build_module_native().
Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:22:56 -07:00
Francisco Jerez f98422eafd clover/llvm: Factor out duplicated construction of clover::module.
Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:22:53 -07:00
Francisco Jerez 3ce6ab068c clover/llvm: Clean up compile_native().
This switches compile_native() to the C++ API (which the rest of this
file makes use of anyway so there is little benefit from using the C
API), what should get rid of an amount of boilerplate and fix a leak
of the TargetMachine object in the error path.

v2: Additional fixes for LLVM 3.6.
v3: Update for the latest LLVM SVN changes.

Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:22:50 -07:00
Francisco Jerez 7bcefa5903 clover/llvm: Clean up ELF parsing.
This function was doing three separate things:
 - Initializing and releasing the ELF parsing state (the latter can be
   better done using RAII).
 - Searching for the symbol table in the ELF file.
 - Extraction of kernel symbol offsets from the symbol table.

Split each one into a separate function for clarity and clean up the
result slightly.

Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:22:48 -07:00
Francisco Jerez 574477e599 clover/llvm: Move a bunch of utility functions into separate file.
Some of these will be useful from a different compilation unit in the
same subtree so put them in a publicly accessible header file.

Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:22:43 -07:00
Francisco Jerez 92247cef3f clover/llvm: Tidy debug handling.
Most significant change is debugging flags are now a scoped enum and
all debugging helpers live in the debug namespace.

Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:22:40 -07:00
Francisco Jerez 4614397ac2 clover/llvm: Use helper function to abort compilation with error message.
Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:22:37 -07:00
Francisco Jerez 423eecb76a clover/llvm: Simplify diagnostic_handler().
Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:22:29 -07:00
Francisco Jerez 5884dfbc2a clover/llvm: Trivial codestyle clean-up for optimize().
Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:22:21 -07:00
Francisco Jerez bdc27f13d5 clover/llvm: Clean up compilation into LLVM IR.
Some assorted and mostly trivial clean-ups for the source to bitcode
compilation path.

Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:21:50 -07:00
Francisco Jerez 714b167f57 clover/llvm: Factor out LLVM context init.
So it can be shared between the compilation and linking codepaths.

Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:21:30 -07:00
Francisco Jerez fa94055d53 clover/llvm: Declare compiler instance at top level and pass down as argument.
This allows simplifying the interface of compile_llvm() because it no
longer needs to read out and return the optimization level and address
space map from the compiler instance.  Instead declare the compiler
instance at the top level so that both properties are available
directly.

Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:21:13 -07:00
Francisco Jerez a27d4ec3b9 clover/llvm: Refactor compiler instance initialization.
This will be shared between the compiler and linker codepaths.

Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:21:08 -07:00
Francisco Jerez c2a167ad73 clover/llvm: Factor out compiler option tokenization.
Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:20:47 -07:00
Francisco Jerez c513cfa747 clover/llvm: Factor out target string parsing.
Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:20:41 -07:00
Francisco Jerez 251054220e clover/llvm: Collect #ifdef mess into a separate file.
This gets rid of most ifdef's from the invocation.cpp code -- Only a
couple of them are left which will be removed differently in the
following commits.

Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:20:12 -07:00
Francisco Jerez 11afde89b8 clover/llvm: Drop dead code.
This ifdef'ed out code was meant to handle compilation into TGSI, but
it doesn't seem likely that it will ever be useful even if the TGSI
back-end is resurrected because the TGSI bitcode can just be plumbed
through in ELF format and dealt with as a regular "native" back-end.

Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:20:05 -07:00
Francisco Jerez 600ac51448 clover/llvm: Drop support for LLVM < 3.6.
Reviewed-by: Serge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:19:49 -07:00
Serge Martin 8624888d6f clover: Bump required LLVM version to 3.6.
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2016-07-11 20:19:14 -07:00
Ilia Mirkin da7223ebdc mesa: set _NEW_BUFFERS when updating texture bound to current buffers
When a glTexImage call updates the parameters of a currently bound
framebuffer, we might miss out on revalidating whether it is complete.
Make sure to set _NEW_BUFFERS which will trigger the revalidation in
that case.

Also while we're at it, fix the fb parameter passed in to the eventual
RenderTexture call.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94148
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
2016-07-11 21:18:05 -04:00
Ilia Mirkin 8b7607d28a meta/texsubimage: tex_image is always non-null, avoid confusing code
Probably a copy-paste from mesa_meta_pbo_GetTexSubImage where tex_image
may apparently be null.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-07-11 21:18:05 -04:00
Ilia Mirkin 00d4315d37 st/mesa: return appropriate mesa format for ETC texture formats
Even when the backend driver does not support ETC formats, we handle the
decoding into an uncompressed backing texture. However as far as core
mesa is concerned, it's an ETC texture and we should return the relevant
ETC mesa format. This condition can get hit when using glTexStorage to
create the texture object.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
2016-07-11 21:17:30 -04:00
Ilia Mirkin 8ee3cdde04 mesa: etc2 online compression is unsupported, don't attempt it
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
2016-07-11 21:17:01 -04:00
Ben Skeggs 0d911a720d nvc0: initial support for GP100 GPUs
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2016-07-12 10:56:35 +10:00
Samuel Pitoiset 9bc083284f nvc0: use a define for the driver constant buffer size
This might avoid mistakes if the size is bumped in the future.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2016-07-11 22:30:41 +02:00
Samuel Pitoiset 31a615677b nvc0: fix the driver cb size when draw parameters are used
The size of the driver constant buffer for each stage should be 2048
and not 512 because it has been increased recently for buffers/images.
While we are at it, do the same change for indirect draws.

This fixes all ARB_shader_draw_parameters tests on GM107.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: 12.0 <mesa-stable@lists.freedesktop.org>
2016-07-11 22:11:27 +02:00
Samuel Pitoiset 19d0450b27 nvc0/ir: fix images indirect access on Fermi
This fixes the following piglits:

arb_arrays_of_arrays-basic-imagestore-mixed-const-non-const-uniform-index
arb_arrays_of_arrays-basic-imagestore-mixed-const-non-const-uniform-index2

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: 12.0 <mesa-stable@lists.freedesktop.org>
2016-07-11 21:01:21 +02:00
Marek Olšák 33c8723980 st/mesa: remove st_dump_program_for_shader_db
replaced by MESA_SHADER_CAPTURE_PATH in core Mesa

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-07-11 19:06:05 +02:00