mesa merge requestshttps://gitlab.freedesktop.org/mesa/mesa/-/merge_requests2024-02-16T17:38:39Zhttps://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27650Draft: nir: Renaming gl_shader_stage to shader_stage.2024-02-16T17:38:39ZSarthak BhattDraft: nir: Renaming gl_shader_stage to shader_stage.### nir cleanup for renaming gl_shader_stage.
Removed the old usage of gl_shader_stage and update it with shader_stage as discussed in issue #9040.### nir cleanup for renaming gl_shader_stage.
Removed the old usage of gl_shader_stage and update it with shader_stage as discussed in issue #9040.https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24948rusticl: support asahi2023-12-09T15:01:05ZKarol Herbstkherbst@redhat.comrusticl: support asahilatest OpenCL CTS run: `Pass 2371 Fails 51 Crashes 26` (without allocations as they bring down the system too easily)
Requires https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24939 to actually run.
Remaining problems to be so...latest OpenCL CTS run: `Pass 2371 Fails 51 Crashes 26` (without allocations as they bring down the system too easily)
Requires https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24939 to actually run.
Remaining problems to be solved:
- [x] critical: `Bus error` on release builds (https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24967)
- [ ] some weird kernel bug (`Unknown event message`)
- [ ] scratch memory (10 Crashes)
- [ ] spilling (15 Crashes)
- [ ] `PIPE_CAP_QUERY_TIMESTAMP` for profiling (36 Fails)
- [ ] linear 3D images (6 Fails)
- [x] rusticl binds resources as images even if not supported by the driver https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24982
- [ ] some ALU precision (5 Fails)
- [x] 1D buffer images (4 Crashes) https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24993
- [ ] pack_32_4x8_split (1 Crash)
- [x] figure out how to fix `nir_opt_preamble` messing up `load_workgroup_size`https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25743nine: add asahi as a supported driver2023-10-26T04:05:52ZMartellnine: add asahi as a supported driver## Asahi support for nine
Now that we are seeing things like 4k kernel emulation people are starting to look at games on Asahi.
We probably won't have a Vulkan driver for awhile that can run dxvk as that is a large undertaking. ref #4...## Asahi support for nine
Now that we are seeing things like 4k kernel emulation people are starting to look at games on Asahi.
We probably won't have a Vulkan driver for awhile that can run dxvk as that is a large undertaking. ref #4792
The Opengl driver is in great shape so Nine seems like the easy short term path to some directx support.
![Screenshot_20231015_134957](/uploads/70f6d94ce64417e2317c630a8075fc1c/Screenshot_20231015_134957.png)
I ran Nine tests locally as I iterated on this, this is the current status.
Still more todo to get to 100% but some tests are also bad and I do not know where to upstream my fixes.
```
Total 19571
succ: 19394
fail: 158
skip: 19
```
To run build this people will have to configure meas like this (but also have the UAPI form asahi/mesa)
```
meson build64 --libdir lib64 --prefix $HOME/mesa -Dgallium-drivers=asahi -Dgallium-nine=true -Dosmesa=false -Dvulkan-drivers= -Dbuildtype=release
```
### Reviewer Notes:
The HACK commits are not intended for review, these are there because nine tests does not like asserts
@dh I used your nine tests fork on github for running these
Some of these commits are general nine commits and will also help nine on other drivers like v3d falling back to PIPE_CAP_NIR_COMPACT_ARRAYS when PIPE_CAP_CLIP_HALFZ is not available so can pull some of these into another PR and merge when they are approved. ref: !22644
I also can't find any asahi ci jobs for cts to see if it is okay to just enable PIPE_CAP_NIR_COMPACT_ARRAYS
I'll have to figure out how to run that locally so consider that a HACK patch unless people tell me otherwise.
Here is a reference to all the other implementations
v3d: https://gitlab.freedesktop.org/mesa/mesa/-/commit/8fb16b88142faf45d993356ec36a96d20ca05aaf
freedreno: https://gitlab.freedesktop.org/mesa/mesa/-/commit/b76c6dcbc55d6d2bfdb92950ec5af00430aef943
zink: https://gitlab.freedesktop.org/mesa/mesa/-/commit/8edd357795bf71c98bca73de34d962ddbaacccc4
iris: https://gitlab.freedesktop.org/mesa/mesa/-/commit/edd3ce5a63eb11e8063177545fcb77dc4fe7454d
d3d12 https://gitlab.freedesktop.org/mesa/mesa/-/commit/bd64669fa74a80137c212b03f37afe0836a28800Needs changeshttps://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24946asahi: Disable fp16 for browsers2023-10-22T14:37:51ZAsahi Linaasahi: Disable fp16 for browsers### What does this MR do and why?
Add the necessary scaffolding to support driconf options in asahi, and then
disable fp16 support for all browsers.
There are way too many broken WebGL apps using the wrong precision
qualifiers, which c...### What does this MR do and why?
Add the necessary scaffolding to support driconf options in asahi, and then
disable fp16 support for all browsers.
There are way too many broken WebGL apps using the wrong precision
qualifiers, which causes anything from jittery geometry to complete
breakage (e.g. QuakeJS and other games).
In addition, a Firefox bug is breaking basic canvas rendering for the
same reason (mozilla bug #1845309).
Let's just disable fp16 for browsers. There is no hope of getting all
this broken stuff fixed.
Signed-off-by: Asahi Lina <lina@asahilina.net>https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25497asahi: Oct 1 sync - layered rendering & perf improvements2023-10-01T22:46:59ZAlyssa Rosenzweigasahi: Oct 1 sync - layered rendering & perf improvementsNeeds mergeAlyssa RosenzweigAlyssa Rosenzweighttps://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25017nir: Add nir_x/y/z/w helpers, but don't use them treewide2023-09-10T17:16:31ZAlyssa Rosenzweignir: Add nir_x/y/z/w helpers, but don't use them treewideThese have a few benefits over nir_channel:
* Shorter.
* Wraps more nicely.. it's weird to have the 0 on a different line from the
thing you're taking the channel of, versus reading left-to-right top-to-bottom
with nir_x you know yo...These have a few benefits over nir_channel:
* Shorter.
* Wraps more nicely.. it's weird to have the 0 on a different line from the
thing you're taking the channel of, versus reading left-to-right top-to-bottom
with nir_x you know you're interested in the x component.
* Sometimes clearer, though this might be a wash.
However, they're sometimes more annoying than they're worth, so this MR adds the helpers as an optional convenience but doesn't convert the tree to use them.Needs reviewhttps://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25134nir,radv: Devendor rasterization_samples_amd2023-09-10T17:15:45ZAlyssa Rosenzweignir,radv: Devendor rasterization_samples_amd### What does this MR do and why?
<!-- Describe in detail what your merge request does and why. -->
nir,radv: Devendor rasterization_samples_amd
I want this for AGX too, there's nothing AMD-specific here.
Signed-off-by: Alyssa Rosenzw...### What does this MR do and why?
<!-- Describe in detail what your merge request does and why. -->
nir,radv: Devendor rasterization_samples_amd
I want this for AGX too, there's nothing AMD-specific here.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25041Draft: nir: Add an opt-out for SM5 behaviour of masks2023-09-06T17:03:56ZAlyssa RosenzweigDraft: nir: Add an opt-out for SM5 behaviour of masksWhile GLSL and SPIR-V define out-of-bounds shifts to be undefined, NIR defines shifts according to SM5 semantics (using lower 5-bits as appropriate). Some backends cannot support SM5 shifts directly and currently must insert masking in t...While GLSL and SPIR-V define out-of-bounds shifts to be undefined, NIR defines shifts according to SM5 semantics (using lower 5-bits as appropriate). Some backends cannot support SM5 shifts directly and currently must insert masking in the backend to compensate. This is not ideal, and on hardware backends is a performance issue (ballpark of 1% perf hit on Dolphin ubershaders on M1).
One solution would be splitting out SM5 and non-SM5 shift opcodes. The problem is that there is no obvious "canonical" representation, so lots of nir_opt_algebraic rules etc would need to be duplicated to apply properly for both kinds of backends. It would also probably require significant cross tree churn to implement.
The solution used here is a bit more crude: a flag that communicates a *domain restriction*. The *definition* of ishl/ishr/ushr in NIR does not change, we continue to define it with SM5 semantics. However, the *domain* is restricted, making it invalid to produce out-of-bounds shifts if the backend has opted-out. This is less heavy-handed, as it does not disrupt the SM5 majority. What it does require is auditing producers to ensure that out-of-bounds shifts are only produced for `!lower_sm5_shift` backends or as a result of undefined behaviour in the original shader. This is a lot easier to do, as it only requires auditing common code. It's probably a good idea anyway.
Many of the shifts produced in common code are immediates. We can check these shifts with an assert as long as we use the `_imm` versions of the shifts. Some patches here convert lots of shifts in common code to use `_imm` versions, reducing the surface of the audit.
Shifts produced by GLSL-to-NIR and SPIRV-to-NIR do need SM5 semantics, they fall under the rule of "undefined behaviour in, undefined behaviour out".
Shifts produced by drivers that don't opt-out of SM5 are only used on those drivers so are fine.
Putting it together, there aren't *too* many changes required to opt-out of SM5 on the affected backends, and this lets those backends drop their masking code. This simplifies both backends, and winning back performance on both Asahi GL, Asahi VK, and (with the Zink change) Asahi GL-on-VK.
---
Ironically, Metal Shading Language is defined to use SM5 shifts.
---
Issues:
- [ ] Maybe need to deal with this in tgsi-to-nir?
- [ ] This is still deeply terrible. Is there a better way to do this? I hate this.Needs discussionhttps://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25034gallium,mesa/st: Add PIPE_CONTEXT_NO_LOD_BIAS flag2023-09-05T19:42:20ZAlyssa Rosenzweiggallium,mesa/st: Add PIPE_CONTEXT_NO_LOD_BIAS flagWhile desktop GL supports sampler LOD bias, GLES does not. To support the GL use
case, all Gallium drivers are expected to handle sampler LOD bias. However, this
may require shader code to implement (lowering tex to txb, txl to fadd+txl)...While desktop GL supports sampler LOD bias, GLES does not. To support the GL use
case, all Gallium drivers are expected to handle sampler LOD bias. However, this
may require shader code to implement (lowering tex to txb, txl to fadd+txl) and
cost resources to push the LOD bias constants into the shader. The issue is
compounded with something like Dolphin's GLES renderer, which does this LOD bias
emulation itself -- meaning that LOD bias is lowered twice when using Dolphin
with GLES! As such, this commit adds a context flag for frontends to communicate
that they will never use sampler LOD bias, allowing the driver to omit the
lowering as a GLES fast path (or, for Dolphin, for performance parity between
GLES and GL).
This will be used on Asahi. It could also be used to optimize a path on
Mali-T720 supported in Panfrost, though I don't intend to write that patch.Needs mergehttps://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24917nir: Add nir_x/y/z/w helpers2023-09-02T13:24:01ZAlyssa Rosenzweignir: Add nir_x/y/z/w helpers* Shorter.
* Wraps more nicely.. it's weird to have the 0 on a different line from the
thing you're taking the channel of, versus reading left-to-right top-to-bottom
with nir_x you know you're interested in the x component.
* Sometim...* Shorter.
* Wraps more nicely.. it's weird to have the 0 on a different line from the
thing you're taking the channel of, versus reading left-to-right top-to-bottom
with nir_x you know you're interested in the x component.
* Sometimes clearer, though this might be a wash.https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24863agx/lower_address: Use intrinsics_pass2023-08-24T16:21:04ZChristian Gmeineragx/lower_address: Use intrinsics_pass### What does this MR do and why?
<!-- Describe in detail what your merge request does and why. -->
Convert to use nir_shader_intrinsics_pass(..). This is not handled by !24852### What does this MR do and why?
<!-- Describe in detail what your merge request does and why. -->
Convert to use nir_shader_intrinsics_pass(..). This is not handled by !24852https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24871agx/lower_address: Remove not used has_offset2023-08-24T16:20:15ZChristian Gmeineragx/lower_address: Remove not used has_offset### What does this MR do and why?
<!-- Describe in detail what your merge request does and why. -->
agx/lower_address: Remove not used has_offset
Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>### What does this MR do and why?
<!-- Describe in detail what your merge request does and why. -->
agx/lower_address: Remove not used has_offset
Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>Alyssa RosenzweigAlyssa Rosenzweighttps://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24686nir: Rename to (nir_op_mov_vec1, nir_op_mov_vec2, ... nir_op_mov_vec16)2023-08-15T03:30:13ZYonggang Luonir: Rename to (nir_op_mov_vec1, nir_op_mov_vec2, ... nir_op_mov_vec16)https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24668lots: Stop passing nir_dest around2023-08-14T22:01:39ZAlyssa Rosenzweiglots: Stop passing nir_dest aroundTowards #9558Towards #9558https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24637nir: Prefer SSA-based source rewriting2023-08-11T22:47:10ZAlyssa Rosenzweignir: Prefer SSA-based source rewritingNow that there are no registers around this should be safe.
Via Coccinelle patch:
@@
expression instr, src, ssa;
@@
-nir_instr_rewrite_src_ssa(instr, src, ssa)
+nir_src_rewrite_ssa(src, ssa)
@@
expression ...Now that there are no registers around this should be safe.
Via Coccinelle patch:
@@
expression instr, src, ssa;
@@
-nir_instr_rewrite_src_ssa(instr, src, ssa)
+nir_src_rewrite_ssa(src, ssa)
@@
expression instr, src, ssa;
@@
-nir_instr_rewrite_src(instr, src, nir_src_for_ssa(ssa))
+nir_src_rewrite_ssa(src, ssa)
@@
expression nif, src, ssa;
@@
-nir_if_rewrite_condition(nif, nir_src_for_ssa(ssa))
+nir_src_rewrite_ssa(&nif->condition, ssa)
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>Alyssa RosenzweigAlyssa Rosenzweighttps://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24378nir: Rename scoped_barrier -> barrier2023-08-01T19:08:03ZAlyssa Rosenzweignir: Rename scoped_barrier -> barrierNow that non-scoped barriers are gone, the scoped prefix is just noise.
sed + ninja clang-format + fix up spacing for common code.
If you are unhappy that I did not manually change the whitespace of your driver,
you need to enable clan...Now that non-scoped barriers are gone, the scoped prefix is just noise.
sed + ninja clang-format + fix up spacing for common code.
If you are unhappy that I did not manually change the whitespace of your driver,
you need to enable clang-format for it so the formatting would happen
automatically.Needs mergehttps://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23397clang-format: be consistent with the return type between function declaration...2023-06-02T18:13:41ZEric Engestromeric@engestrom.chclang-format: be consistent with the return type between function declarations and definitionsSee https://clang.llvm.org/docs/ClangFormatStyleOptions.html#alwaysbreakafterreturntype
With `TopLevelDefinitions` we get this:
static agx_block *emit_cf_list(agx_context *ctx, struct exec_list *list);
static agx_block *
e...See https://clang.llvm.org/docs/ClangFormatStyleOptions.html#alwaysbreakafterreturntype
With `TopLevelDefinitions` we get this:
static agx_block *emit_cf_list(agx_context *ctx, struct exec_list *list);
static agx_block *
emit_cf_list(agx_context *ctx, struct exec_list *list)
{
}
Functions declarations and definitions are formatted using different
rules.
With `TopLevel` we get this:
static agx_block *
emit_cf_list(agx_context *ctx, struct exec_list *list);
static agx_block *
emit_cf_list(agx_context *ctx, struct exec_list *list)
{
}
Which is more consistent, and what some other, currently
non-formatting-enforced parts of Mesa do (such as EGL).
The difference between `TopLevel` and `All` is the former ignores the
rule in C++ classes, while the latter applies it consistently regardless
of where the function is.
I can easily be convinced to change that to `TopLevel` though, is someone working on C++ code prefers that.https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23190nir/opt_barriers: Add a default callback2023-05-24T14:55:48ZAlyssa Rosenzweignir/opt_barriers: Add a default callbackAbsent any knowledge about the hardware, if the backend wants to combine
barriers we should try to combine all barriers.
---
I will use this in nir-to-tgsi.Absent any knowledge about the hardware, if the backend wants to combine
barriers we should try to combine all barriers.
---
I will use this in nir-to-tgsi.Needs mergehttps://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22008asahi: Disable device init on !macOS2023-03-29T09:37:01ZAsahi Linaasahi: Disable device init on !macOSThis was never ready on Linux. Apparently some distros have started
compiling in the asahi driver in upstream mesa, which causes things to
break in very interesting ways when some app (like Xorg...) decides to
use the GPU device, even wi...This was never ready on Linux. Apparently some distros have started
compiling in the asahi driver in upstream mesa, which causes things to
break in very interesting ways when some app (like Xorg...) decides to
use the GPU device, even without having it hooked up in kmsro...
This is already fixed upstream as part of larger changes in !21662, but
it's not something that can be cherry-picked. Let's just backport a
trivial change that always fails device init for asahi.
Signed-off-by: Asahi Lina <lina@asahilina.net>https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22017asahi/compiler: fix copy/pasta in agx_pack_alu_src2023-03-22T17:31:15ZEric Engestromeric@engestrom.chasahi/compiler: fix copy/pasta in agx_pack_alu_srcFixes: f2d264e19179268cacf9 ("agx: Add instruction packing")Fixes: f2d264e19179268cacf9 ("agx: Add instruction packing")Alyssa RosenzweigAlyssa Rosenzweig