Khem Raj
5a9c052ba7
amd: Include missing llvm IR header Module.h
...
With LLVM-19, Module.h header is not being pulled, which results in
compile errors e.g.
src/amd/llvm/ac_llvm_helper.cpp:102:10: error: no matching function for call to ‘unwrap(LLVMOpaqueModule*&)’
102 | unwrap(module)->setTargetTriple(TM->getTargetTriple().getTriple());
| ~~~~~~^~~~~~~~
In file included from /mnt/b/yoe/master/build/tmp/work/x86_64-linux/mesa-native/24.0.7/recipe-sysroot-native/usr/include/llvm/IR/Type.h:18,
from /mnt/b/yoe/master/build/tmp/work/x86_64-linux/mesa-native/24.0.7/recipe-sysroot-native/usr/include/llvm/IR/DerivedTypes.h:23,
from /mnt/b/yoe/master/build/tmp/work/x86_64-linux/mesa-native/24.0.7/recipe-sysroot-native/usr/include/llvm/IR/InstrTypes.h:26,
from /mnt/b/yoe/master/build/tmp/work/x86_64-linux/mesa-native/24.0.7/recipe-sysroot-native/usr/include/llvm/Analysis/TargetLibraryInfo.h:14,
from ../mesa-24.0.7/src/amd/llvm/ac_llvm_helper.cpp:8:
Its getting the definition from llvm/IR/Type.h instead of Module.h and caused
confusion to compiler
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11424
Signed-off-by: Khem Raj <raj.khem@gmail.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29993 >
2024-07-03 19:26:47 +00:00
Kai Wasserbäch
bc7e363f8e
fix: ac/llvm: LLVM 18: remove useless passes, partially removed upstream
...
Upstream removed llvm::createLoopSinkPass() in commit
<https://github.com/llvm/llvm-project/commit/b9975cec0ea0a2f10d65b7bd1197d9e1706cbd3d >
and there is no useful alternative except moving to the new pass
manager.
On top of that, the usage of this optimisation pass and
PromoteMemoryToRegisterPass were just useless, according to the
upstream developer of the commit named above. Therefore the easiest
solution is, as him, Marek and Dave suggested, to just remove these two
passes from the pipeline for now.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10192
Reference: https://github.com/llvm/llvm-project/pull/72811
Reference: https://github.com/llvm/llvm-project/commit/b9975cec0ea0a2f10d65b7bd1197d9e1706cbd3d
Suggested-by: Dave Airlie <airlied@redhat.com >
Suggested-by: Aiden Grossman <agrossman154@yahoo.com >
Suggested-by: Marek Olšák <maraeo@gmail.com >
Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26336 >
2023-11-24 14:11:09 +00:00
Marek Olšák
6060b656f8
gallivm: fix build with LLVM 18
...
Reviewed-by: Dave Airlie <airlied@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25388 >
2023-09-26 05:45:17 +00:00
Rhys Perry
85d1159a2a
ac/llvm: fix AC_TM_CHECK_IR
...
This was using the wrong pass.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Fixes: 3f272fd15e ("ac/llvm: fix build with LLVM 17")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24140 >
2023-07-17 11:21:34 +00:00
Marek Olšák
6dc1ae1759
amd: drop support for LLVM 14
...
Reviewed-by: Qiang Yu <yuq825@gmail.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23471 >
2023-06-07 19:56:55 +00:00
Marek Olšák
3a9f8730f5
amd: drop support for LLVM 12
...
The demote emulation can be removed, and FS_CORRECT_DERIVS_AFTER_KILL
can be removed because it's always enabled on LLVM >= 13.
Reviewed-by: Qiang Yu <yuq825@gmail.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23471 >
2023-06-07 19:56:55 +00:00
Marek Olšák
e18344dd24
ac,radeonsi,winsyses: switch to SPDX-License-Identifier: MIT
...
excluding: aco, radv, addrlib
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Acked-by: David Heidelberg <david.heidelberg@collabora.com >
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23113 >
2023-05-24 21:48:19 +00:00
Harri Nieminen
f85f511a38
amd: fix typos in code
...
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22432 >
2023-04-13 23:08:22 +00:00
Pierre-Eric Pelloux-Prayer
3f272fd15e
ac/llvm: fix build with LLVM 17
...
This builds with LLVM 12 -> 17 and a running a simple app seems to work.
I couldn't test LLVM 11 because meson fails with:
Looking for a fallback subproject for the dependency llvm (modules:
bitwriter, engine, mcdisassembler, mcjit, core, executionengine,
scalaropts, transformutils, instcombine, amdgpu, bitreader, ipo, native)
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8297
Cc: mesa-stable
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22021 >
2023-03-21 15:05:25 +00:00
Marek Olšák
da7dfbe3b8
amd/llvm: fix LLVM 15 & 16 crashes in SelectionDAG.cpp
...
Cc: stable
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21041 >
2023-02-03 00:18:02 +00:00
Marek Olšák
2ae08c3e8f
ac/llvm: remove llvm:: now that we use "using namespace llvm"
...
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20297 >
2023-01-26 19:33:55 -05:00
Marek Olšák
d05c3811cd
ac/llvm: run the LLVM sinking pass because LLVM will stop running it
...
shader-db was run with the sinking pass disabled in LLVM.
58380 shaders in 35438 tests
Totals:
SGPRS: 2730768 -> 2730768 (0.00 %)
VGPRS: 1592932 -> 1592928 (-0.00 %)
Spilled SGPRs: 2687 -> 2687 (0.00 %)
Spilled VGPRs: 551 -> 551 (0.00 %)
Private memory VGPRs: 253 -> 253 (0.00 %)
Scratch size: 700 -> 700 (0.00 %) dwords per thread
Code Size: 61238872 -> 61238868 (-0.00 %) bytes
Max Waves: 849209 -> 849209 (0.00 %)
Outputs: 127090 -> 127090 (0.00 %)
Patch Outputs: 579 -> 579 (0.00 %)
Totals from affected shaders:
SGPRS: 440 -> 440 (0.00 %)
VGPRS: 396 -> 392 (-1.01 %)
Spilled SGPRs: 0 -> 0 (0.00 %)
Spilled VGPRs: 0 -> 0 (0.00 %)
Private memory VGPRs: 0 -> 0 (0.00 %)
Scratch size: 0 -> 0 (0.00 %) dwords per thread
Code Size: 49880 -> 49876 (-0.01 %) bytes
Max Waves: 105 -> 105 (0.00 %)
Outputs: 14 -> 14 (0.00 %)
Patch Outputs: 0 -> 0 (0.00 %)
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20297 >
2023-01-26 19:33:17 -05:00
Rhys Perry
062b5a9ba1
ac: use ResetAllOptionOccurrences instead of ResetCommandLineParser
...
Fixes -amdgpu-atomic-optimizations=true option.
From CommandLine.h:
/// Reset all command line options to a state that looks as if they have
/// never appeared on the command line. This is useful for being able to parse
/// a command line multiple times (especially useful for writing tests).
void ResetAllOptionOccurrences();
/// Reset the command line parser back to its initial state. This
/// removes
/// all options, categories, and subcommands and returns the parser to a state
/// where no options are supported.
void ResetCommandLineParser();
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Fixes: 7e2874dc93 ("ac: reset LLVM command line parser")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16850 >
2022-06-07 10:29:56 +00:00
Pierre-Eric Pelloux-Prayer
2172ddf2bf
ac: export LLVM c++ ResetCommandLineParser method
...
This method isn't part of the C API but we can still use it and
avoid getting error messages from the command line parser:
mesa: for the [...]: may only occur zero or one times
We could call it at the beginning of ac_init_llvm_target but
this may hide some real bugs so let drivers call it.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16587 >
2022-05-25 12:03:34 +00:00
Marek Olšák
b8a6bbc6c5
ac/llvm: don't create the target machine if the LLVM processor is unsupported
...
If a processor is unsupported, LLVM chooses "tahiti", which hangs
everything except gfx6. Check for support manually.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16112 >
2022-04-25 13:43:15 +00:00
Marek Olšák
fc0e6fdcce
ac/llvm: remove unused LLVM helpers
...
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16112 >
2022-04-25 13:43:15 +00:00
Pierre-Eric Pelloux-Prayer
7d7c56e61a
radeonsi: drop LLVM global instruction selector
...
I'm not sure if this is really used by anyone?
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15559 >
2022-03-31 10:15:19 +00:00
Samuel Pitoiset
09cf2584bd
ac/llvm: fix build with LLVM 14
...
AttributeList::hasAttribute() has been replaced by
hasParamAttr()/hasRetAttr().
All supported LLVM versions have hasParamAttr().
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5320
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12715 >
2021-09-13 10:04:30 +02:00
Marek Olšák
2747332723
amd: drop support for LLVM 9
...
This would be easy to support except that it doesn't support RDNA 2.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10199 >
2021-04-16 09:25:19 +00:00
Marek Olšák
f9e6c7a220
ac/llvm: fix ac_build_atomic_rmw with LLVM 13
...
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4383
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9361 >
2021-03-03 01:19:24 +00:00
Samuel Pitoiset
b00a023f1e
ac/nir: fix nir_intrinsic_shared_atomic_fadd
...
This was completely broken.
Fixes dEQP-VK.glsl.atomic_operations.add_float32_compute_shared.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6936 >
2020-10-01 06:38:42 +00:00
Samuel Pitoiset
8227b08c08
ac/llvm: fix invalid use of unreachable in ac_build_atomic_rmw()
...
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6936 >
2020-10-01 06:38:42 +00:00
Pierre-Eric Pelloux-Prayer
82d2d73e03
amd/llvm: switch to 3-spaces style
...
Follow-up of !4319 using the same clang-format config.
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Acked-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5310 >
2020-09-07 10:00:20 +02:00
Marek Olšák
d9a77f9ca3
ac/llvm: add better code for fsign
...
There are 2 improvements:
- better code for 16, 32, and 64 bits
- vector support for 16 and 32 bits
Totals:
SGPRS: 2639738 -> 2625882 (-0.52 %)
VGPRS: 1534120 -> 1533916 (-0.01 %)
Spilled SGPRs: 3541 -> 3557 (0.45 %)
Spilled VGPRs: 33 -> 33 (0.00 %)
Private memory VGPRs: 256 -> 256 (0.00 %)
Scratch size: 292 -> 292 (0.00 %) dwords per thread
Code Size: 55640332 -> 55384892 (-0.46 %) bytes
Max Waves: 964785 -> 964857 (0.01 %)
Totals from affected shaders:
SGPRS: 377352 -> 363496 (-3.67 %)
VGPRS: 209800 -> 209596 (-0.10 %)
Spilled SGPRs: 1979 -> 1995 (0.81 %)
Spilled VGPRs: 0 -> 0 (0.00 %)
Private memory VGPRs: 256 -> 256 (0.00 %)
Scratch size: 256 -> 256 (0.00 %) dwords per thread
Code Size: 12549300 -> 12293860 (-2.04 %) bytes
Max Waves: 105762 -> 105834 (0.07 %)
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6284 >
2020-09-06 14:36:21 +00:00
Marek Olšák
f85294207f
Revert "ac: generate FMA for inexact instructions for radeonsi"
...
This reverts commit 4b9370cb0f .
Fixes: 4b9370cb0f
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3429
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6284 >
2020-09-06 14:36:20 +00:00
James Park
24b80f8bb9
amd/llvm: Reorder LLVM headers
...
LLVM uses __declspec(restrict) which breaks because Mesa define restrict
as __restrict. Move the LLVM headerse up to dodge the macro.
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Reviewed-by: Eric Engestrom <eric@engestrom.ch >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6180 >
2020-08-05 17:15:18 +00:00
Bas Nieuwenhuizen
40e00c800c
amd/llvm: Mark pointer function arguments as 32-byte aligned.
...
Otherwise LLVM does not see the pointers as allowing speculative
loads.
The pipeline-db results are pretty wild, but mostly what is to be
expected from allowing more code movement in LLVM:
Totals from affected shaders:
SGPRS: 157728 -> 168336 (6.73 %)
VGPRS: 158628 -> 158664 (0.02 %)
Spilled SGPRs: 10845 -> 24753 (128.24 %)
Spilled VGPRs: 13 -> 13 (0.00 %)
Private memory VGPRs: 0 -> 0 (0.00 %)
Scratch size: 8 -> 8 (0.00 %) dwords per thread
Code Size: 17189180 -> 17313712 (0.72 %) bytes
LDS: 204 -> 204 (0.00 %) blocks
Max Waves: 5700 -> 5687 (-0.23 %)
Wait states: 0 -> 0 (0.00 %)
This gives some boosts for shaders we can move a descriptor load
outside a loop.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3159 >
2020-07-08 23:47:06 +00:00
Marek Olšák
b97cc41aa2
Revert "ac: reassociate FP expressions for inexact instructions for radeonsi"
...
This reverts commit cf2f3c2753 .
It breaks shadows in Unigine Superposition.
Fixes: cf2f3c2753
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4837 >
2020-05-04 11:51:37 -04:00
Marek Olšák
cf2f3c2753
ac: reassociate FP expressions for inexact instructions for radeonsi
...
Totals:
SGPRS: 2591784 -> 2590696 (-0.04 %)
VGPRS: 1666888 -> 1666736 (-0.01 %)
Spilled SGPRs: 4131 -> 4107 (-0.58 %)
Spilled VGPRs: 38 -> 38 (0.00 %)
Private memory VGPRs: 2176 -> 2176 (0.00 %)
Scratch size: 2228 -> 2228 (0.00 %) dwords per thread
Code Size: 52715468 -> 52693584 (-0.04 %) bytes
LDS: 92 -> 92 (0.00 %) blocks
Max Waves: 479897 -> 479892 (-0.00 %)
Wait states: 0 -> 0 (0.00 %)
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4696 >
2020-04-27 11:20:16 +00:00
Marek Olšák
4b9370cb0f
ac: generate FMA for inexact instructions for radeonsi
...
NIR mostly does this already.
Totals:
SGPRS: 2588520 -> 2591784 (0.13 %)
VGPRS: 1666984 -> 1666888 (-0.01 %)
Spilled SGPRs: 4074 -> 4131 (1.40 %)
Spilled VGPRs: 38 -> 38 (0.00 %)
Private memory VGPRs: 2176 -> 2176 (0.00 %)
Scratch size: 2228 -> 2228 (0.00 %) dwords per thread
Code Size: 52726872 -> 52715468 (-0.02 %) bytes
LDS: 92 -> 92 (0.00 %) blocks
Max Waves: 479872 -> 479897 (0.01 %)
Wait states: 0 -> 0 (0.00 %)
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4696 >
2020-04-27 11:20:16 +00:00
Marek Olšák
f2c2a28073
ac: update and document fast math flags used by radeonsi
...
This should have no effect, because we never use FP division, but
it's safer for the future.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4696 >
2020-04-27 11:20:16 +00:00
Samuel Pitoiset
519d9b30de
radv: remove useless RADV_DEBUG=unsafemath debug option
...
This option is useless and shouldn't be used at all.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
2019-11-15 09:07:34 +01:00
Samuel Pitoiset
ee9811a0bb
ac: fix build with recent LLVM
...
Build is broken since "Move CodeGenFileType enum to Support/CodeGen.h".
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
2019-11-14 14:41:55 +00:00
Samuel Pitoiset
7dfb15fff1
ac/llvm: add AC_FLOAT_MODE_ROUND_TO_ZERO
...
Because some instructions will be optimized by the backend compiler,
the driver has to manually flush to zero to keep the result exact.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
2019-10-18 16:55:51 +02:00
Timur Kristóf
3a08110d43
amd: Move all amd/common code that depends on LLVM to amd/llvm.
...
This commit is a step towards the goal of being able to build RADV
without LLVM. In the future we would like to offer the option to
use RADV solely with ACO. There is still a need for the common AMD
code located in amd/common but the LLVM specific parts need to be
separated.
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Acked-by: Marek Olšák <marek.olsak@amd.com >
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
2019-10-08 00:44:08 +00:00