- Mar 23, 2018
-
-
Faith Ekstrand authored
Everything else should already be handled.
-
Faith Ekstrand authored
Since we had to rewrite the deref walking loop anyway, I took the opportunity to make it a bit clearer and more efficient. In particular, in the AoA case, we will now emit one minmax instead of one per array level.
-
Faith Ekstrand authored
-
Faith Ekstrand authored
-
Faith Ekstrand authored
-
Faith Ekstrand authored
-
Faith Ekstrand authored
This commit removes most of the deref instruction lowering. Instead of lowering early, we only lower textures and images and we only do so right before any of the anv image lowering passes.
-
Faith Ekstrand authored
This commit completely reworks function calls in NIR. Instead of having a set of variables for the parameters and return value, nir_call_instr now has simply has a number of sources which get mapped to load_param intrinsics inside the functions. It's up to the client API to build an ABI on top of that. In SPIR-V, out parameters are handled by passing the result of a deref through as an SSA value and storing to it. This virtue of this approach can be seen by how much it allows us to delete from core NIR. In particular, nir_inline_functions gets halved and goes from a fairly difficult pass to understand in detail to almost trivial. It also simplifies spirv_to_nir somewhat because NIR functions never were a good fit for SPIR-V. Unfortunately, there is no good way to do this without a mega-commit. Core NIR and SPIR-V have to be changed at the same time. This also requires changes to anv and radv because nir_inline_functions couldn't handle deref instructions before this change and can't work without them after this change.
-
Faith Ekstrand authored
We were only initializing vtn_builder::func for the pre-walk where we build the CFG. We were only initializing the nir_builder for the later walk through the instructions even though were were setting b->cursor for the pre-walk. Let's set both both places so that everything is consistent. This useful because we handle OpFunctionParameter in the pre-walk and we're going to need to be able to emit instructions.
-
Faith Ekstrand authored
-
Faith Ekstrand authored
Now that pointers can be derefs and derefs just produce SSA values, we can convert any pointer to/from SSA.
-
Faith Ekstrand authored
Previously, pointers fell into two categories: index/offset for UBOs, SSBOs, etc. and var + access chain for logical pointers. This commit adds another logical pointer mode that's deref + access chain. It's tempting to think that we can just replace variable-based pointers with deref-based or at least replace the access chain with a deref chain. Unfortunately, there are a few sticky bits that prevent this: 1) We can't return deref-based pointers from OpVariable because those opcodes may come outside of a function so there's no place to emit the deref instructions. 2) We can't always use variable-based pointers because we may not always know the variable. (We do now, but he upcoming function rework will take that option away.) 3) We also can't replace the access chain struct with a deref. Due to the re-ordering we do in order to handle loop continues, the derefs we would emit as part of OpAccessChain may not dominate their uses. We normally fix this up with nir_repair_ssa but that generates phi nodes which we don't want in the middle of our deref chains. All in all, we have no real better option than to support partial access chains while also re-emitting the deref instructions on the spot.
-
Faith Ekstrand authored
Now that push constants are using on-the-fly offsets, we no longer need to handle access chains in vtn_pointer_to_offset.
-
Faith Ekstrand authored
Push constants have been a weird edge-case for a while in that they have explitic offsets but we've been internally building access chains for them. This mostly works but it means that passing pointers to push constants through as function arguments is broken. The easy thing to do for now is to just treat them like UBOs or SSBOs only without a block index. This does loose a bit of information since we no longer have an accurate access range and any indirect access will look like it could read the whole block. Unfortunately, there's not much we can do about that. Once NIR derefs get a bit more powerful, we can plumb these through as derefs and be able to reason about them again.
-
Faith Ekstrand authored
Before, we were doing structure splitting in spirv_to_nir. Unfortunately, this doesn't really work when you think about passing struct pointers into functions. Doing it later in NIR is a much better plan.
-
Faith Ekstrand authored
Once we've gotten rid of everything but the main entrypoint, there's no reason why we should go ahead and lower them all. This is what radv does and it will make future work easier.
-
Faith Ekstrand authored
-
Faith Ekstrand authored
-
Faith Ekstrand authored
-
Faith Ekstrand authored
This adds a concept of "members" to a variable with an interface type. It allows you to specify the full variable data for each member of the interface instead of once for the variable. We also add a lowering pass to lower those variables to a sequence of variables and rewrite all the derefs accordingly.
-
Faith Ekstrand authored
The only thing still using old-school drefs are function calls.
-
Faith Ekstrand authored
-
Faith Ekstrand authored
-
Faith Ekstrand authored
-
Faith Ekstrand authored
This pass doesn't handle deref instructions yet. Making it handle both legacy derefs and deref instructions would be painful. Since it's not important for correctness, just disable it for now.
-
Faith Ekstrand authored
-
Faith Ekstrand authored
-
Faith Ekstrand authored
-
Faith Ekstrand authored
-
Faith Ekstrand authored
-
Faith Ekstrand authored
-
Faith Ekstrand authored
-
Faith Ekstrand authored
-
Faith Ekstrand authored
-
Faith Ekstrand authored
Sometimes it's useful for a pass to be able to clean up its own derefs instead of waiting for DCE. This little helper makes it very easy.
-
Faith Ekstrand authored
-
Faith Ekstrand authored
-
Faith Ekstrand authored
-
Faith Ekstrand authored
-
Faith Ekstrand authored
This commit introduces a new nir_deref.h header for helpers that are less common and really only needed by a few heavy-duty passes. In this header is a new struct for representing a full deref path which can be walked in either direction.
-