UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer dasidler
Observer
4,189 Views
Registered: ‎04-23-2014

DEPENDENCE pragma giving error in latest vivado

Jump to solution

I am in the process of porting the following (simplified) code from 2015.1 to 2017.2

 

#include <hls_stream.h>
#include "ap_int.h"
using namespace hls;
const static int MAX_NUM = 4096;

void simple_table(stream<ap_uint<12> >&	input, stream<ap_uint<12> >& output)
{
#pragma HLS PIPELINE II=1

	static ap_uint<8> time_table[MAX_NUM];
	#pragma HLS RESOURCE variable=time_table core=RAM_T2P_BRAM
	#pragma HLS DEPENDENCE variable=time_table inter false

	static ap_uint<16>	m_pointer = 0;
	static ap_uint<1> state_switch = 0;
	ap_uint<12> data;

	switch (state_switch)
	{
	case 0:
		if (!input.empty())
		{
			input.read(data);
			time_table[data] = 255;
		}
		break;
	case 1:
		if (time_table[m_pointer] > 0)
		{
			if (time_table[m_pointer] == 1)
			{
				output.write(m_pointer);
			}
			// Decrease value
			time_table[m_pointer] -= 1;
		}
		m_pointer++;
		if (m_pointer == MAX_NUM)
		{
			m_pointer = 0;
		}
		break;
	} //switch
	state_switch++;
}

While in Vivado 2015.1 the DEPENDENCE pragma made sure that this module achieved an II=1, in the current version the pragma leads to the following error.

 

ERROR: [SCHED 204-80] Due to pragma (simple_table.cpp:12:1), dependence (loop distance = 0) is violated in pipeline region 'simple_table'.
ERROR: [SCHED 204-80]     From : Operation (ID:11) (SV:0) => store i8 -1, i8* %time_table_V_addr_1, align 1
ERROR: [SCHED 204-80]     To   : Operation (ID:15) (SV:0) => %time_table_V_load = load i8* %time_table_V_addr, align 1

It seems that the pragma is in fact still checking if there is a conflict on the load and stores to the BRAM instead of completely ignoring it.
I tried a lot of adaptations to work around this, but none of them was successful.

Given the large version jump i am wondering if this pragma can be still used in this way (without a loop) and how i can resolve this issue.

 

Thanks.

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
Visitor oderousmonk
Visitor
4,780 Views
Registered: ‎05-10-2017

Re: DEPENDENCE pragma giving error in latest vivado

Jump to solution

Hello,

 

I was seeing this same problem with 2017.1. It looks like the DEPENDENCE pragma was broken for a couple of versions. Designs that relied on DEPENDENCE to achieve an II of 1 in 2016.x no longer worked in 2017.1. It seems that this has been fixed. I have updated to 2017.2 SDx and I see the correct behavior. If I understand correctly, the SDx version of the tool includes a version of HLS that is one step ahead compared to the stand alone Vivado HLS with the same version number. This was true for SDx 2017.1, vs. VHLS 2017.1, as well as 2017,2 !?!. So you should see the fix for this issue in 2017.2 SDx, or I would assume in VHLS 2017.3.

 

Regards,

eschei

View solution in original post

0 Kudos
8 Replies
Voyager
Voyager
4,158 Views
Registered: ‎06-24-2013

Re: DEPENDENCE pragma giving error in latest vivado

Jump to solution

Hey @dasidler,

 

As far as I understand your code, you have the following dependencies:

 

input.read(data);
time_table[data] = 255;

Here time_table[data] depends on data being read from the input stream.

 

    if (time_table[m_pointer] > 0)
if (time_table[m_pointer] == 1)

This one should be automatically resolved, but in case Vivado does not figure it out, you could use a temp variable.

 

    if (time_table[m_pointer] > 0)
time_table[m_pointer] -= 1;

Here the time_table is read first an then written at the same location.

 

I presume you do not really want to tell Vivado that the dependencies on time_table are just wrong (because the last dependency definitely looks very real to me), but instead you want it to pipeline the access, yes?

 

Please clarify,

Herbert

-------------- Yes, I do this for fun!
0 Kudos
Observer dasidler
Observer
4,147 Views
Registered: ‎04-23-2014

Re: DEPENDENCE pragma giving error in latest vivado

Jump to solution

Hi @hpoetzl thanks for your reply.

 

I have a few modules of these type and they are all part of a DATAFLOW module. Since the top module has to have an II=1, all the submodules need to have that too. So the main goal is to achieve an II=1.

 

