Commit f17d3edb authored by Leonardo Solis's avatar Leonardo Solis
Browse files

added fences in btw deeper block chan IC and GG + clean gmem in IC

parent aec9fbd7
Loading
Loading
Loading
Loading
+69 −1
Original line number Diff line number Diff line
@@ -44,8 +44,11 @@ channel char2 chan_Conf2Intrae_actmode;
channel char  	chan_Conf2Intrae_actmode;

// Send energy values from InterE & IntraE to genotype-senders (IC, GG, LSs)
#if 0
channel float 	chan_Intere2StoreIC_intere     __attribute__((depth(2)));
channel float 	chan_Intere2StoreGG_intere     __attribute__((depth(2)));
#endif
#if 1
channel float 	chan_Intere2StoreLS_LS1_intere __attribute__((depth(2)));
channel float 	chan_Intere2StoreLS_LS2_intere __attribute__((depth(2)));
channel float 	chan_Intere2StoreLS_LS3_intere __attribute__((depth(2)));
@@ -55,8 +58,28 @@ channel float chan_Intere2StoreLS_LS6_intere __attribute__((depth(2)));
channel float 	chan_Intere2StoreLS_LS7_intere __attribute__((depth(2)));
channel float 	chan_Intere2StoreLS_LS8_intere __attribute__((depth(2)));
channel float 	chan_Intere2StoreLS_LS9_intere __attribute__((depth(2)));
#endif
#if 1
channel float 	chan_Intere2StoreIC_intere     __attribute__((depth(MAX_POPSIZE)));
channel float 	chan_Intere2StoreGG_intere     __attribute__((depth(MAX_POPSIZE)));
#endif
#if 0
channel float 	chan_Intere2StoreLS_LS1_intere __attribute__((depth(MAX_POPSIZE)));
channel float 	chan_Intere2StoreLS_LS2_intere __attribute__((depth(MAX_POPSIZE)));
channel float 	chan_Intere2StoreLS_LS3_intere __attribute__((depth(MAX_POPSIZE)));
channel float 	chan_Intere2StoreLS_LS4_intere __attribute__((depth(MAX_POPSIZE)));
channel float 	chan_Intere2StoreLS_LS5_intere __attribute__((depth(MAX_POPSIZE)));
channel float 	chan_Intere2StoreLS_LS6_intere __attribute__((depth(MAX_POPSIZE)));
channel float 	chan_Intere2StoreLS_LS7_intere __attribute__((depth(MAX_POPSIZE)));
channel float 	chan_Intere2StoreLS_LS8_intere __attribute__((depth(MAX_POPSIZE)));
channel float 	chan_Intere2StoreLS_LS9_intere __attribute__((depth(MAX_POPSIZE)));
#endif

#if 0
channel float 	chan_Intrae2StoreIC_intrae     __attribute__((depth(2)));
channel float 	chan_Intrae2StoreGG_intrae     __attribute__((depth(2)));
#endif
#if 1
channel float 	chan_Intrae2StoreLS_LS1_intrae __attribute__((depth(2)));
channel float 	chan_Intrae2StoreLS_LS2_intrae __attribute__((depth(2)));
channel float 	chan_Intrae2StoreLS_LS3_intrae __attribute__((depth(2)));
@@ -66,6 +89,23 @@ channel float chan_Intrae2StoreLS_LS6_intrae __attribute__((depth(2)));
channel float 	chan_Intrae2StoreLS_LS7_intrae __attribute__((depth(2)));
channel float 	chan_Intrae2StoreLS_LS8_intrae __attribute__((depth(2)));
channel float 	chan_Intrae2StoreLS_LS9_intrae __attribute__((depth(2)));
#endif

