You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tvm.apache.org by ffffc via TVM Discuss <no...@discuss.tvm.ai> on 2020/05/20 08:24:32 UTC

[TVM Discuss] [Development/RFC] [RFC][VTA]A HLS C VTA bug


VTA can't get correct in Zynq Ultra Scale based device. We once thought this was a coherency problem, but recently I found there may be a bug in HLS C VTA hardware with my partner
@hht.

Only FINISH instruction can set VTA_COMPUTE_DONE register in compute module. And only GEMM/ALU instruction will reset VTA_COMPUTE_DONE register, while LOAD/STORE can't. 

The last instruction in instruction queue is FINISH. The processor queries VTA_COMPUTE_DONE register to confirm that the VTA compute is complete. But VTA_COMPUTE_DONE remains set until VTA runs again and excutes a GEMM/ALU instruction. If processor queries the register before VTA excutes a GEMM/ALU instruction, it will misunderstand that the VTA compute is completed. 

I modified the source code of compute module IP to make VTA_COMPUTE_DONE register clear on read.
```plain
reg [1:0] rise_done_buf;

always @(posedge ACLK) begin 
    if(ARESET)
        rise_done_buf <= 2'b0;
    else if (ACLK_EN) begin 
        rise_done_buf[0] <= done_o[0];
        rise_done_buf[1] <= rise_done_buf[0];
    end
end
wire rise_done = rise_done_buf[0] & (~rise_done_buf[1]);

reg [31:0] int_done_tmp;
always @(posedge ACLK) begin
    if (ARESET)
        int_done_tmp <= 32'b0;
    else if (ACLK_EN) begin
        if (rise_done)
            int_done_tmp <= 32'b1;
        else if (ar_hs && raddr == ADDR_DONE_O_DATA_0)
            int_done_tmp <= 32'b0; // clear on read
    end
end
```

After modifying, I get correct results on ZCU104 platform.

@thierry @liangfu





---
[Visit Topic](https://discuss.tvm.ai/t/rfc-vta-a-hls-c-vta-bug/6743/1) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.ai/email/unsubscribe/881f38c844b12700fb79647f1cdf8c502726f85f9a86fe5994875c317812f652).

[TVM Discuss] [Development/RFC] [RFC][VTA]A HLS C VTA bug

Posted by Hanting Huang via TVM Discuss <no...@discuss.tvm.ai>.

What about modifying finsh instruction to write a bool into a piece of shared memory? By this way, cpu can clear it after reading.
@liangfu

Clear On Read in register is the definately efficient way. But if hls programming cannot easily achieve this aim. Clear On Read in shared memory might be a workaround.





---
[Visit Topic](https://discuss.tvm.ai/t/rfc-vta-a-hls-c-vta-bug/6743/3) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.ai/email/unsubscribe/c474dfabba9c4769bbd131b3c8ce9d5f17ffd2c8ddf9c83632869846f609a34e).

[TVM Discuss] [Development/RFC] [RFC][VTA]A HLS C VTA bug

Posted by Liangfu Chen via TVM Discuss <no...@discuss.tvm.ai>.

Thanks for locating the bug @ffffc! Is there any way to modify this in HLS instead of modifying the generated Verilog, so that more people could avoid the pitfall?





---
[Visit Topic](https://discuss.tvm.ai/t/rfc-vta-a-hls-c-vta-bug/6743/2) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.ai/email/unsubscribe/03c9185754ee515f567eb4b766820324f14774b3b3231f4865da71603ea71da6).