cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

bijaer
Journeyman III

Reread Pinned-Host-Memory and host freeze

Pinned Host Memory freeze

Hello community,

i've got a few questions about IL Kernels and pinned-host-memory access. i'm working for an kernel that is reading from an input buffer in a loop. In fact, the device should read the same buffer entry again and again while the host is altering that value. There is no synchronization needed, i only have to proof that the data is really "refreshed" at the device side.

Is this possible?

The Problem with our kernel is that the host totally freezes until the kernel is finished. Is it common that the host freezes during the runtime of the stream kernels?

I´m very glad if you can help me in any way ...


The kernel code is currently like this:
    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++   
    // globals:
    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    "il_ps_2_0\n"                                // IL Version
    "dcl_input_position_interp(linear_noperspective) v0.xy__\n"                                  "dcl_resource_id(0)_type(2d,unnorm)_fmtx(unknown)_fmty(unknown)_fmtz(unknown)_fmtw(unknown)\n"
    "sample_resource(0)_sampler(0) r12, v0.xyxx\n"
    "dcl_output_generic o0\n"                             
    "dcl_literal l0, 0x0fffffff, 0x0000ffff, 0x00000000, 0x00000000\n" // l0.x maxLoops | l0.y idle-"time"
    "dcl_literal l1, 0x00000001, 0x00000001, 0x00000001, 0x00000001\n"
            
    "mov r16.x, l0.y\n"
    "mov o1, l0\n"
   
    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++   
    // main loop:
    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    "whileloop\n"                               
        "ge r18.x___, r16.x, l0.x\n"               
        "break_logicalnz r18.x\n"                   
        "iadd r12.x___, r12.x, l1.x\n"   
        "call 4\n"                                        // idle
        "iadd r16.x___, r16.x, l1.x\n"                
    "endloop\n"
   
    "mov o0, r12\n"                                // write to output
   
    "ret_dyn\n"   
    "endmain\n"                                      
  
     //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++   
    // func 4: idle
    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    "func 4\n"
        "whileloop\n"                                   
            "ge r19.x___, r17.x, l0.y\n"               
            "break_logicalnz r19.x\n"                  
            "iadd r17.x___, r17.x, l1.x\n"               
        "endloop\n"                                 
    "endfunc\n"

0 Likes
2 Replies
adm271828
Journeyman III

Hi,

I'm glad to hear this question I was about to ask myself.

I observed that host freezes as soon as a compute kernel takes a long time to execute and fully loads the GPU (Linux - Ubuntu). Apparently host is still alive and it seems only the display is frozen. My guess was that, since the GPU was heavily loaded it had no opportunity to update the display (including pointer movements). When kernel ends execution, host comes back to life. The problem is when you make a mistake and enter an infinite loop... I had no way to kill the process, except a hard reboot.

I did not really investigate. For instance what arises if a kernel uses only half of the GPU computing resources?

This raises more questions:

- perhaps it would be a good idea for the CAL or OpenCL API to provide a kind of optional watchdog that would stop kernel execution when it take to much time. Watchdog could be armed before kernel starts, with a user provided time limit.

- my motherboard has an integrated graphic chip which is good enough to handle the graphic I need. I wish I could use it for my display and use the GPU only for computation. Unfortunately I don't know if it is possible, and how to do this. But I would be happy to hear any hints.

 

Best regards,

  Antoine.

 

0 Likes

Hi, 

i think i solved the problem. A "stupid" mistake in CAL (busy waiting after starting the kernel).

My onboard GPU can not run in parallel with the external PCIe GPU. 

Now i have so solve the input refresh problem ...

Best regards

 

0 Likes