Bug 64225 - [clover/turks] bfgminer --scrypt generates Segmentation Fault
Summary: [clover/turks] bfgminer --scrypt generates Segmentation Fault
Status: RESOLVED MOVED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/r600 (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Default DRI bug account
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 99553
  Show dependency treegraph
 
Reported: 2013-05-04 23:58 UTC by Erdem U. Altınyurt
Modified: 2019-09-18 19:02 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
./bfgminer -v1 --benchmark --scrypt &> (362.77 KB, text/plain)
2013-05-04 23:58 UTC, Erdem U. Altınyurt
Details
Debug with libclc patch (293.75 KB, text/plain)
2013-05-24 10:32 UTC, Erdem U. Altınyurt
Details
Possible Fix (6.60 KB, patch)
2013-09-28 00:24 UTC, Tom Stellard
Details | Splinter Review
Possible Fix #2 (2.20 KB, patch)
2013-11-14 02:56 UTC, Tom Stellard
Details | Splinter Review

Description Erdem U. Altınyurt 2013-05-04 23:58:24 UTC
Created attachment 78869 [details]
./bfgminer -v1 --benchmark --scrypt &>

OpenSUSE LLVM-trunk (patched version using: https://bugs.freedesktop.org/attachment.cgi?id=78831) with Mesa trunk 3.9 kernel x86_64


"./bfgminer -v1 --benchmark --scrypt"
Generated segmentation fault.
Log attached.
Thanks
Comment 1 Tom Stellard 2013-05-24 00:36:14 UTC
Can you apply this patch: http://lists.freedesktop.org/archives/mesa-dev/2013-May/039728.html to libclc and re-post the output from bfgminer.
Comment 2 Erdem U. Altınyurt 2013-05-24 10:21:18 UTC
Himm...
Here is a problem.
I updated LLVM-trunk and installed.
Than run this commands:

git clone http://llvm.org/git/libclc.git
cd libclc
./configure.py
make

but  got this error:

LLVM-CC nvptx--nvidiacl/lib/workitem/get_global_size.cl.bc
LLVM-LINK nvptx--nvidiacl/lib/builtins.link.bc
OPT nvptx--nvidiacl/lib/builtins.opt.bc
CXX utils/prepare-builtins.o
./utils/prepare-builtins.cpp:3:27: fatal error: llvm/Function.h: No such file or directory
compilation terminated.

I think llvm changed llvm/Function.h files location to llvm/IR/Function.h...
Comment 3 Erdem U. Altınyurt 2013-05-24 10:32:28 UTC
Created attachment 79753 [details]
Debug with libclc patch

Now tried with using http://cgit.freedesktop.org/~tstellar/libclc.

patched successfully and I got:

LLVM ERROR: Not supported instr: <MCInst 213 <MCOperand Reg:1046> <MCOperand Reg:1030> <MCOperand Imm:3> <MCOperand Imm:0>>

Attaching full debug log.
Comment 4 Alexey Shvetsov 2013-08-29 16:58:01 UTC
It still dont work with recent mesa and llvm git

 [2013-08-29 20:56:21] setrlimit: Increased soft fd limit from 1024 to hard limit of 4096                    
 [2013-08-29 20:56:21] Started bfgminer 3.1.4                    
 [2013-08-29 20:56:21] DISPLAY not set, setting :0 just in case                    
 [2013-08-29 20:56:21] CL Platform 0 vendor: Mesa                    
 [2013-08-29 20:56:21] CL Platform 0 name: Default                    
 [2013-08-29 20:56:21] CL Platform 0 version: OpenCL 1.1 MESA 9.3.0-devel                    
 [2013-08-29 20:56:21] Platform 0 devices: 2                    
 [2013-08-29 20:56:21]  0       AMD TURKS                    
 [2013-08-29 20:56:21]  1       AMD TURKS                    
 [2013-08-29 20:56:21] OCL 0 : Set temperature config: target=89 cutoff=95                    
 [2013-08-29 20:56:21] OCL 1 : Set temperature config: target=89 cutoff=95                    
 [2013-08-29 20:56:21] Probing for an alive pool                    
 [2013-08-29 20:56:21] Testing pool stratum+tcp://pool1.us.multipool.us:7777                    
 [2013-08-29 20:56:21] Popping work to stage thread                    
 [2013-08-29 20:56:21] HTTP request failed: Protocol stratum+tcp not supported or disabled in libcurl                    
 [2013-08-29 20:56:21] Failed to connect in json_rpc_call                    
 [2013-08-29 20:56:21] initiate_stratum with sockbuf=(nil)                    
 [2013-08-29 20:56:22] Failed to get sessionid in initiate_stratum                    
 [2013-08-29 20:56:22] Pool 0 stratum bdifficulty set to 64.000000                    
 [2013-08-29 20:56:22] Received stratum notify from pool 0 with job_id=4e0f                    
 [2013-08-29 20:56:22] Stratum authorisation success for pool 0                    
 [2013-08-29 20:56:22] Pool 0 stratum+tcp://pool1.us.multipool.us:7777 alive                    
 [2013-08-29 20:56:22] Unknown stratum msg: {"error": [-3, "Method 'get_transactions' not found for service 'mining'", null], "id": "txlist4e0f", "result": null}                    
 [2013-08-29 20:56:22] Generated stratum header 0000000425d2a29aee3cbacad8a94ec98838e2c112a991a55047ea9514de3bd500000000e389da9ba502304db2025736ebf8d700e1f30aa1d04985669f44de3bdc612bb6521f7d141c2d346300000000                    
 [2013-08-29 20:56:22] Work job_id 4e0f nonce2 00000000                    
 [2013-08-29 20:56:22] Generated target 000003fffc000000000000000000000000000000000000000000000000000000                    
 [2013-08-29 20:56:22] Network difficulty changed to 5 (40.54Mh/s)                    
 [2013-08-29 20:56:22] New block: ...ee3cbaca25d2a29a diff 5 (40.54Mh/s)                    
 [2013-08-29 20:56:22] Stratum from pool 0 detected new block                    
 [2013-08-29 20:56:22] Pool 0 is hiding block contents from us                    
 [2013-08-29 20:56:22] Init GPU thread 0 GPU 0 virtual GPU 0                    
 [2013-08-29 20:56:22] CL Platform vendor: Mesa                    
 [2013-08-29 20:56:22] CL Platform name: Default                    
 [2013-08-29 20:56:22] CL Platform version: OpenCL 1.1 MESA 9.3.0-devel                    
 [2013-08-29 20:56:22] List of devices:                    
 [2013-08-29 20:56:22]  0       AMD TURKS                    
 [2013-08-29 20:56:22]  1       AMD TURKS                    
 [2013-08-29 20:56:22] Selected 0: AMD TURKS                    
 [2013-08-29 20:56:22] Preferred vector width reported 4                    
 [2013-08-29 20:56:22] Max work group size reported 256                    
 [2013-08-29 20:56:22] Max mem alloc size is 50331648                    
 [2013-08-29 20:56:22] Mesa OpenCL platform detected, disabling OpenCL kernel binaries and bitalign                    
 [2013-08-29 20:56:22] Selecting scrypt kernel                    
 [2013-08-29 20:56:22] GPU 0: selecting lookup gap of 2                    
 [2013-08-29 20:56:22] GPU 0: selecting thread concurrency of 320                    
 [2013-08-29 20:56:22] OCL 0: Configured OpenCL kernel name: scrypt130511AMDTURKSglg2tc320w256l8pOpenCL1_1MESA9_3_0devel                    
 [2013-08-29 20:56:22] Setting worksize to 256                    
 [2013-08-29 20:56:22] cl_amd_media_ops not found, will not set BITALIGN                    
 [2013-08-29 20:56:22] BFI_INT patch requiring device not found, will not BFI_INT patch                    
 [2013-08-29 20:56:22] CompilerOptions: -D LOOKUP_GAP=2 -D CONCURRENT_THREADS=320 -D WORKSIZE=256 -D GOFFSET                    
 [2013-08-29 20:56:23] Initialising kernel scrypt130511.cl without bitalign, 1 vectors and worksize 256                    
 [2013-08-29 20:56:23] Creating scrypt buffer sized 20971520                    
 [2013-08-29 20:56:23] initCl() finished. Found AMD TURKS                    
 [2013-08-29 20:56:23] Waking up thread 0                    
 [2013-08-29 20:56:23] Init GPU thread 1 GPU 1 virtual GPU 1                    
 [2013-08-29 20:56:23] CL Platform vendor: Mesa                    
 [2013-08-29 20:56:23] CL Platform name: Default                    
 [2013-08-29 20:56:23] CL Platform version: OpenCL 1.1 MESA 9.3.0-devel                    
 [2013-08-29 20:56:23] List of devices:                    
 [2013-08-29 20:56:23]  0       AMD TURKS                    
 [2013-08-29 20:56:23]  1       AMD TURKS                    
 [2013-08-29 20:56:23] Selected 1: AMD TURKS                    
 [2013-08-29 20:56:23] Popping ping in miner thread                    
 [2013-08-29 20:56:23] OCL 0: Popping work from get queue to get work                    
 [2013-08-29 20:56:23] Preferred vector width reported 4                    
 [2013-08-29 20:56:23] Max work group size reported 256                    
 [2013-08-29 20:56:23] Max mem alloc size is 50331648                    
 [2013-08-29 20:56:23] Mesa OpenCL platform detected, disabling OpenCL kernel binaries and bitalign                    
 [2013-08-29 20:56:23] Selecting scrypt kernel                    
 [2013-08-29 20:56:23] GPU 1: selecting lookup gap of 2                    
 [2013-08-29 20:56:23] GPU 1: selecting thread concurrency of 320                    
 [2013-08-29 20:56:23] OCL 1: Configured OpenCL kernel name: scrypt130511AMDTURKSglg2tc320w256l8pOpenCL1_1MESA9_3_0devel                    
 [2013-08-29 20:56:23] Setting worksize to 256                    
 [2013-08-29 20:56:23] cl_amd_media_ops not found, will not set BITALIGN                    
 [2013-08-29 20:56:23] BFI_INT patch requiring device not found, will not BFI_INT patch                    
 [2013-08-29 20:56:23] CompilerOptions: -D LOOKUP_GAP=2 -D CONCURRENT_THREADS=320 -D WORKSIZE=256 -D GOFFSET                    
 [2013-08-29 20:56:25] Initialising kernel scrypt130511.cl without bitalign, 1 vectors and worksize 256                    
 [2013-08-29 20:56:25] Creating scrypt buffer sized 20971520                    
 [2013-08-29 20:56:25] initCl() finished. Found AMD TURKS                    
 [2013-08-29 20:56:25] Waking up thread 1                    
 [2013-08-29 20:56:25] 2 gpu miner threads started                    
 [2013-08-29 20:56:25] Creating extra submit work thread                    
 [2013-08-29 20:56:25] Popping ping in miner thread                    
 [2013-08-29 20:56:25] OCL 1: Popping work from get queue to get work                    
 [2013-08-29 20:56:25] API not running - API will not be available                    
 [2013-08-29 20:56:25] Generated stratum header 0000000425d2a29aee3cbacad8a94ec98838e2c112a991a55047ea9514de3bd5000000006c5e7f0b83c40ac268481321cd66902b5539da7ef2e2a4b1477af7667f0a1e0f521f7d161c2d346300000000                    
 [2013-08-29 20:56:25] Work job_id 4e0f nonce2 01000000                    
 [2013-08-29 20:56:25] Generated target 000003fffc000000000000000000000000000000000000000000000000000000                    
 [2013-08-29 20:56:25] Generated stratum work                    
 [2013-08-29 20:56:25] Pushing work from pool 0 to hash queue                    
 [2013-08-29 20:56:25] OCL 1: Got work from get queue to get work for thread 1                    
 [2013-08-29 20:56:25] Generated stratum header 0000000425d2a29aee3cbacad8a94ec98838e2c112a991a55047ea9514de3bd500000000df55dd8a87fcf4a791fe03fb2f19a1d1464dbf88413ce7f95e9fb05bf6ffa282521f7d161c2d346300000000                    
 [2013-08-29 20:56:25] Work job_id 4e0f nonce2 02000000                    
 [2013-08-29 20:56:25] Generated target 000003fffc000000000000000000000000000000000000000000000000000000                    
 [2013-08-29 20:56:25] Generated stratum work                    
 [2013-08-29 20:56:25] Pushing work from pool 0 to hash queue                    
 [2013-08-29 20:56:25] OCL 0: Got work from get queue to get work for thread 0                    
 [2013-08-29 20:56:25] Generated stratum header 0000000425d2a29aee3cbacad8a94ec98838e2c112a991a55047ea9514de3bd50000000004ddb06683b94187f143c27cdf13175967356b28b33cf78b0aded8ebf74af945521f7d161c2d346300000000                    
 [2013-08-29 20:56:25] Work job_id 4e0f nonce2 03000000                    
 [2013-08-29 20:56:25] Generated target 000003fffc000000000000000000000000000000000000000000000000000000                    
 [2013-08-29 20:56:25] Generated stratum work                    
 [2013-08-29 20:56:25] Pushing work from pool 0 to hash queue                    
 [2013-08-29 20:56:25] Generated stratum header 0000000425d2a29aee3cbacad8a94ec98838e2c112a991a55047ea9514de3bd500000000c7e7ca6233d52650ad4fe9aaa033f8d90ecd855d8ffa908d7aa32d76a183654b521f7d161c2d346300000000                    
 [2013-08-29 20:56:25] Work job_id 4e0f nonce2 04000000                    
 [2013-08-29 20:56:25] Generated target 000003fffc000000000000000000000000000000000000000000000000000000                    
 [2013-08-29 20:56:25] Generated stratum work                    
 [2013-08-29 20:56:25] Pushing work from pool 0 to hash queue                    
LLVM ERROR: Not supported instr: <MCInst 286 <MCOperand Reg:1103> <MCOperand Reg:975> <MCOperand Imm:1> <MCOperand Imm:0>>
LLVM ERROR: Not supported instr: <MCInst 286 <MCOperand Reg:1103> <MCOperand Reg:975> <MCOperand Imm:1> <MCOperand Imm:0>>
Segmentation fault
Comment 5 Erdem U. Altınyurt 2013-09-10 20:28:05 UTC
Since "bfgminer --benchmark --scrypt " command produces the error message of: "Cannot use benchmark mode with scrypt"

I cannot report if scrypt is start to work or not.
Comment 6 Tom Stellard 2013-09-28 00:24:34 UTC
Created attachment 86763 [details] [review]
Possible Fix

Can you try this patch?
Comment 7 Alexey Shvetsov 2013-10-10 11:38:17 UTC
IT still failes with 

0x7fe5003bfc10: i32 = GlobalAddress<void (<4 x i32>*, <4 x i32>*, <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32>)* @SHA256> 0 [ORD=6879]
Stack dump:
0.      Running pass 'Function Pass Manager' on module 'radeon'.
1.      Running pass 'AMDGPU DAG->DAG Pattern Instruction Selection' on function '@search'
Comment 8 Tom Stellard 2013-11-13 00:18:09 UTC
(In reply to comment #7)
> IT still failes with 
> 
> 0x7fe5003bfc10: i32 = GlobalAddress<void (<4 x i32>*, <4 x i32>*, <4 x i32>,
> <4 x i32>, <4 x i32>, <4 x i32>)* @SHA256> 0 [ORD=6879]
> Stack dump:
> 0.      Running pass 'Function Pass Manager' on module 'radeon'.
> 1.      Running pass 'AMDGPU DAG->DAG Pattern Instruction Selection' on
> function '@search'

I think this may be working now if you try the git versions of Mesa and LLVM, can you test?
Comment 9 Alexey Shvetsov 2013-11-13 13:01:29 UTC
Still failes 

0x7f57a0454d20: i32 = GlobalAddress<void (<4 x i32>*)* @salsa> 0 [ORD=9236]
Comment 10 Tom Stellard 2013-11-14 02:56:02 UTC
Created attachment 89172 [details] [review]
Possible Fix #2

Does this patch help?
Comment 11 Vedran Miletić 2017-03-22 15:40:00 UTC
Does this still happen?
Comment 12 Jan Vesely 2018-05-30 06:34:00 UTC
(In reply to Vedran Miletić from comment #11)
> Does this still happen?

It no longer segfaults, but still fails to build.


 [2018-05-30 02:32:30] Initialising kernel scrypt.cl without bitalign, 2 vectors
 and worksize 256
 [2018-05-30 02:32:30] Error -46: Creating Kernel from program. (clCreateKernel)

 [2018-05-30 02:32:30] OCL 0: Failed to load kernel
Comment 13 GitLab Migration User 2019-09-18 19:02:52 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/436.


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.