Lionel Landwerlin
1c92d355c6
clc: use the defined version for the parser
...
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13018 >
2021-09-24 12:33:19 +00:00
Lionel Landwerlin
dce8870f64
microsoft/clc: small compile fix on Linux
...
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13018 >
2021-09-24 12:33:19 +00:00
Jesse Natalie
7aa060ec38
microsoft/clc: Add a test for specializing via SPIRV-Tools
...
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10322 >
2021-09-23 13:06:41 +00:00
Jesse Natalie
068c6b5a37
microsoft/clc: Add API to independently specialize SPIR-V
...
We need the ability to specialize unlinked SPIR-V, so use SPIR-V tools
to specialize prior to linking.
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10322 >
2021-09-23 13:06:41 +00:00
Jesse Natalie
c50bbf1f28
microsoft/clc: Support passing specialization consts to spirv_to_nir
...
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10322 >
2021-09-23 13:06:41 +00:00
Jesse Natalie
a699844ffb
microsoft/clc: Parse SPIR-V specialization consts into metadata
...
We need to be able to validate at the API that set specialization consts
have a valid ID and the value is the correct size.
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10322 >
2021-09-23 13:06:41 +00:00
Jesse Natalie
c4755a7c32
microsoft/clc: Support SPIR intermediates in the compilation APIs
...
We can now export SPIR (mainly just for testing) or import SPIR and
convert to SPIR-V.
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10322 >
2021-09-23 13:06:41 +00:00
Jesse Natalie
91e08312d8
microsoft/clc: Split clc_object and rename entrypoints
...
clc_object was overloaded, containing SPIR-V binary and metadata,
and it would only sometimes contain metadata (after linking). Split
it into a more generic clc_binary class which holds some type of data
(the kind depends on where it came from), and clc_metadata which can
be independently parsed on compiled or linked data.
Rename a couple entrypoints to be more explicit about what they're
actually transforming (c_to_spirv, link_spirv, spirv_to_dxil).
Add a logger to SPIR-V binary parsing so it can report errors on app-
provided SPIR-V.
Re-order helper function parameters to be more consistent (out params last).
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10322 >
2021-09-23 13:06:41 +00:00
Jesse Natalie
c3666eec7e
microsoft/clc: Stop heap-allocating tiny fixed-size transparent structs
...
The caller can allocate these however they want. They don't need
independent allocations. Removes some unnecessary failure handling.
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10322 >
2021-09-23 13:06:41 +00:00
Jesse Natalie
27467700e9
microsoft/clc: Clean up clc_context
...
1. Rename it to libclc to match what it is
2. Make it opaque externally
3. Remove it from non-essential entrypoints (compile/link)
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10322 >
2021-09-23 13:06:41 +00:00
Jesse Natalie
24b096035f
microsoft/clc: Rename compiler DLL to clon12compiler
...
I no longer think there's value in trying to share code on disk here between
CL and GL at runtime, especially since we're now just building GL without LLVM
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10322 >
2021-09-23 13:06:41 +00:00
Emma Anholt
aed4c0b5a9
nir: Drop the unused instr arg for src/dest copy functions.
...
Now that we don't use ralloc, we don't need this arg to get at the right
ralloc ctx.
Reviewed-by: Matt Turner <mattst88@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11776 >
2021-09-14 17:53:06 +00:00
Michael Tang
f7e575ce0d
microsoft/spirv_to_dxil: Add install : true to spirv_to_dxil library.
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12758 >
2021-09-08 00:00:42 +00:00
Jesse Natalie
015cc73407
spirv2dxil: Fix build after spirv_to_dxil signature change
...
Fixes: ada05759 ("spirv_to_dxil: Convert out parameters to a single object")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5322
Reviewed-by: Enrico Galli <enrico.galli@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12728 >
2021-09-04 19:47:41 -07:00
Enrico Galli
398d591b65
spirv_to_dxil: Add support for non-zero vertex and instance indices
...
Since DXIL does not have a way to get the base/first vertex and base
instance as well as using a zero-based vertex index, these values need
to be passed in via a constant buffer.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12707 >
2021-09-03 16:21:03 +00:00
Enrico Galli
49ef896a5e
spirv_to_dxil: Add support for nir_intrinsic_load_num_workgroups
...
Since DXIL does not have a way to get the number of workgroups used
during dispatch with a system-value, these numbers need to be passed in
via a constant buffer.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12707 >
2021-09-03 16:21:03 +00:00
Enrico Galli
ada05759e1
spirv_to_dxil: Convert out parameters to a single object
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12707 >
2021-09-03 16:21:03 +00:00
Rhys Perry
ae00f5af61
nir: separate lower_add_sat
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12617 >
2021-09-03 13:21:27 +00:00
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: 7c9e487afd/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