aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv
Commit message (Collapse)AuthorAgeFilesLines
* vtn: create cast with type stride.Dave Airlie2019-05-311-1/+1
| | | | | | | | | When creating function parameters, we create pointers from ssa values, this creates nir casts with stride 0, however we have no where else to get this value from. Later passes to lower explicit io need this stride value to do the right thing. Reviewed-by: Karol Herbst <[email protected]>
* spirv: Change spirv_to_nir() to return a nir_shaderCaio Marcelo de Oliveira Filho2019-05-293-12/+13
| | | | | | | | | | | | | | | spirv_to_nir() returned the nir_function corresponding to the entrypoint, as a way to identify it. There's now a bool is_entrypoint in nir_function and also a helper function to get the entry_point from a nir_shader. The return type reflects better what the function name suggests. It also helps drivers avoid the mistake of reusing internal shader references after running NIR_PASS on it. When using NIR_TEST_CLONE or NIR_TEST_SERIALIZE, those would be invalidated right in the first pass executed. Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* nir: Drop imov/fmov in favor of one mov instructionJason Ekstrand2019-05-242-3/+3
| | | | | | | | | | | | | | | | The difference between imov and fmov has been a constant source of confusion in NIR for years. No one really knows why we have two or when to use one vs. the other. The real reason is that they do different things in the presence of source and destination modifiers. However, without modifiers (which many back-ends don't have), they are identical. Now that we've reworked nir_lower_to_source_mods to leave one abs/neg instruction in place rather than replacing them with imov or fmov instructions, we don't need two different instructions at all anymore. Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]> Reviewed-by: Vasily Khoruzhick <[email protected]> Acked-by: Rob Clark <[email protected]>
* nir/builder: Remove the use_fmov parameter from nir_swizzleJason Ekstrand2019-05-242-11/+11
| | | | | | | | | | This flag has caused more confusion than good in most cases. You can validly use imov for floats or fmov for integers because, without source modifiers, neither modify their input in any way. Using imov for floats is more reliable so we go that direction. Reviewed-by: Kristian H. Kristensen <[email protected]> Acked-by: Alyssa Rosenzweig <[email protected]>
* spirv: Drop GOOGLE suffix from names incorporated to SPIR-VCaio Marcelo de Oliveira Filho2019-05-212-15/+15
| | | | | | | SPV_GOOGLE_decorate_string and SPV_GOOGLE_hlsl_functionality1 were incorporated to SPIR-V. Let's pick the names used by SPIR-V core. Reviewed-by: Karol Herbst <[email protected]>
* spirv: Pick the right bitsize when doing SpvUConvertCaio Marcelo de Oliveira Filho2019-05-211-0/+1
| | | | Reviewed-by: Karol Herbst <[email protected]>
* spirv: Trivially handle new 1.4 loop controlsCaio Marcelo de Oliveira Filho2019-05-211-1/+6
| | | | Reviewed-by: Karol Herbst <[email protected]>
* spirv: Update JSON and Headers to 1.4Caio Marcelo de Oliveira Filho2019-05-213-81/+2419
| | | | | | | This refers to commit c4f8f65792d4bf2657ca751904c511bbcf2ac77b from GitHub. Reviewed-by: Karol Herbst <[email protected]>
* spirv: Handle instruction aliases in spirv_info_c.pyCaio Marcelo de Oliveira Filho2019-05-211-0/+7
| | | | | | | Choose the first we see in the grammar file as the main one. This is needed to parse SPIR-V 1.4 because it introduced opcode aliases. Reviewed-by: Karol Herbst <[email protected]>
* spirv: Generate proper NULL pointer valuesCaio Marcelo de Oliveira Filho2019-05-201-4/+12
| | | | | | | | | | | | | Use the storage class address format information to pick the right constant values for a NULL pointer. v2: Don't add a deref_cast to the values. (Jason) v3: Update to use vtn_storage_class_to_mode() and vtn_mode_to_address_format() explicitly. (Jason) Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* spirv: Reuse helpers in vtn_handle_type()Caio Marcelo de Oliveira Filho2019-05-202-33/+6
| | | | | | | | | | | | | And change vtn_storage_class_to_mode() to accept NULL as interface_type. In this case, if we have a SpvStorageClassUniform, we assume it is uses an ubo_addr_format, like the code being replaced by the helper. That assumption is a problem, but no different than the previous code. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* spirv: Add vtn_variable_mode_imageCaio Marcelo de Oliveira Filho2019-05-202-0/+11
| | | | | | | | | | | | | Corresponding to SpvStorageClassImage. We see pointers for that storage class in tests, but don't use the storage class any further. Adding this so that we can call vtn_mode_to_address_format() for all supported pointers. v2: Fail when trying to create a SpvStorageClassImage variable. (Jason) Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* spirv: Add vtn_mode_to_address_format()Caio Marcelo de Oliveira Filho2019-05-202-20/+57
| | | | | | | | | | Handles all the modes and we can use it in combination with nir_address_format_to_glsl_type() to replace the vtn_ptr_type_for_mode() helper. Since the new helper is more generic, moved the assertions from the old one to the call sites. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* spirv: Add vtn_mode_uses_ssa_offset()Caio Marcelo de Oliveira Filho2019-05-202-8/+15
| | | | | | | | | | | | Just the mode is needed to decide whether SSA offsets are needed, so make a function that takes that and reuse it for vtn_pointer_uses_ssa_offset(). This will be used for constant null pointers, that won't have a vtn_pointer handy. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* spirv: Add and use vtn_type_without_array() helperCaio Marcelo de Oliveira Filho2019-05-203-8/+15
| | | | | | | | v2: Renamed from vtn_interface_type. (Jason) Accept any type not only pointers. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* spirv: Change vtn_null_constant() to use vtn_typeCaio Marcelo de Oliveira Filho2019-05-201-32/+26
| | | | | | | | | | | This is a preparation to handle OpConstantNull for pointers, we'll use the vtn_type to get to the address format and then the appropriate representation of NULL pointer. v2: Move rest of body to use vtn_type. (Jason) Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* spirv: Export vtn_storage_class_to_mode()Caio Marcelo de Oliveira Filho2019-05-202-1/+6
| | | | | | | So we can reuse in spirv_to_nir.c. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* spirv, radv, anv: Replace ptr_type with addr_formatCaio Marcelo de Oliveira Filho2019-05-203-24/+30
| | | | | | | | | Instead of setting the glsl types of the pointers for each resource, set the nir_address_format, from which we can derive the glsl_type, and in the future the bit pattern representing a NULL pointer. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* spirv/cl: support vload/vstoreKarol Herbst2019-05-041-0/+55
| | | | | Signed-off-by: Karol Herbst <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Add nir_op_vec helperKarol Herbst2019-05-041-9/+1
| | | | | | | | | with that we can simplify code where nir vectors are created v2: merge both lines in nir_vec Signed-off-by: Karol Herbst <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* vtn: handle bitcast with pointer src/destKarol Herbst2019-05-043-29/+45
| | | | | | | v2: use vtn_push_ssa and vtn_ssa_value Signed-off-by: Karol Herbst <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* spirv: fix SpvOpBitSize return value.Dave Airlie2019-05-031-3/+1
| | | | | | The spir-v spec says this returns a bool. Reviewed-by: Jason Ekstrand <[email protected]>
* nir: add pass to lower fb readsRob Clark2019-05-021-0/+3
| | | | | Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
* spirv: add missing SPV_EXT_descriptor_indexing capabilitiesJuan A. Suarez Romero2019-04-301-0/+14
| | | | | | | | | | | | | | Add ShaderNonUniformEXT, UniformBufferArrayNonUniformIndexingEXT, SampledImageArrayNonUniformIndexingEXT, StorageBufferArrayNonUniformIndexingEXT, StorageImageArrayNonUniformIndexingEXT, InputAttachmentArrayNonUniformIndexingEXT, UniformTexelBufferArrayNonUniformIndexingEXT and StorageTexelBufferArrayNonUniformIndexingEXT capabilities. Cc: [email protected] Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* spirv: Properly handle SpvOpAtomicCompareExchangeWeakCaio Marcelo de Oliveira Filho2019-04-291-75/+82
| | | | | | | | | | | | | | | | | The code was handling the Weak variant in some cases, but missing others, e.g. the get_deref_nir_atomic_op. Add all the missing cases with the same behavior of the non-Weak SpvOpAtomicCompareExchange. Note that the Weak variant is basically an alias, as SPIR-V 1.3, Revision 7 says "OpAtomicCompareExchangeWeak Deprecated (use OpAtomicCompareExchange). Has the same semantics as OpAtomicCompareExchange." Reviewed-by: Jason Ekstrand <[email protected]>
* delete autotools .gitignore filesEric Engestrom2019-04-291-2/+0
| | | | | | | | One special case, `src/util/xmlpool/.gitignore` is not entirely deleted, as `xmlpool.pot` still gets generated (eg. by `ninja xmlpool-pot`). Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* spirv: Handle SpvOpDecorateIdCaio Marcelo de Oliveira Filho2019-04-231-0/+4
| | | | | | | | | | | This operation decorate with an Id instead of a Literal or String. It is used by HlslCounterBufferGOOGLE (provided by SPV_GOOGLE_hlsl_functionality1). Even if we don't do anything with that decoration, we must be able to parse SPIR-V that uses it. Fixes: 891886da2f9 "spirv: Add no-op support for VK_GOOGLE_hlsl_functionality1" Reviewed-by: Jason Ekstrand <[email protected]>
* spirv: Rename vtn_decoration literals to operandsCaio Marcelo de Oliveira Filho2019-04-235-39/+39
| | | | | | | | Decorations (and ExecutionModes) can have not only literals, but also Ids associated with them. So rename the field to the more general name "Operand" used by the spec. Reviewed-by: Jason Ekstrand <[email protected]>
* compiler/spirv: move the check for Int8 capabilityIago Toral Quiroga2019-04-181-4/+3
| | | | | | So it is right after the checks for the other various Int* capabilities. Reviewed-by: Jason Ekstrand <[email protected]>
* spirv: Tell which opcode or value is unhandled when failingCaio Marcelo de Oliveira Filho2019-04-164-42/+61
| | | | | | | | | | | | | | | v2: When available, include the opcode name too. (Karol) v3: Use more to_string helpers. (Karol) Include the wrong bit_size in those failures. Include the capability number in spv_check_supported. Provide vtn_fail_with_* macros to avoid noise in the call sites. v4: Provide macros only for opcode and decoration, which have enough usages to justify them. (Jason) Acked-by: Jason Ekstrand <[email protected]> Reviewed-by: Karol Herbst <[email protected]>
* spirv: Add more to_string helpersCaio Marcelo de Oliveira Filho2019-04-162-3/+15
| | | | | | | | Also, use a set to identify repeated values. The previous arrangement worked when the repetitions were one after another, but in some of the new cases they are not. Reviewed-by: Karol Herbst <[email protected]>
* spirv: add SpvCapabilityFloat16 supportSamuel Pitoiset2019-04-151-1/+4
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* spirv: Drop some unneeded bit size switch statementsJason Ekstrand2019-04-141-62/+4
| | | | | | | Now that nir_const_value is a scalar, we don't need the switch on bit size in order copy components around properly. Reviewed-by: Karol Herbst <[email protected]>
* nir: make nir_const_value scalarKarol Herbst2019-04-143-62/+70
| | | | | | | | | v2: remove & operator in a couple of memsets add some memsets v3: fixup lima Signed-off-by: Karol Herbst <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> (v2)
* spirv: reduce array size in vtn_handle_constantKarol Herbst2019-04-141-1/+1
| | | | | | | | we already assert above that there are no more than 3 sources, so it doesn't make sense to use an array of 4 sources Signed-off-by: Karol Herbst <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Add access qualifiers on load_ubo intrinsic.Bas Nieuwenhuizen2019-04-101-1/+2
| | | | | | | | | Otherwise nir_lower_non_uniform_access crashes when it tries to get the access of a load_ubo. Fixes: 8ed583fe523 "spirv: Handle the NonUniformEXT decoration" Fixes: e50ab2c0f23 "nir: Add access flags to deref and SSBO atomics" Reviewed-by: Samuel Pitoiset <[email protected]>
* spirv: Add support for DerivativeGroup capabilitiesCaio Marcelo de Oliveira Filho2019-04-081-0/+15
| | | | | | | | | | | | As defined in SPV_NV_compute_shader_derivatives. These control how the invocations are arranged in a CS when doing derivative and related operations (which are also enabled by the extension). Since we expect valid SPIR-V, we don't need to do more work at SPIR-V level to enable the derivative and related operations to be called. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* spirv: fix a compiler warningTapani Pälli2019-04-011-1/+1
| | | | | | | Fixes implicit conversion from enumeration type 'SpvOp' warning. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
* spirv: propagate the access flag for store and load derefsSamuel Pitoiset2019-03-273-24/+32
| | | | | | | It was only propagated when UBO/SSBO access are lowered to offsets. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: <Jason Ekstrand [email protected]>
* spirv: make use of the select control support in nirTimothy Arceri2019-03-271-0/+18
| | | | | Reviewed-by: Bas Nieuwenhuizen <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108841
* spirv: make use of the loop control support in nirTimothy Arceri2019-03-271-0/+20
| | | | | Reviewed-by: Bas Nieuwenhuizen <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108841
* spirv: Handle the NonUniformEXT decorationJason Ekstrand2019-03-252-0/+28
|
* spirv: Use interface type for block and buffer blockCaio Marcelo de Oliveira Filho2019-03-232-4/+36
| | | | | | | | Also handle GLSL_TYPE_INTERFACE the same way we do GLSL_TYPE_STRUCT in various places. Motivated by ARB_gl_spirv work, that will take advantage of the interface types when handling NIR coming from SPIR-V. Reviewed-by: Jason Ekstrand <[email protected]>
* spirv: Add an execution environment to the optionsCaio Marcelo de Oliveira Filho2019-03-231-0/+8
| | | | | | | | | | Also updates gl_spirv to pick the right one. At the moment nothing uses it, but upcoming functionality part of ARB_gl_spirv will use it, and we also later can be more assertful when handling certain features for each of the execution environments. Reviewed-by: Alejandro Piñeiro <[email protected]> Acked-by: Karol Herbst <[email protected]>
* spirv,nir: lower frexp_exp/frexp_sig inside a new NIR passSamuel Pitoiset2019-03-221-133/+4
| | | | | | | | | | This lowering isn't needed for RADV because AMDGCN has two instructions. It will be disabled for RADV in an upcoming series. While we are at it, factorize a little bit. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* spirv: Drop inline tg4 loweringJason Ekstrand2019-03-211-54/+30
| | | | Reviewed-by: Karol Herbst <[email protected]>
* nir/spirv: don't use bare types, remove assert in split vars for testingDave Airlie2019-03-211-3/+3
| | | | | | | | | | For OpenCL we never want to strip the info from the types, and it makes type comparisons easier in later stages. We might later need a nir pass to strip this for GLSL, but so far the only regression is the assert and Jason said removing that is fine. Reviewed-by: Jason Ekstrand <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* nir: deref only for OpTypePointerJuan A. Suarez Romero2019-03-201-8/+14
| | | | | | | | | | | | | | Fixes dEQP-VK.binding_model.buffer_device_address.* and dEQP-VK.ssbo.phys.layout* Vulkan CTS tests. v2: set val->type->stride in the section below (Jason) v3: restore val->type->type to original place (Jason) Fixes: d0ba326f238 ("nir/spirv: support physical pointers") CC: Karol Herbst <[email protected]> CC: Jason Ekstrand <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* Revert "nir: const `nir_call_instr::callee`"Jason Ekstrand2019-03-191-1/+1
| | | | | | | | | | | This reverts commit db57db5317e81fb4ce31bc294fdcc199db651542. When building IR, nothing is really immutable and, since C has no concept of constness propagating beyond the first pointer, we have to be vary careful with how we use it. To just throw const into a function like this is a lie. Instead, we should just drop the unneeded const in spirv_to_nir which this commit does along with the revert.
* nir/spirv: support physical pointersKarol Herbst2019-03-194-7/+46
| | | | | | | | v2: add load_kernel_input Signed-off-by: Karol Herbst <[email protected]> squash! nir/spirv: support physical pointers