Bug 103031

Summary: [llvmpipe] piglit fs-discard-exit-2 fails with llvm-6.0
Product: Mesa Reporter: Vinson Lee <vlee>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium CC: brianp, jfonseca, sroland
Version: gitKeywords: bisected
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: patch accounting for llvm nuked pabs intrinsics

Description Vinson Lee 2017-09-28 18:23:03 UTC
mesa: 8822ea100cfd7482290c3c6b2a7200c8b888a7f4 (master 17.3.0-devel)

$ ./bin/fs-discard-exit-2 -auto
LLVM ERROR: Program used external function 'llvm.x86.avx2.pabs.d' which could not be resolved!


a01e7680ad38c8baf765139b103bd68867ccd541 is the first bad commit
commit a01e7680ad38c8baf765139b103bd68867ccd541
Author: Uriel Korach <uriel.korach@intel.com>
Date:   Wed Sep 13 09:02:36 2017 +0000

    [X86] [PATCH] [intrinsics] Lowering X86 ABS intrinsics to IR. (llvm)
    
    This patch, together with a matching clang patch (https://reviews.llvm.org/D37694), implements the lowering of X86 ABS intrinsics to IR.
    
    differential revision: https://reviews.llvm.org/D37693.
    
    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313134 91177308-0d34-0410-b5e6-96231b3b80d8

:040000 040000 2cc558d3c8a5f1935ea333e85012666d62df586d c0800435b8a2cebdd1f8190d040b1d1fe3882ced M	include
:040000 040000 39f3c469eefca37342fd032cb03f7d020ccb5056 7193574dea34b9e31f9e3e5f80064fe2e6489576 M	lib
:040000 040000 9c7a3e449186b20c24bd035ed300d2d3a9fc49f1 fc08b787fb9504e481e550a85e94445fd2a794ed M	test
bisect run success
Comment 1 Roland Scheidegger 2017-09-28 18:56:36 UTC
Created attachment 134554 [details] [review]
patch accounting for llvm nuked pabs intrinsics

Does this patch work?
I'm also changing the non-intrinsic definition of pabs to basically match what the auto-upgrader would do (if it would actually work for us...), so that llvm should be able to hopefully match that back to a pabs in the end (albeit the cmp/select has additional sext/trunc - I hope that doesn't matter...) - the old code would have used a max, which would have to be decomposed into a cmp/select too with newer llvm versions but it would have used select(cmp(greater, a, neg(a))) instead of select(cmp(greater, a, 0), neg(a)). Not sure if that would also get fused to a pabs instruction in the end...
Comment 2 Vinson Lee 2017-10-05 22:34:11 UTC
(In reply to Roland Scheidegger from comment #1)
> Created attachment 134554 [details] [review] [review]
> patch accounting for llvm nuked pabs intrinsics
> 
> Does this patch work?
> I'm also changing the non-intrinsic definition of pabs to basically match
> what the auto-upgrader would do (if it would actually work for us...), so
> that llvm should be able to hopefully match that back to a pabs in the end
> (albeit the cmp/select has additional sext/trunc - I hope that doesn't
> matter...) - the old code would have used a max, which would have to be
> decomposed into a cmp/select too with newer llvm versions but it would have
> used select(cmp(greater, a, neg(a))) instead of select(cmp(greater, a, 0),
> neg(a)). Not sure if that would also get fused to a pabs instruction in the
> end...

Yes, this patch fixes the llvm.x86.avx2.pabs.d error.
Comment 3 Roland Scheidegger 2017-10-06 22:55:57 UTC
> Yes, this patch fixes the llvm.x86.avx2.pabs.d error.

Thanks for testing, fixed with 52b73caaf40e79c90a105ec6d349abb3398e3c6b.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.