Erik Faye-Lund
c8581d0fae
microsoft/compiler: trivial fixes to error-handling
...
We're really bad at making sure we report errors when we fail to
allocate memory. This makes us a bit better...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12541 >
2021-08-26 18:57:40 +00:00
Erik Faye-Lund
e0f3133447
microsoft/compiler: return errors from get_n_src
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12541 >
2021-08-26 18:57:40 +00:00
Erik Faye-Lund
2c166a27fc
microsoft/compiler: remove needless error-returns
...
There's no root error-conditions in this code, just code that assumes
they exist and tries to handle them.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12541 >
2021-08-26 18:57:40 +00:00
Michael Tang
4a3395f35a
microsoft/compiler: Miscellaneous fixes from running clang-format
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12513 >
2021-08-25 20:19:05 +00:00
Michael Tang
1aca20be14
microsoft/compiler: Emit a flat interpolation method for SV_SampleIndex
...
We do not want to set an interpolation method for vertex shader inputs.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12513 >
2021-08-25 20:19:05 +00:00
Michael Tang
74a24f4f1c
microsoft/compiler: Set the SampleFrequency runtime metadata
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12513 >
2021-08-25 20:19:05 +00:00
Michael Tang
88220083cf
microsoft/compiler: More robustly handle setting Register=-1
...
This is the 'N/A mask' case in the DXIL disassembly.
This logic is taken from: https://github.com/microsoft/DirectXShaderCompiler/blob/7c9e487afd17b7726229d8ceb3242a412134afe7/tools/clang/tools/dxcompiler/dxcdisassembler.cpp#L106
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12513 >
2021-08-25 20:19:05 +00:00
Michael Tang
62c3492d0b
microsoft/compiler: Add support for SV_SampleIndex intrinsic
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12513 >
2021-08-25 20:19:05 +00:00
Michael Tang
4237aa3a7e
spirv_to_dxil: Run nir_lower_tex during compilation
...
We need this to get e.g. a default lod for some instructions when it is
not provided.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12462 >
2021-08-24 22:18:30 +00:00
Emma Anholt
673cc9323a
nir: Move phi src setup to a helper.
...
Cleans up the ralloc/list push code all over the tree.
Reviewed-by: Matt Turner <mattst88@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11772 >
2021-08-13 16:11:57 +00:00
Marcin Ślusarz
65f9234f96
microsoft/compiler: use nir_shader_instructions_pass in dxil_nir_lower_double_math
...
No functional changes.
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12324 >
2021-08-11 11:23:30 +00:00
Marcin Ślusarz
b8de41902e
microsoft/compiler: use nir_shader_instructions_pass in dxil_nir_split_clip_cull_distance
...
No functional changes.
v2: fix build
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12324 >
2021-08-11 11:23:30 +00:00
Marcin Ślusarz
9aafb91f0e
microsoft/compiler: preserve all metadata when upcast_phi doesn't make progress
...
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12324 >
2021-08-11 11:23:30 +00:00
Marcin Ślusarz
17a61ec541
microsoft/clc: use nir_shader_instructions_pass in clc_nir_dedupe_const_samplers
...
Changes:
- nir_metadata_preserve(..., nir_metadata_all) is called when pass doesn't
make progress
v2: fix build
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12324 >
2021-08-11 11:23:30 +00:00
Marcin Ślusarz
70723f278f
microsoft/clc: preserve only valid metadata in clc_lower_printf_base
...
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12324 >
2021-08-11 11:23:30 +00:00
Vinson Lee
87efa1ee22
spirv_to_dxil: Fix missing-prototypes build error.
...
../src/microsoft/spirv_to_dxil/spirv_to_dxil.c: At top level:
../src/microsoft/spirv_to_dxil/spirv_to_dxil.c:200:1: error: no previous prototype for ‘spirv_to_dxil_get_version’ [-Werror=missing-prototypes]
200 | spirv_to_dxil_get_version()
| ^~~~~~~~~~~~~~~~~~~~~~~~~
Fixes: 92b0cf8e77 ("spirv_to_dxil: expose version number")
Signed-off-by: Vinson Lee <vlee@freedesktop.org >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12264 >
2021-08-07 11:11:31 -07:00
Enrico Galli
cc8a122907
microsoft/compiler: Add support for local_invocation_index
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12228 >
2021-08-05 23:54:26 +00:00
Enrico Galli
f9f3713c84
microsoft/spirv_to_dxil: Enable support for shared memory
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12228 >
2021-08-05 23:54:26 +00:00
Michael Tang
92b0cf8e77
spirv_to_dxil: expose version number
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12227 >
2021-08-05 13:30:42 -07:00
Erik Faye-Lund
d762a01e18
microsoft/compiler: harmonize num_psv_inputs with outputs
...
This doesn't seems to make a practical difference, but it seems better
to do it the same way as we do for outputs, as well as what DXC does.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12197 >
2021-08-05 09:17:40 +00:00
Erik Faye-Lund
63dae1bd8b
microsoft/compiler: fix psv-output calculation
...
Rather surprisingly, the value stored in the NumVectors field of the
DXIL PSV header isn't the number of vectors, but rather the *maximum*
vector used.
This makes a difference when we're not writing to the first element of
an array, where we would previously generate a validation error.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12197 >
2021-08-05 09:17:40 +00:00
Jesse Natalie
4c5f1ef3ca
microsoft/clc: Add a test for compiling a kernel with a read-write image
...
Reviewed-by: Enrico Galli <enrico.galli@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10163 >
2021-07-29 14:54:48 -07:00
Jesse Natalie
6126dd29a4
microsoft/compiler: Implement texture loads from UAVs
...
This comes to the backend as image_load rather than txf but the
DXIL intrinsic is the same at the end of the day.
Reviewed-by: Enrico Galli <enrico.galli@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10163 >
2021-07-29 14:54:31 -07:00
Enrico Galli
fec1a04c53
microsoft/compiler: Correctly flag when using raw buffers
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12119 >
2021-07-29 01:44:45 +00:00
Enrico Galli
1295c5cb33
microsoft/compiler: Add support for arrays to image_store
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12119 >
2021-07-29 01:44:45 +00:00
Enrico Galli
73262d4bd4
microsoft/spirv_to_dxil: Adding continue opt pass to fix DXIL loop gen
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12048 >
2021-07-24 14:47:41 +00:00
Erik Faye-Lund
e212a191a6
dxil: Set coord_components on the txf in lower_int_sampler
...
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Reviewed-by: Connor Abbott <cwabbott0@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11775 >
2021-07-23 15:53:57 +00:00
Jason Ekstrand
624e799cc3
nir: Drop nir_ssa_def::name and nir_register::name
...
We say that they're for debug only but we don't really have a good
policy around when to set them and when not to. In particular,
nir_lower_system_values and nir_lower_vars_to_ssa which are the chief
producers of SSA values which might reasonably have a name do not bother
to set one. We have some names set from things like BLORP and RADV's
meta shaders but AFAICT, they're setting a name more because it's there
than because they actually care.
Also, most things other than nir_clone and nir_serialize don't bother to
try and preserve them. You can see in the diffstat of this commit
exactly what passes attempt to preserve names. Notably missing from the
list is opt_algebraic which is the single largest source of SSA def
churn and it happily throws names away.
These observations lead me to question whether or not names are actually
useful at all or if they're just taking up space (8B per instruction)
and wasting CPU cycles (to ralloc_strdup on the off chance we do have
one). I don't think I can think of a single time in recent history
where I've been debugging a shader issue and a SSA value name has been
there and been useful. If anything, the few times they are there, they
just throw me off because they mess up the indentation in nir_print.
iris shader-db on my system gets runtime -2.07734% +/- 1.26933% (n=5)
Reviewed-by: Emma Anholt <emma@anholt.net >
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5439 >
2021-07-08 17:34:41 +00:00
Jesse Natalie
02efc5a099
microsoft/compiler: Change behavior for emitting inexpressible barriers
...
If the barrier tries to apply to memory that we can't express, just
don't apply the memory portion of the barrier. Similarly, if it tries
to apply a global memory barrier at invocation level, upgrade it to
thread-group.
Reviewed-by: Enrico Galli <enrico.galli@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11670 >
2021-07-01 21:05:14 +00:00
Enrico Galli
ddad83fc97
microsoft/compiler: Add support for get_ssbo_size to translator
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11629 >
2021-06-29 23:15:28 +00:00
Enrico Galli
d0cbd39a5c
microsoft/spirv_to_dxil: Add drive_location assignment
...
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10989 >
2021-06-24 20:05:13 +00:00
Enrico Galli
aa7aa7c78f
microsoft/compiler: Switch io sort to use nir_sort_variables_with_modes
...
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10989 >
2021-06-24 20:05:13 +00:00
Enrico Galli
e2e22720dc
d3d12, microsoft/compiler: Moving driver_location allocation to compiler
...
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10989 >
2021-06-24 20:05:12 +00:00
Enrico Galli
d0f1698a73
d3d12, microsoft/compiler: Switching semantic names to TEXCOORD
...
Switching from GENERIC/VARYING to TEXCOORD. This change better aligns
with other dxil generators (SPIRV-Cross, Tint).
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10989 >
2021-06-24 20:05:12 +00:00
Enrico Galli
b8e2374950
microsoft/compiler: Remove de-duplication of arbitrary semantic names
...
Since DXC doesn't perform de-duplication for arbitrary semantic names,
and the DXIL validator checks against this behavior. We need to remove
the de-duplication.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10989 >
2021-06-24 20:05:12 +00:00
Caio Marcelo de Oliveira Filho
8af6766062
nir: Move workgroup_size and workgroup_variable_size into common shader_info
...
Move it out the "cs" sub-struct, since these will be used for other
shader stages in the future.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11225 >
2021-06-08 09:23:55 -07:00
Rhys Perry
1cbcfb8b38
nir, nir/algebraic: add byte/word insertion instructions
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3151 >
2021-06-08 08:57:42 +00:00
Caio Marcelo de Oliveira Filho
c8a7bd0dc8
nir: Rename WORK_GROUP (and similar) to WORKGROUP
...
Be consistent with other usages in Vulkan and SPIR-V, and the recently
added workgroup_size field.
Acked-by: Emma Anholt <emma@anholt.net >
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Acked-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11190 >
2021-06-07 22:34:42 +00:00
Caio Marcelo de Oliveira Filho
a71a780598
nir: Rename nir_intrinsic_load_local_group_size to nir_intrinsic_load_workgroup_size
...
Acked-by: Emma Anholt <emma@anholt.net >
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Acked-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11190 >
2021-06-07 22:34:42 +00:00
Caio Marcelo de Oliveira Filho
430d2206da
compiler: Rename local_size to workgroup_size
...
Acked-by: Emma Anholt <emma@anholt.net >
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Acked-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11190 >
2021-06-07 22:34:42 +00:00
Michael Tang
58f843a193
microsoft/compiler: Maintain sorting of resource type in the context
...
This change moves the SRVs associated with read-only SSBOs to be emitted
before any other UAV. We do this because the validator expects resources
to be emitted in a specific order, as noted by `emit_module`.
Previously, we emitted SSBOs as SRVs (read-only) or UAVs (read-write)
after other UAVs.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10514 >
2021-04-29 23:55:02 +00:00
Juan A. Suarez Romero
e532a47f76
util/hash_table: do not leak u64 struct key
...
For non 64bit devices the key stored in hash_table_u64 is wrapped in
hash_key_u64 structure, which is never free.
This commit fixes this issue by just removing the user-defined
`delete_function` parameter in hash_table_u64_{destroy,clear} (which
nobody is using) and using instead a delete function to free this
structure.
Fixes: 608257cf82 ("i965: Fix INTEL_DEBUG=bat")
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com >
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10480 >
2021-04-29 12:58:23 +02:00
Jesse Natalie
29ad039d13
microsoft/compiler: Handle unbounded arrays
...
Note that it's no longer sufficient to check for >=1 sampler/image
in a potential array, because unbounded arrays have 0 of them.
Reviewed-by: Enrico Galli <enrico.galli@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10298 >
2021-04-27 23:13:19 +00:00
Jesse Natalie
611934c556
microsoft/compiler: Map descriptor set -> binding space
...
Reviewed-by: Enrico Galli <enrico.galli@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10298 >
2021-04-27 23:13:19 +00:00
Jesse Natalie
c218f4a56e
microsoft/compiler: Fix function signature for bufferStore to support overloads
...
Reviewed-by: Enrico Galli <enrico.galli@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10298 >
2021-04-27 23:13:19 +00:00
Jesse Natalie
46bc7cf678
microsoft/compiler: Rewrite sampler splitting pass to be smarter and handle derefs
...
Reviewed-by: Enrico Galli <enrico.galli@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10298 >
2021-04-27 23:13:19 +00:00
Jesse Natalie
ec9fa0ed13
d3d12, microsoft/compiler: Use SRV/sampler variable binding data
...
For GL, we've previously mostly ignored the binding property for sampler variables
during the shader compilation step. For CL, our image bindings were always 0-based as well.
Now, for Vulkan, we are going to be getting explicit bindings and need to emit DXIL that
respects those bindings. Since Vulkan can also have both split and combined images and samplers,
we now need to be smarter about recognizing when NIR is trying to use a "sampler" as *both* an
image and sampler (in deref mode, the same variable will be deref'd as both image and sampler).
That "being smarter" bit comes next, but first, let's prep GL for building correct root
signatures and binding the resources correctly.
Reviewed-By: Bill Kristiansen <billkris@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10298 >
2021-04-27 23:13:19 +00:00
Enrico Galli
3a3ab2f8ee
microsoft/compiler: zero out unused WebGPU system values
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10439 >
2021-04-27 01:53:16 +00:00
Jesse Natalie
7e905bd00f
microsoft/spirv_to_dxil: Treat read-only storage images as SRVs
...
Reviewed-by: Enrico Galli <enrico.galli@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10356 >
2021-04-23 23:16:15 +00:00
Jesse Natalie
05d90ed9da
microsoft/compiler: Treat read-only SSBOs as SRVs
...
Reviewed-by: Enrico Galli <enrico.galli@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10356 >
2021-04-23 23:16:15 +00:00