Dave Airlie
76788353b2
clover/nir: hookup printf (v3)
...
This connects printf up for NIR drivers, it lowers using the NIR
pass where it places the idx to the strings into the output buffer.
It also sets the global buffer header to the nir paths.
v2: remove dead function temps after lowering
v3: move to single string
Acked-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8254 >
2020-12-29 09:16:52 +10:00
Jason Ekstrand
c730ace12b
nir,clover: Drop nir_lower_mem_constant_vars
...
We have a more generic helper now so clover doesn't need quite as many
special paths.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7565 >
2020-11-18 04:05:37 +00:00
Karol Herbst
1a775b71ca
clover/nir: set kernel_image cap
...
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Reviewed-by: Dave Airlie <airlied@redhat.com >
Reviewed-by: Francisco Jerez <currojerez@riseup.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7069 >
2020-10-20 23:46:42 +02:00
Jason Ekstrand
4f24dee22a
clover/nir: Add an image lowering pass
...
Reviewed-by: Dave Airlie <airlied@redhat.com >
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7069 >
2020-10-20 23:46:42 +02:00
Jason Ekstrand
5e31fad8c9
clover/nir: Calculate sizes of images and samplers properly
...
Clover uses very specific sizes and alignments for images and samplers
to pass various bits of data. We need to add a new size/align helper
for inputs which matches the standard CL size/align for most types but
also has the right size/align for images and samplers.
v2 (Karol): use sizeof(cl_mem) instead of 8 to fix 32 bit runtimes.
Reviewed-by: Dave Airlie <airlied@redhat.com >
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7069 >
2020-10-20 23:46:42 +02:00
Dave Airlie
7e55f0e17d
clover/nir: add a constant folding pass before lowering mem const
...
If we lower mem constants first, then direct array accesses to
constants never get lowered, so do a constant fold pass first to
remove direct const array accesses.
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7209 >
2020-10-19 19:32:22 +00:00
Jason Ekstrand
54eae33558
clover: Stop leaking NIR shaders
...
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7068 >
2020-10-08 16:01:38 +00:00
Jason Ekstrand
2fa7c79045
spirv: Move nir_lower_libclc to src/compiler/spirv
...
This puts it in a shared place where everyone can get at it.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7034 >
2020-10-07 21:52:04 +00:00
Dave Airlie
43390a546d
clover: Use core libclc loader
...
v2 (Jason Ekstrand):
- Use the newly added nir_can_find_libclc() helper
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7034 >
2020-10-07 21:52:04 +00:00
Karol Herbst
ee5b46fcfd
clover/spirv: support CL_KERNEL_COMPILE_WORK_GROUP_SIZE
...
Reviewed-by: Serge Martin <edb@sigluy.net >
Reviewed-by: Francisco Jerez <currojerez@riseup.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4974 >
2020-10-07 13:18:22 +00:00
Serge Martin
c04d5e7efa
clover: implements clGetKernelWorkGroupInfo CL_KERNEL_COMPILE_WORK_GROUP_SIZE
...
Reviewed-by: Francisco Jerez <currojerez@riseup.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4974 >
2020-10-07 13:18:22 +00:00
Serge Martin
aadd134081
clover: add CL_KERNEL_ATTRIBUTES for clGetKernelInfo
...
Reviewed-by: Francisco Jerez <currojerez@riseup.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4974 >
2020-10-07 13:18:22 +00:00
Karol Herbst
7c6f1d3bf9
clover/nir: extract constant buffer into its own section
...
Fixes test_basic constant_source
Signed-off-by: Karol Herbst <kherbst@redhat.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Reviewed-by: Francisco Jerez <currojerez@riseup.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6569 >
2020-10-06 17:30:41 +00:00
Jason Ekstrand
bc7ed03ef8
clover/nir: Call nir_lower_convert_alu_types
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6945 >
2020-10-01 18:36:53 +00:00
Jason Ekstrand
bf80fb7c30
clover/nir: Call the memcpy lowering pass
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6713 >
2020-09-25 23:48:03 +00:00
Dave Airlie
f33b417652
clover: handle libclc shader (v3)
...
This works by taking the spirv produced by libclc which contains
a lot of mangled function entrypoints identified with LinkageAttribute decorations.
This patch just sets up clover to load the libclc blob and convert it to
library nir, and support inlining application nir with calls to libclc.
v2: Add a disk cache support for this object, to avoid the spirv parsing
overheads each time. move spirv->nir to lazy instantiation to avoid
the mess with glsl types and constructor ordering.
v3: make disk cache optional
v1-Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6035 >
2020-09-25 20:09:08 +00:00
Jason Ekstrand
796d3fe9e0
clover/nir: Use lower_vars_to_explicit for uniform and global
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6472 >
2020-09-03 18:02:50 +00:00
Jason Ekstrand
8bea5aaa14
clover: Use args.size() to compute new var locations
...
This is better than using num_uniforms as it guarantees what we want: a
mapping from nir_variable to the args vector.
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6472 >
2020-09-03 18:02:50 +00:00
Jason Ekstrand
bcfeead5f3
clover: Call nir_lower_mem_constant_vars
...
Fixes: 26a4c8f375 "clover/nir: Use nir_var_mem_constant for..."
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6472 >
2020-09-03 18:02:50 +00:00
Jason Ekstrand
526f356633
clover: Use 64-bit offsets for shader_in on 64-bit GPUs
...
This really shouldn't matter as inputs should have logical pointers.
However, nir_builder defaults to building derefs based on the pointer
size in the shader_info. It's easier for now to just be consistent
everywhere.
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6379 >
2020-09-01 20:50:04 +00:00
Jason Ekstrand
26a4c8f375
clover/nir: Use nir_var_mem_constant for __constant memory
...
Reviewed-by: Eric Anholt <eric@anholt.net >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6379 >
2020-09-01 20:50:04 +00:00
Karol Herbst
7dc39838ed
clover/nir: use offset for temp memory
...
Signed-off-by: Karol Herbst <kherbst@redhat.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6433 >
2020-09-01 18:47:30 +00:00
Karol Herbst
d421af3a99
clover/nir: Lower function_temp to scratch.
...
Signed-off-by: Karol Herbst <kherbst@redhat.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6433 >
2020-09-01 18:47:30 +00:00
Karol Herbst
70cbddc4a7
nir: use enum operator helper for nir_variable_mode and nir_metadata
...
those are used quite a bit
Signed-off-by: Karol Herbst <kherbst@redhat.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6520 >
2020-09-01 17:45:08 +00:00
Jesse Natalie
865a2ad086
clover/nir/spirv: Use uniform rather than shader_in for kernel inputs
...
The semantics of inputs for CL are a closer match to the semantics of uniforms for graphics.
Rather than cross-stage data, it's data that every thread sees uniformly.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6497 >
2020-08-31 19:58:14 +00:00
Karol Herbst
4fd2a45267
clover/nir: add support for global invocation id offsets
...
v2: create variables only once
Signed-off-by: Karol Herbst <kherbst@redhat.com >
Acked-by: Jesse Natalie <jenatali@microsoft.com >
Acked-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5891 >
2020-08-21 22:07:05 +00:00
Jesse Natalie
d3faac7a15
nir: Add options to nir_lower_compute_system_values to control compute ID base lowering
...
If no options are provided, existing intrinsics are used.
If the lowering pass indicates there should be offsets used for global
invocation ID or work group ID, then those instructions are lowered to
include the offset.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5891 >
2020-08-21 22:07:05 +00:00
Jesse Natalie
2e1df6a17f
nir: Move compute system value lowering to a separate pass
...
The actual variable -> intrinsic lowering stays where it is, but
ops which convert one intrinsic to be implemented in terms of
another have moved.
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5891 >
2020-08-21 22:07:05 +00:00
Pierre Moreau
a624faeef9
clover/nir: Register callback for translation messages (v2)
...
This allows us to add SPIR-V to NIR translation failure messages to the
program’s compilation log, which can then be queried by the user.
v2: Replace the if-statement in `debug_function()` with an assert.
Signed-off-by: Pierre Moreau <dev@pmoreau.org >
Reviewed-by: Serge Martin <edb@sigluy.net >
Reviewed-by: Francisco Jerez <currojerez@riseup.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5038 >
2020-08-20 19:48:12 +00:00
Jason Ekstrand
8f7784ee8d
clover/nir: Use the correct address mode for shared
...
Shared memory needs to have 64-bit pointers but we want 32-bit offsets
most of the time. This is exactly what 32bit_offset_as_64bit is for.
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6367 >
2020-08-19 18:11:42 +00:00
Jason Ekstrand
b2226f7a98
clover/nir: Stop computing the global address format twice
...
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6367 >
2020-08-19 18:11:42 +00:00
Jason Ekstrand
884d2021d9
clover/nir: Stop setting ubo_addr_format
...
We unconditionally set constant_as_global = true so we should never get
UBO access out of spirv_to_nir.
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6367 >
2020-08-19 18:11:42 +00:00
Karol Herbst
4403176201
clover/nir: support int64 atomics if the device supports it
...
Signed-off-by: Karol Herbst <kherbst@redhat.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Reviewed-by: Pierre Moreau <dev@pmoreau.org >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6367 >
2020-08-19 18:11:42 +00:00
Karol Herbst
918e444f04
clover/nir: Call vars_to_explicit_types for shared memory
...
This is required for shared memory buffers declared with an explicit
size inside the kernel.
Signed-off-by: Karol Herbst <kherbst@redhat.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6367 >
2020-08-19 18:11:42 +00:00
Jesse Natalie
ee905aa3a0
nir/vtn: CL SPIR-V callers should specify address modes
...
Instead of inferring the address mode from the environment, allows
callers to override to suit their needs.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6330 >
2020-08-17 14:36:18 +00:00
Karol Herbst
384c4df23d
clover/nir: fix mem_shared by using address_format_32bit_offset
...
Signed-off-by: Karol Herbst <kherbst@redhat.com >
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6325 >
2020-08-15 10:59:39 +00:00
Boris Brezillon
bfee35b45c
nir: Stop passing an options arg to nir_lower_int64()
...
This information is exposed through shader->options->lower_int64_options.
Removing the extra arg forces drivers to initialize this field correctly.
This also allows us to check the int64 lowering options from each int64
lowering helper and decide if we should lower the instructions we
introduce.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com >
Reviewed-by: Matt Turner <mattst88@gmail.com >
Reviewed-by: Rob Clark <robdclark@chromium.org >
Acked-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5588 >
2020-07-30 16:54:24 +00:00
Jason Ekstrand
2956d53400
nir: Add nir_foreach_shader_in/out_variable helpers
...
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966 >
2020-07-29 17:38:57 +00:00
Karol Herbst
e2e89fb137
nir/lower_io: assert that offsets are used for shader_in
...
Signed-off-by: Karol Herbst <kherbst@redhat.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Acked-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6059 >
2020-07-25 08:51:48 +00:00
Jason Ekstrand
196db51fc2
anv,turnip,radv,clover,glspirv: Run nir_copy_prop before nir_opt_deref
...
We're about to make the SPIR-V -> NIR path generate a bit more complex
SSA chains for certain derefs. This will ensure we don't regress anyone
when we start making vec2's of derefs.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5278 >
2020-07-23 22:43:21 -05:00
Marek Olšák
d6287a94b6
gallium: rename 'state tracker' to 'frontend'
...
Acked-by: Eric Anholt <eric@anholt.net >
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4902 >
2020-05-13 13:46:53 -04:00