#if 1
channel float 	chan_Intrae2StoreIC_intrae     __attribute__((depth(MAX_POPSIZE)));
channel float 	chan_Intrae2StoreGG_intrae     __attribute__((depth(MAX_POPSIZE)));
#endif
#if 0
channel float 	chan_Intrae2StoreLS_LS1_intrae __attribute__((depth(MAX_POPSIZE)));
channel float 	chan_Intrae2StoreLS_LS2_intrae __attribute__((depth(MAX_POPSIZE)));
channel float 	chan_Intrae2StoreLS_LS3_intrae __attribute__((depth(MAX_POPSIZE)));
channel float 	chan_Intrae2StoreLS_LS4_intrae __attribute__((depth(MAX_POPSIZE)));
channel float 	chan_Intrae2StoreLS_LS5_intrae __attribute__((depth(MAX_POPSIZE)));
channel float 	chan_Intrae2StoreLS_LS6_intrae __attribute__((depth(MAX_POPSIZE)));
channel float 	chan_Intrae2StoreLS_LS7_intrae __attribute__((depth(MAX_POPSIZE)));
channel float 	chan_Intrae2StoreLS_LS8_intrae __attribute__((depth(MAX_POPSIZE)));
channel float 	chan_Intrae2StoreLS_LS9_intrae __attribute__((depth(MAX_POPSIZE)));
#endif

// Send PRNG outputs from generators to consumers
channel float8   chan_PRNG2GA_BT_ushort_float_prng;
@@ -336,12 +376,24 @@ void Krnl_GA(__global float* restrict GlobPopulationCurrent,
		mem_fence(CLK_CHANNEL_MEM_FENCE);

		for (uchar pipe_cnt=0; pipe_cnt<DockConst_num_of_genes; pipe_cnt++) {
#if 0
			#if defined(SINGLE_COPY_POP_ENE)
			LocalPopCurr[pop_cnt][pipe_cnt & MASK_GENOTYPE] = GlobPopCurr[pop_cnt*ACTUAL_GENOTYPE_LENGTH + pipe_cnt];
			#else
			LocalPopCurr[pop_cnt][pipe_cnt & MASK_GENOTYPE] = GlobPopulationCurrent[pop_cnt*ACTUAL_GENOTYPE_LENGTH + pipe_cnt];
			#endif
			write_channel_altera(chan_IC2Conf_genotype, LocalPopCurr[pop_cnt][pipe_cnt & MASK_GENOTYPE]);	
#endif

			float tmp_ic;
			#if defined(SINGLE_COPY_POP_ENE)
			tmp_ic = GlobPopCurr[pop_cnt*ACTUAL_GENOTYPE_LENGTH + pipe_cnt];
			#else
			tmp_ic = GlobPopulationCurrent[pop_cnt*ACTUAL_GENOTYPE_LENGTH + pipe_cnt];
			#endif

			LocalPopCurr[pop_cnt][pipe_cnt & MASK_GENOTYPE] = tmp_ic;
			write_channel_altera(chan_IC2Conf_genotype, tmp_ic);
		}

		#if defined (DEBUG_KRNL_IC)
@@ -349,6 +401,7 @@ void Krnl_GA(__global float* restrict GlobPopulationCurrent,
		#endif

		// Read energy
#if 0
		float energyIA_IC_rx;
		float energyIE_IC_rx;
		bool intra_valid = false;
@@ -361,7 +414,14 @@ void Krnl_GA(__global float* restrict GlobPopulationCurrent,
				energyIE_IC_rx = read_channel_nb_altera(chan_Intere2StoreIC_intere, &inter_valid);
			}
		}
#endif

#if 1
		mem_fence(CLK_CHANNEL_MEM_FENCE);
		float energyIA_IC_rx = read_channel_altera(chan_Intrae2StoreIC_intrae);
		mem_fence(CLK_CHANNEL_MEM_FENCE);
		float energyIE_IC_rx = read_channel_altera(chan_Intere2StoreIC_intere);		
#endif
		LocalEneCurr[pop_cnt] = energyIA_IC_rx + energyIE_IC_rx;

		#if defined (DEBUG_KRNL_IC)
@@ -584,6 +644,7 @@ void Krnl_GA(__global float* restrict GlobPopulationCurrent,
			#endif	

			// Read energy
#if 0
			float energyIA_GG_rx;
			float energyIE_GG_rx;
			bool intra_valid = false;
@@ -596,7 +657,14 @@ void Krnl_GA(__global float* restrict GlobPopulationCurrent,
					energyIE_GG_rx = read_channel_nb_altera(chan_Intere2StoreGG_intere, &inter_valid);
				}
			}
#endif

#if 1
			mem_fence(CLK_CHANNEL_MEM_FENCE);
			float energyIA_GG_rx = read_channel_altera(chan_Intrae2StoreGG_intrae);
			mem_fence(CLK_CHANNEL_MEM_FENCE);
			float energyIE_GG_rx = read_channel_altera(chan_Intere2StoreGG_intere);			
#endif
			LocalEneNext[new_pop_cnt] = energyIA_GG_rx + energyIE_GG_rx;

			#if defined (DEBUG_KRNL_GG)
+9 −2
Original line number Diff line number Diff line
@@ -191,7 +191,7 @@ while(valid) {
			}

			//printf("Energy to calculate sent from LS ... ");

#if 1
			float energyIA_LS_rx;
			float energyIE_LS_rx;
			bool intra_valid = false;
@@ -204,7 +204,14 @@ while(valid) {
					energyIE_LS_rx = read_channel_nb_altera(chan_Intere2StoreLS_LS1_intere, &inter_valid);
				}
			}
