summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir
Commit message (Collapse)AuthorAgeFilesLines
* nir/lower_io: Allow for a full bitmask of modesJason Ekstrand2016-04-132-7/+7
| | | | | | Acked-by: Eric Anholt <[email protected]> Reviewed-by: Rob Clark <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* nir/lower_indirect: nir_variable_mode is now a bitfieldJason Ekstrand2016-04-132-7/+7
| | | | | | Acked-by: Eric Anholt <[email protected]> Reviewed-by: Rob Clark <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* nir: Convert nir_variable_mode to a bitfieldJason Ekstrand2016-04-132-17/+19
| | | | | | | | | There are several passes where we need to specify some set of variable modes that the pass needs top operate on. This lets us easily do that. Acked-by: Eric Anholt <[email protected]> Reviewed-by: Rob Clark <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* nir/clone: Copy bit size when cloning registersJason Ekstrand2016-04-121-0/+1
| | | | | Reported-by: Mark Janes <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
* nir: Fix typo in commentIan Romanick2016-04-111-1/+1
| | | | | | Trivial. Signed-off-by: Ian Romanick <[email protected]>
* nir: Merge redudant integer clamping.Markus Wick2016-04-111-1/+4
| | | | | | | | | Dolphin uses them a lot. Range tracking would be better in the long term, but this two lines works fine for now. Signed-off-by: Markus Wick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Silence unused "options" warning in algebraic passes.Kenneth Graunke2016-04-111-0/+1
| | | | | | | | | | | Some passes may not refer to options->..., at which point the compiler will warn about an unused variable. Just cast to void unconditionally to shut it up. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* nir: Do basic constant reassociation.Kenneth Graunke2016-04-111-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many shaders contain expression trees of the form: const_1 * (value * const_2) Reorganizing these to (const_1 * const_2) * value will allow constant folding to combine the constants. Sometimes, these constants are 2 and 0.5, so we can remove a multiply altogether. Other times, it can create more immediate constants, which can actually hurt. Finding a good balance here is tricky. While much more could be done, this simple patch seems to have a lot of positive benefit while having a low downside. shader-db results on Broadwell: total instructions in shared programs: 8963768 -> 8961369 (-0.03%) instructions in affected programs: 438318 -> 435919 (-0.55%) helped: 1502 HURT: 245 total cycles in shared programs: 71527354 -> 71421516 (-0.15%) cycles in affected programs: 11541788 -> 11435950 (-0.92%) helped: 3445 HURT: 1224 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* nir/lower_system_values: Add support for several computed valuesJason Ekstrand2016-04-112-3/+73
| | | | Reviewed-by: Rob Clark <[email protected]>
* compiler: remove {glsl,nir}/Makefile.sourcesEmil Velikov2016-04-111-79/+0
| | | | | | | | | No longer used as of last commit. v2: Rebase. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Jason Ekstrand <[email protected]> (v1)
* nir: add a pass for lowering (un)pack_double_2x32Connor Abbott2016-04-113-0/+98
| | | | | | | | | | | | | | | | | | | v2: Undo unintended change to the signature of nir_normalize_cubemap_coords (Iago). v3: Move to compiler/nir (Iago) v4: Remove Authors from copyright header (Michael Schellenberger) v5 (Sam): - Use nir_channel() and nir_ssa_for_alu_src() helpers (Jason) - Inline lower_double_pack_instr() code into lower_double_pack_block() (Jason). - Initialize nir_builder at lower_double_pack_impl() (Jason). Signed-off-by: Iago Toral Quiroga <[email protected]> Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: add split versions of (un)pack_double_2x32Connor Abbott2016-04-111-0/+36
| | | | | | | | v2 (Sam): - Use uint64 instead of float64 for sources and destinations. (Connor) Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: don't try to scalarize unpack_double_2x32Connor Abbott2016-04-111-0/+3
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* nir: add support for (un)pack_double_2x32Connor Abbott2016-04-112-0/+35
| | | | | | | | v2 (Sam): - Use uint64 instead of float64 for sources and destinations. (Connor) Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: add i2d and u2d opcodesIago Toral Quiroga2016-04-112-0/+10
| | | | | | | v2: - Assert supports_int and don't fallback to nir_fmov (Jason) Reviewed-by: Jason Ekstrand <[email protected]>
* nir: add d2i, d2u, d2b opcodesIago Toral Quiroga2016-04-112-0/+6
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* nir: add support for d2f and f2dConnor Abbott2016-04-112-0/+5
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* nir/glsl_to_nir: set bit_size on ssbo_load resultIago Toral Quiroga2016-04-111-2/+3
| | | | | | | v2 (Sam): - Add missing bit_size assignment when ssbo_load destination is a boolean. Reviewed-by: Jason Ekstrand <[email protected]>
* nir/glsl_to_nir: add bit-size info to add_instr()Samuel Iglesias Gonsálvez2016-04-111-10/+14
| | | | | Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir/split_var_copies: handle doublesConnor Abbott2016-04-111-0/+2
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* nir/instr_set: handle 64-bit bit-sizesConnor Abbott2016-04-111-5/+17
| | | | | | | v2: Revert spurious change in nir_opt_cse.c (Iago) Signed-off-by: Iago Toral Quiroga <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: handle doubles in nir_deref_get_const_initializer_load()Connor Abbott2016-04-111-1/+5
| | | | | | | | v2 (Sam): - Use proper bitsize value when calling to nir_load_const_instr_create() (Jason). Reviewed-by: Jason Ekstrand <[email protected]>
* nir/print: add support for printing doubles and bitsizeConnor Abbott2016-04-111-3/+16
| | | | | | | | | | | v2: - Squash the printing doubles related patches into one patch (Sam). v3: - Print using PRIx64 format: long is 32-bit on some 32-bit platforms but long long is basically always 64-bit (Jason). Reviewed-by: Jason Ekstrand <[email protected]>
* nir/glsl_to_nir: support doublesConnor Abbott2016-04-111-26/+38
| | | | | | | | v2: - Don't set sized types to the destination of texture related opcodes. (Jason) Reviewed-by: Jason Ekstrand <[email protected]>
* nir/lower_load_const_to_scalar: support doubles and multiple bit sizesIago Toral Quiroga2016-04-111-2/+6
| | | | | | | v2 (Sam): - Add assert to detect bitsizes differents than 32 and 64 (Jason). Reviewed-by: Jason Ekstrand <[email protected]>
* nir/lower_to_source_mods: Handle different bit sizesIago Toral Quiroga2016-04-111-2/+3
| | | | | | | v2 (Sam): - Use helper to get base type from nir_alu_type. Reviewed-by: Jason Ekstrand <[email protected]>
* nir: add bit_size info to nir_load_const_instr_create()Samuel Iglesias Gonsálvez2016-04-119-15/+20
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* nir/lower_vec: adapt to different bit sizesConnor Abbott2016-04-111-0/+1
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* nir: add bit_size info to nir_ssa_undef_instr_create()Samuel Iglesias Gonsálvez2016-04-119-12/+20
| | | | | | | | v2: - Make the users to give the right bit_sizes as arguments (Jason). Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir/locals_to_regs: adapt to different bit sizesConnor Abbott2016-04-111-0/+1
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* nir/from_ssa: adapt to different bit sizesConnor Abbott2016-04-111-0/+2
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Add a pass for gathering various bits of shader infoJason Ekstrand2016-04-103-0/+163
| | | | | Reviewed-by: Rob Clark <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Use PRIi64 and PRIu64 instead of %ld and %lu.Kenneth Graunke2016-04-041-2/+3
| | | | | | | | | %ld and %lu aren't the right format specifiers for int64_t and uint64_t on 32-bit (x86) systems. They're %zu on Linux and %Iu on Windows. Use the standard C99 macros in hopes that they work everywhere. Signed-off-by: Kenneth Graunke <[email protected]>
* nir/search: Don't match inexact expressions with exact subexpressionsJason Ekstrand2016-04-041-5/+18
| | | | | | | | | | | | | | | | | | | | In the first pass of implementing exact handling, I made a mistake with search-and-replace. In particular, we only reallly handled exact/inexact on the root of the tree. Instead, we need to check every node in the tree for an exact/inexact match. As an example of this, consider the following GLSL code precise float a = b + c; if (a < 0) { do_stuff(); } In that case, only the add will be declared "exact" and an expression that looks for "b + c < 0" will still match and replace it with "b < -c" which may yield different results. The solution is to simply bail if any of the values are exact when matching an inexact expression. Reviewed-by: Ian Romanick <[email protected]>
* nir: Add an opcode for stomping a 32-bit value to 16-bit precisionJason Ekstrand2016-04-011-0/+1
| | | | | | This correlates directly to the SPIR-V opcode OpQuantizeToF16 Reviewed-by: Rob Clark <[email protected]>
* nir: Simplify a bcsel to logical-orIan Romanick2016-03-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Oddly, this did not affect the shader where I first noticed the pattern. That particular shader doesn't get its if-statement converted to a bcsel because there are two assignments in the else-statement. This led to me submitting https://bugs.freedesktop.org/show_bug.cgi?id=94747. shader-db results: Sandy Bridge total instructions in shared programs: 8467384 -> 8467069 (-0.00%) instructions in affected programs: 36594 -> 36279 (-0.86%) helped: 46 HURT: 0 total cycles in shared programs: 117573448 -> 117568518 (-0.00%) cycles in affected programs: 339114 -> 334184 (-1.45%) helped: 46 HURT: 0 Ivy Bridge / Haswell / Broadwell / Skylake: total instructions in shared programs: 7774258 -> 7773999 (-0.00%) instructions in affected programs: 30874 -> 30615 (-0.84%) helped: 46 HURT: 0 total cycles in shared programs: 65739190 -> 65734530 (-0.01%) cycles in affected programs: 180380 -> 175720 (-2.58%) helped: 45 HURT: 1 No change on G45 or Ironlake. I also tried these expressions, but none of them affected any shaders in shader-db: (('bcsel', a, 'a@bool', 'b@bool'), ('ior', a, b)), (('bcsel', a, 'b@bool', False), ('iand', a, b)), (('bcsel', a, 'b@bool', 'a@bool'), ('iand', a, b)), Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Fix typo from commit 6702f1acde9.Matt Turner2016-03-301-1/+1
|
* nir: Propagate negates up multiplication chains.Matt Turner2016-03-301-0/+4
| | | | | | | | | | total instructions in shared programs: 7112159 -> 7088092 (-0.34%) instructions in affected programs: 1374915 -> 1350848 (-1.75%) helped: 7392 HURT: 621 GAINED: 2 LOST: 2
* nir: Add a helper for getting the current block from a cursorJason Ekstrand2016-03-281-0/+11
| | | | Reviewed-by: Rob Clark <[email protected]>
* nir/lower_out_to_temp: Add an "entrypoint" parameterJason Ekstrand2016-03-283-4/+5
| | | | | | | | Previously, the pass assumed that the entrypoint would be whatever function happened to have the name "main". We really shouldn't trust in the function names. Reviewed-by: Rob Clark <[email protected]>
* nir/lower_out_to_temp: Steal the output's constant initializerJason Ekstrand2016-03-281-0/+3
| | | | Reviewed-by: Rob Clark <[email protected]>
* nir: Add a helper for getting the unique function in a shaderJason Ekstrand2016-03-281-0/+11
| | | | Reviewed-by: Rob Clark <[email protected]>
* nir/sweep: Sweep function parametersJason Ekstrand2016-03-281-0/+2
| | | | | | | They are no longer in the list of local variables so we need to explicitly sweep them. Reviewed-by: Rob Clark <[email protected]>
* nir/builder: Add a helper for creating undefsJason Ekstrand2016-03-281-0/+14
| | | | Reviewed-by: Rob Clark <[email protected]>
* nir/builder: Add a helper for storing to variable derefsJason Ekstrand2016-03-281-0/+16
| | | | Reviewed-by: Rob Clark <[email protected]>
* nir/builder: Add a helper for building fdot instructionsJason Ekstrand2016-03-281-0/+17
| | | | Reviewed-by: Rob Clark <[email protected]>
* nir: Add a variable_foreach_safe helperJason Ekstrand2016-03-281-0/+3
| | | | Reviewed-by: Rob Clark <[email protected]>
* nir/Makefile: Fix alphabetizationJason Ekstrand2016-03-281-3/+3
| | | | Reviewed-by: Rob Clark <[email protected]>
* nir: Add a pass to inline functionsJason Ekstrand2016-03-243-0/+273
| | | | | | | This commit adds a new NIR pass that lowers all function calls away by inlining the functions. Reviewed-by: Jordan Justen <[email protected]>
* nir/builder: Add helpers for easily inserting copy_var intrinsicsJason Ekstrand2016-03-241-0/+23
| | | | Reviewed-by: Jordan Justen <[email protected]>