[Mesa-dev] [PATCH 1/4] amd/common: add nir->llvm translation.

Marek Olšák maraeo at gmail.com
Wed Oct 5 19:15:30 UTC 2016


On Wed, Oct 5, 2016 at 1:58 AM, Dave Airlie <airlied at gmail.com> wrote:
> On 4 October 2016 at 20:09, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
>> On 04.10.2016 03:48, Dave Airlie wrote:
>>>
>>> From: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
>>>
>>> This adds the basic files for the NIR->LLVM translation layer,
>>> along with some hopefully generic code to load the binary
>>> result, and other helpers required.
>>>
>>> The hope is in the future we could share this with an
>>> GL_ARB_spirv implementation or a push to replace TGSI
>>> with NIR in radeonsi.
>>
>>
>> Indeed. :)
>>
>> Skimming over this, two remarks:
>>
>> 1. In ac_binary.c, just include sid.h instead of duplicating #defines.
>> 2. There are several files with missing copyright headers -- that's an
>> absolute no-go.
>
> Okay done.
>
>>> +AM_CFLAGS = -Wno-override-init -msse2 \
>>
>>
>> Why the -Wno-override-init? The -msse2 is probably fine, but let's not leak
>> it to someone who uses r300 on an ancient system...
>
> possibly copied from anv, I've dropped them for now.
>>>
>>> diff --git a/src/amd/common/ac_llvm_helper.cpp
>>> b/src/amd/common/ac_llvm_helper.cpp
>>> new file mode 100644
>>> index 0000000..feafdaf
>>> --- /dev/null
>>> +++ b/src/amd/common/ac_llvm_helper.cpp
>>> @@ -0,0 +1,22 @@
>>> +>> +// Workaround http://llvm.org/PR23628
>>> +#if HAVE_LLVM >= 0x0307
>>> +#  pragma push_macro("DEBUG")
>>> +#  undef DEBUG
>>> +#endif
>>> +
>>> +#include "ac_nir_to_llvm.h"
>>> +#include <llvm-c/Core.h>
>>> +#include <llvm/Target/TargetOptions.h>
>>> +#include <llvm/ExecutionEngine/ExecutionEngine.h>
>>> +
>>> +extern "C" void
>>> +ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes)
>>> +{
>>> +#if HAVE_LLVM >= 0x0306
>>
>>
>> We only build with LLVM >= 3.6, so drop this check.
>
> Well in the common code it would be nice in the future to share it with radeonsi
> if we can, and that probably means having it work on earlier llvm, so where I've
> copied code from other places that does LLVM version checks I've kept them
> for now. so in the vulkan driver itself I think dropping them is fine,
> in the common
> code I'd like to keep them for now.

Nicolai meant that Mesa/radeonsi doesn't support LLVM < 3.6. Thus,
HAVE_LLVM >= 3.6 is tautology.

We may soon drop support for LLVM 3.6 & 3.7 from radeonsi in order to
get rid of monolithic shaders.

Marek


More information about the mesa-dev mailing list