I am totally aware of the read/write dependencies on the BRAM, in the previous version (2015.1) i was always able to tweak the code with the DEPENDENCE pragma and specifying dual port BRAMs such that i achieved an II=1. I then verify in RTL-cosimulation that no read/write conflicts on the BRAM occur.

 

I actually tried a temp variable for this:

    if (time_table[m_pointer] > 0)
	if (time_table[m_pointer] == 1)

with no success.

 

I also tried to place the BRAM outside of the module and pass a reference to this function which didn't work either.

 

The thing is in Vivado 2015.1 the tool would completely ignore any potential conflicts and i had to check them in the co-simulation myself. Now in 2017.2, it actually reports an II=1 but then fails with this error which states that the dependency is violated.

 

WARNING: [ANALYSIS 214-52] Found false inter dependency for variable 'time_table.V'.
INFO: [HLS 200-111] Finished Architecture Synthesis Time (s): cpu = 00:00:30 ; elapsed = 00:00:15 . Memory (MB): peak = 481.859 ; gain = 140.855 ; free physical = 18376 ; free virtual = 87010
INFO: [HLS 200-10] Starting hardware synthesis ...
INFO: [HLS 200-10] Synthesizing 'simple_table' ...
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [HLS 200-10] -- Implementing module 'simple_table' 
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [SCHED 204-11] Starting scheduling ...
INFO: [SCHED 204-61] Pipelining function 'simple_table'.
INFO: [SCHED 204-61] Pipelining result: Target II: 1, Final II: 1, Depth: 3.
ERROR: [SCHED 204-80] Due to pragma (simple_table.cpp:12:1), dependence (loop distance = 0) is violated in pipeline region 'simple_table'.
ERROR: [SCHED 204-80]     From : Operation (ID:11) (SV:0) => store i8 -1, i8* %time_table_V_addr_1, align 1
ERROR: [SCHED 204-80]     To   : Operation (ID:15) (SV:0) => %time_table_V_load = load i8* %time_table_V_addr, align 1

Above is also a warning regarding the dependency pragma.

 

 

0 Kudos
Observer dasidler
Observer
4,059 Views
Registered: ‎04-23-2014

Re: DEPENDENCE pragma giving error in latest vivado

Jump to solution

Given the sparse documentation of this quite complex pragma, i am wondering if this is either a bug of Vivado or if the usage actually changed since 2015.1

It would be really helpful if somebody could point me to more a complete documentation of the DEPENDENCE pragma.


Thanks

0 Kudos
Voyager
Voyager
4,054 Views
Registered: ‎06-24-2013

Re: DEPENDENCE pragma giving error in latest vivado

Jump to solution

Hey @dasidler,

 

It would be really helpful if somebody could point me to more a complete documentation of the DEPENDENCE pragma.

UG902 has a detailed description starting on page 453 under set_directive_dependence (which is equivalent to the DEPENDENCE pragma).

 

Hope this helps,

Herbert

-------------- Yes, I do this for fun!
0 Kudos
Observer fletzerm
Observer
3,859 Views
Registered: ‎01-09-2014

Re: DEPENDENCE pragma giving error in latest vivado

Jump to solution

Which device is used for synthesis?

I had the same error message, when I tried to synthesis for xczu3eg. But the synthesis runs without problems, when I choose xc7z020 as target device.

 

 

0 Kudos
Visitor oderousmonk
Visitor
4,781 Views
Registered: ‎05-10-2017

Re: DEPENDENCE pragma giving error in latest vivado

Jump to solution

Hello,

 

I was seeing this same problem with 2017.1. It looks like the DEPENDENCE pragma was broken for a couple of versions. Designs that relied on DEPENDENCE to achieve an II of 1 in 2016.x no longer worked in 2017.1. It seems that this has been fixed. I have updated to 2017.2 SDx and I see the correct behavior. If I understand correctly, the SDx version of the tool includes a version of HLS that is one step ahead compared to the stand alone Vivado HLS with the same version number. This was true for SDx 2017.1, vs. VHLS 2017.1, as well as 2017,2 !?!. So you should see the fix for this issue in 2017.2 SDx, or I would assume in VHLS 2017.3.

 

Regards,

eschei

View solution in original post

0 Kudos
Highlighted
Observer dasidler
Observer
2,608 Views
Registered: ‎04-23-2014

Re: DEPENDENCE pragma giving error in latest vivado

Jump to solution
Yes, this seems to be resolved in the latest vivado hls version, thanks.
0 Kudos
Visitor philduff
Visitor
941 Views
Registered: ‎05-18-2009

Re: DEPENDENCE pragma giving error in latest vivado

Jump to solution
Is it broken again in 2018.3?
0 Kudos