Located a segfault in erlang:port_control

William King quentusrex@REDACTED
Thu Dec 2 06:01:48 CET 2010


While testing the erlang bindings for OpenCL I ran into the segfault. I 
decided to follow this trail rather than changing anything.

Any ideas?

I've tried:
ERL_CRASH_DUMP=crash.dump erl

But that does not result in a crash dump.

Here is the line of code that I've tracked it to:
call(Code, Args) ->
     io:format("Still alive2.5 Port: ~p Code: ~p Args ~p  \n", 
[?CL_PORT, Code, Args]),
     Reply = erlang:port_control(?CL_PORT, Code, Args),
     io:format("Still alive3 \n"),
     case decode(Reply) of
         {event,Ref} ->
             wait_reply(Ref);
         Result ->
             Result
     end.




Here is the output before the segfault:

quentusrex@REDACTED:~/git/quentustech/erlang/cl/examples$ 
ERL_CRASH_DUMP=dump.dump erl
Erlang R14B (erts-5.8.1) [source] [64-bit] [smp:6:6] [rq:6] 
[async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.8.1  (abort with ^G)
1> cl_mul:test().
cl_drv: WARNING: missing +A option (async driver calls!)
Still alive2.5 Port: ecl_port Code: 2 Args <<>>
Still alive3
Still alive2.5 Port: ecl_port Code: 3 Args 
<<224,254,113,1,0,0,0,0,255,255,255,
                                              255>>
Still alive3
Still alive2.5 Port: ecl_port Code: 6 Args 
<<2,0,0,0,0,0,0,0,160,255,113,1,0,0,
                                              0,0,16,0,114,1,0,0,0,0>>
Still alive3
platform created
build: /home/quentusrex/erlang/cl/examples/mul4x4.cl
File opened
Still alive2.5 Port: ecl_port Code: 38 Args [<<160,153,113,1,0,0,0,0>>,
                                              <<"//\n// Multiply count 
4x4 matrices with a constant matrix\n//\n\n__kernel void mul4x4(__global 
float* input,\n\t\t     __global float* output,\n\t\t     const float16 
a,\n\t\t     const unsigned int count)\n{\n    int ix;\n    __global 
float* b;\n    __global float* c;\n    \n    ix = get_global_id(0);\n 
  if (ix < count) {\n        int i,j,k;\n\n\tb = input  + ix*16;\n\tc = 
output + ix*16;\n\n\tfor (i=0; i<4; i++) {\n\t    for (j=0; j<4; j++) 
{\n\t        float s1 = 0.0;\n\t\tfor (k=0; k<4; k++) {\n\t\t    float 
t1 = a.s(4*i+k);\n\t\t    float t2 = b[4*k+j];\n\t\t    s1 += 
(t1*t2);\n\t\t}\n    \t\tc[4*i+j] = s1;\n\t    }\n\t}\n\t\n 
}\n}\n\n\n\t \n">>]
Still alive3
Created program from source
Still alive2.5 Port: ecl_port Code: 44 Args 
<<112,119,136,1,0,0,0,0,3,0,0,0>>
Still alive3
Still alive2.5 Port: ecl_port Code: 51 Args <<112,119,136,1,0,0,0,0,160,255,
                                               113,1,0,0,0,0,2,0,0,0>>
Still alive3
Still alive2.5 Port: ecl_port Code: 51 Args 
<<112,119,136,1,0,0,0,0,16,0,114,1,
                                               0,0,0,0,2,0,0,0>>
Still alive3
Logs:
Still alive
Still alive2
Still alive2.5 Port: ecl_port Code: 42 Args 
<<112,119,136,1,0,0,0,0,2,0,0,0,0,
 
0,0,0,160,255,113,1,0,0,0,0,16,0,
                                               114,1,0,0,0,0>>
Segmentation fault


More information about the erlang-bugs mailing list