Summary: | clang+llvm from svn crashes when generating opencl code for 64 bit types | ||
---|---|---|---|
Product: | Mesa | Reporter: | klondike <klondike> |
Component: | Drivers/Gallium/r600 | Assignee: | Default DRI bug account <dri-devel> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | medium | CC: | jv356, peter, vedran |
Version: | 9.2 | ||
Hardware: | Other | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Bug Depends on: | |||
Bug Blocks: | 99553 | ||
Attachments: |
64 bit unsigned integer divide it causes the first issue
64 bit unsigned add, causes the second 64 bit unsigned multiply, also generates the second isssue. Expand most of the 64 bit operations into 32 bit ones piglit test showing importance of parameter order |
Description
klondike
2013-10-06 16:40:20 UTC
Created attachment 87200 [details]
64 bit unsigned add, causes the second
Created attachment 87201 [details]
64 bit unsigned multiply, also generates the second isssue.
Confirmed, both piglit tests scalar-arithmetic-long.cl and scalar-arithmetic-ulong.cl tests show the following error (__udivdi3 for ulong): 0x1cb47c0: i32 = ExternalSymbol'__divdi3' Undefined function UNREACHABLE executed at /src/llvm/lib/Target/R600/AMDGPUISelLowering.h:77! Stack dump: 0. Running pass 'Function Pass Manager' on module 'radeon'. 1. Running pass 'AMDGPU DAG->DAG Pattern Instruction Selection' on function '@div' I forgot to mention my environment: - HD6790 - Linux 3.11.0 - Mesa from git master, commit d7d539a1cb8dcf50cb7cd534e6ae7df3f42914c8 - LLVM from SVN trunk, rev 192532 (via git-svn) Created attachment 87543 [details] [review] Expand most of the 64 bit operations into 32 bit ones Well I have been messing a little bit with the TargetLowering. I have managed to get some operations to work (ANDs, ORs, XORs, UMULs, ADDS and SUBS amongst others) by forcing llvm to expand them. DIVs are a completely different world since they require more advanced algorithms which I'm not familiar with or support for calls (plus porting gcc's functions). The first one I don't have time to do (for now) the second one is waaaaay out of my league. The attached patch expands some of the 64 bit integer operations (but is still a WIP since likely most if not all (exceptions being loads and stores) need to be expanded and I haven't covered them all. Just a small note, the functions also seem to be defined in compiler-rt, we could use clang to compile them and preload them as part of the runtime. I tried the the patch from comment 5, but the piglit tests have not improved. Created attachment 87554 [details] piglit test showing importance of parameter order The order of parameters for long seems to matter. Output for the attached piglit test (failing tests on top): > Running kernel test: Arg0 = a + b Using kernel add0 Setting kernel arguments... Running the kernel... Validating results... Expecting 3 (0x3) with tolerance 0, but got 12884901888 (0x300000000) Error at long[0] Argument 0: FAIL PIGLIT:subtest {'Arg0 = a + b' : 'fail'} > Running kernel test: Arg1 = a + b Using kernel add1 Setting kernel arguments... Running the kernel... Validating results... Expecting 3 (0x3) with tolerance 0, but got 8589934593 (0x200000001) Error at long[0] Argument 1: FAIL PIGLIT:subtest {'Arg1 = a + b' : 'fail'} > Running kernel test: set arg0 to arg1 Using kernel set0 Setting kernel arguments... Running the kernel... Validating results... Expecting 4 (0x4) with tolerance 0, but got 17179869184 (0x400000000) Error at long[0] Argument 0: FAIL PIGLIT:subtest {'set arg0 to arg1' : 'fail'} (Passing tests below:) > Running kernel test: set arg1 to arg0 Using kernel set1 Setting kernel arguments... Running the kernel... Validating results... Argument 1: PASS PIGLIT:subtest {'set arg1 to arg0' : 'pass'} > Running kernel test: Arg2 = a + b Using kernel add2 Setting kernel arguments... Running the kernel... Validating results... Argument 2: PASS PIGLIT:subtest {'Arg2 = a + b' : 'pass'} > Running kernel test: set arg0 to arg1 (indirected) Using kernel setp0 Setting kernel arguments... Running the kernel... Validating results... Argument 0: PASS PIGLIT:subtest {'set arg0 to arg1 (indirected)' : 'pass'} > Running kernel test: set arg1 to arg0 (indirected) Using kernel setp1 Setting kernel arguments... Running the kernel... Validating results... Argument 1: PASS PIGLIT:subtest {'set arg1 to arg0 (indirected)' : 'pass'} > Running kernel test: set arg0 to arg2 (with dummy pointer) Using kernel set0_2 Setting kernel arguments... Running the kernel... Validating results... Argument 0: PASS PIGLIT:subtest {'set arg0 to arg2 (with dummy pointer)' : 'pass'} > Running kernel test: set arg2 to arg0 (with dummy pointer) Using kernel set2_0 Setting kernel arguments... Running the kernel... Validating results... Argument 2: PASS PIGLIT:subtest {'set arg2 to arg0 (with dummy pointer)' : 'pass'} Does this still occur? (In reply to Vedran Miletić from comment #9) > Does this still occur? I no longer have access to such machines aas the one I used has died. Sorry :( I am unable to recompile the the LLVM IR files due to the following error: llc: kk.ll:9:59: error: use of undefined metadata '!1' store i64 %div, i64 addrspace(1)* %out, align 8, !tbaa !1 ^ However, compiling the piglit test with $ clang -x cl -target r600-- -mcpu=cayman -Dcl_clang_storage_class_specifiers=1 -Xclang -mlink-bitcode-file -Xclang /usr/local/lib64/clc/cayman-r600--.bc -I/usr/local/include/clc/ -include /usr/local/include/clc/clc.h kernel.cl produces no crashes. If anyone can confirm this is still an issue, please reopen. 64 bit integer division was implemented back in 2014 (r207508, r207589, fixed in r222073). should be in llvm as old 3.6 |
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.