#endif
	
#if 0	
			mem_fence(CLK_CHANNEL_MEM_FENCE);
			float energyIA_LS_rx = read_channel_altera(chan_Intrae2StoreLS_LS1_intrae);
			float energyIE_LS_rx = read_channel_altera(chan_Intere2StoreLS_LS1_intere);
			mem_fence(CLK_CHANNEL_MEM_FENCE);
#endif
			float candidate_energy = energyIA_LS_rx + energyIE_LS_rx;

			// update LS energy-evaluation count
+8 −1
Original line number Diff line number Diff line
@@ -194,7 +194,7 @@ while(valid) {
			}

			//printf("Energy to calculate sent from LS2 ... ");

#if 1
			float energyIA_LS_rx;
			float energyIE_LS_rx;
			bool intra_valid = false;
@@ -207,7 +207,14 @@ while(valid) {
					energyIE_LS_rx = read_channel_nb_altera(chan_Intere2StoreLS_LS2_intere, &inter_valid);
				}
			}
#endif

#if 0
			mem_fence(CLK_CHANNEL_MEM_FENCE);
			float energyIA_LS_rx = read_channel_altera(chan_Intrae2StoreLS_LS2_intrae);
			float energyIE_LS_rx = read_channel_altera(chan_Intere2StoreLS_LS2_intere);
			mem_fence(CLK_CHANNEL_MEM_FENCE);
#endif
			float candidate_energy = energyIA_LS_rx + energyIE_LS_rx;

			// update LS energy-evaluation count
+8 −1
Original line number Diff line number Diff line
@@ -194,7 +194,7 @@ while(valid) {
			}

			//printf("Energy to calculate sent from LS3 ... ");

#if 1
			float energyIA_LS_rx;
			float energyIE_LS_rx;
			bool intra_valid = false;
@@ -207,7 +207,14 @@ while(valid) {
					energyIE_LS_rx = read_channel_nb_altera(chan_Intere2StoreLS_LS3_intere, &inter_valid);
				}
			}
#endif

#if 0
			mem_fence(CLK_CHANNEL_MEM_FENCE);
			float energyIA_LS_rx = read_channel_altera(chan_Intrae2StoreLS_LS3_intrae);
			float energyIE_LS_rx = read_channel_altera(chan_Intere2StoreLS_LS3_intere);
			mem_fence(CLK_CHANNEL_MEM_FENCE);
#endif
			float candidate_energy = energyIA_LS_rx + energyIE_LS_rx;

			// update LS energy-evaluation count
+8 −1
Original line number Diff line number Diff line
@@ -194,7 +194,7 @@ while(valid) {
			}

			//printf("Energy to calculate sent from LS4 ... ");

#if 1
			float energyIA_LS_rx;
			float energyIE_LS_rx;
			bool intra_valid = false;
@@ -207,7 +207,14 @@ while(valid) {
					energyIE_LS_rx = read_channel_nb_altera(chan_Intere2StoreLS_LS4_intere, &inter_valid);
				}
			}
#endif

#if 0
			mem_fence(CLK_CHANNEL_MEM_FENCE);
			float energyIA_LS_rx = read_channel_altera(chan_Intrae2StoreLS_LS4_intrae);
			float energyIE_LS_rx = read_channel_altera(chan_Intere2StoreLS_LS4_intere);
			mem_fence(CLK_CHANNEL_MEM_FENCE);
#endif
			float candidate_energy = energyIA_LS_rx + energyIE_LS_rx;

			// update LS energy-evaluation count
Loading