summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir
Commit message (Collapse)AuthorAgeFilesLines
* nir/gather_info: Add an assert for supported stagesJason Ekstrand2016-04-011-0/+6
|
* nir: Move variable_get_io_mask back into gather_infoJason Ekstrand2016-04-012-31/+31
| | | | | | It used to be in nir_gather_info.c until I moved it out to nir.h so it could be re-used with some linking code that never got merged. We'll move it back out if and when we have real code to share it with.
* Merge remote-tracking branch 'public/master' into vulkanJason Ekstrand2016-04-014-12/+10
|\
| * 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/spirv: Set a default number of invocations for geometry shadersJason Ekstrand2016-03-291-0/+3
| | | | | | | | | | | | The SPIR-V spec says geometry shaders are supposed to have one invocation by default. The execution mode is only required if there are multiple invocations.
* | nir/spirv: Remove the NoContraction hackJason Ekstrand2016-03-281-22/+1
| | | | | | | | | | NIR now just handles this for us by not fusing if the multiply is marked as exact.
* | nir/search: Don't match inexact expressions with exact subexpressionsJason Ekstrand2016-03-281-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.
* | spirv/alu: Add support for the NoContraction decorationJason Ekstrand2016-03-251-16/+53
| |
* | spirv/glsl: Add a helper for converting glsl opcodes into nir opcodesJason Ekstrand2016-03-251-61/+56
| | | | | | | | This is similar to the way that regular ALU operations are handled.
* | nir/spirv: Get rid of the spirv2nir helper binaryJason Ekstrand2016-03-251-55/+0
| | | | | | | | | | This was useful once upon a time but now that we have a real Vulkan driver to run our SPIR-V binaries through, there's really no point.
* | nir/algebraic: Get rid of a redundant copy of fdiv loweringJason Ekstrand2016-03-251-1/+0
| |
* | nir/algebraic: Add better lowering of ldexpJason Ekstrand2016-03-251-2/+27
| |
* | nir/builder: Simplify nir_ssa_undef a bitJason Ekstrand2016-03-251-2/+1
| |
* | nir/spirv: Use the nir_ssa_undef helper from nir_builderJason Ekstrand2016-03-251-9/+4
| |
* | nir/builder: Add a bit size field to nir_ssa_undefJason Ekstrand2016-03-252-3/+4
| |
* | nir: Add a better comment for INTRINSIC_RANGEJason Ekstrand2016-03-251-2/+2
| |
* | nir/glsl: Stop carying a pointer to the nir_shader in the visitorJason Ekstrand2016-03-251-6/+3
| |
* | Merge remote-tracking branch 'public/master' into vulkanJason Ekstrand2016-03-2440-385/+1028
|\|
| * 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]>
| * nir: Add return lowering passJason Ekstrand2016-03-243-0/+250
| | | | | | | | | | | | | | | | This commit adds a NIR pass for lowering away returns in functions. If the return is in a loop, it is lowered to a break. If it is not in a loop, it's lowered away by moving/deleting code as needed. Reviewed-by: Jordan Justen <[email protected]>
| * nir: Add a cursor helper for getting a cursor after any phi nodesJason Ekstrand2016-03-241-0/+16
| | | | | | | | Reviewed-by: Jordan Justen <[email protected]>
| * nir/builder: Add a helper for inserting jump instructionsJason Ekstrand2016-03-241-0/+7
| | | | | | | | Reviewed-by: Jordan Justen <[email protected]>
| * nir/cf: Make extracting or re-inserting nothing a no-opJason Ekstrand2016-03-241-0/+9
| | | | | | | | | | Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
| * nir: Add a function for comparing cursorsJason Ekstrand2016-03-242-0/+58
| | | | | | | | Reviewed-by: Jordan Justen <[email protected]>
| * nir/cf: Handle relinking top-level blocksJason Ekstrand2016-03-241-2/+5
| | | | | | | | | | | | | | | | This can happen if a function ends in a return instruction and you remove the return. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
| * nir: Add a pass to repair SSA formJason Ekstrand2016-03-243-0/+162
| | | | | | | | Reviewed-by: Jordan Justen <[email protected]>
| * nir/vars_to_ssa: Use the new nir_phi_builder helperJason Ekstrand2016-03-241-359/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The efficiency should be approximately the same. We do a little more work per phi node because we have to sort the predecessors. However, we no longer have to walk the blocks a second time to pop things off the stack. The bigger advantage, however, is that we can now re-use the phi placement and per-block SSA value tracking in other passes. As a side-benifit, the phi builder actually handles unreachable blocks correctly. The original vars_to_ssa code, because of the way it iterated the blocks and added phi sources, didn't add sources corresponding to predecessors of unreachable blocks. The new strategy employed by the phi builder creates a phi source for each predecessor and should correctly handle unreachable blocks by setting those sources to SSA undefs. Reviewed-by: Jordan Justen <[email protected]>
| * nir/dominance: Handle unreachable blocksJason Ekstrand2016-03-241-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, nir_dominance.c didn't properly handle unreachable blocks. This can happen if, for instance, you have something like this: loop { if (...) { break; } else { break; } } In this case, the block right after the if statement will be unreachable. This commit makes two changes to handle this. First, it removes an assert and allows block->imm_dom to be null if the block is unreachable. Second, it properly skips unreachable blocks in calc_dom_frontier_cb. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
| * nir: Add a phi node placement helperJason Ekstrand2016-03-243-0/+412
| | | | | | | | | | | | | | | | | | | | | | Right now, we have phi placement code in two places and there are other places where it would be nice to be able to do this analysis. Instead of repeating it all over the place, this commit adds a helper for placing all of the needed phi nodes for a value. v2: Add better documentation Reviewed-by: Jordan Justen <[email protected]>
| * nir: fix dangling ssadef->name ptrsRob Clark2016-03-243-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In many places, the convention is to pass an existing ssadef name ptr when construction/initializing a new nir_ssa_def. But that goes badly (as noticed by garbage in nir_print output) when the original string gets freed. Just use ralloc_strdup() instead, and add ralloc_free() in the two places that would care (not that the strings wouldn't eventually get freed anyways). Also fixup the nir_search code which was directly setting ssadef->name to use the parent instruction as memctx. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
| * nir/glsl: Propagate invariant into NIR alu opsJason Ekstrand2016-03-231-0/+3
| | | | | | | | Reviewed-by: Francisco Jerez <[email protected]>
| * nir/alu_to_scalar: Propagate the "exact" bitJason Ekstrand2016-03-231-0/+1
| | | | | | | | Reviewed-by: Francisco Jerez <[email protected]>
| * nir/cse: Properly handle nir_ssa_def.exactJason Ekstrand2016-03-231-2/+14
| | | | | | | | Reviewed-by: Francisco Jerez <[email protected]>
| * nir/algebraic: Flag inexact optimizationsJason Ekstrand2016-03-231-59/+62
| | | | | | | | | | | | | | | | | | | | Many of our optimizations, while great for cutting shaders down to size, aren't really precision-safe. This commit tries to flag all of the inexact floating-point optimizations so they don't get run on values that are flagged "exact". It's a bit conservative and maybe flags some safe optimizations as unsafe but that's better than missing one. Reviewed-by: Francisco Jerez <[email protected]>
| * nir/algebraic: Fix fmin detection to match the specJason Ekstrand2016-03-231-1/+1
| | | | | | | | | | | | | | The previous transformation got the arguments to fmin backwards. When NaNs are involved, the GLSL min/max aren't commutative so it matters. Reviewed-by: Francisco Jerez <[email protected]>
| * nir/algebraic: Get rid of an invlid fxor optimizationJason Ekstrand2016-03-231-1/+0
| | | | | | | | | | | | | | The fxor opcode is required to return 1.0f or 0.0f but the input variable may not be 1.0f or 0.0f. Reviewed-by: Francisco Jerez <[email protected]>