Commit f170a58d authored by Leonardo Solis's avatar Leonardo Solis

LS replicated 5 times

parent 809fc997
......@@ -212,6 +212,14 @@ ENABLE_K35 = YES
# bt ushort_float
ENABLE_K36 = YES
# prng ls4, ls5
ENABLE_K37 = YES
ENABLE_K38 = YES
# krnl_ls4, Krnl_ls5
ENABLE_K39 = YES
ENABLE_K40 = YES
ifeq ($(ENABLE_K1),YES)
K1 =-DENABLE_KERNEL1
......@@ -435,7 +443,31 @@ else
K36 =
endif
ENABLE_KERNELS = $(K1) $(K2) $(K3) $(K4) $(K5) $(K6) $(K7) $(K8) $(K9) $(K10) $(K11) $(K12) $(K13) $(K14) $(K15) $(K16) $(K17) $(K18) $(K19) $(K20) $(K21) $(K22) $(K23) $(K24) $(K25) $(K26) $(K27) $(K28) $(K29) $(K30) $(K31) $(K32) $(K33) $(K34) $(K35) $(K36)
ifeq ($(ENABLE_K37),YES)
K37 =-DENABLE_KERNEL37
else
K37 =
endif
ifeq ($(ENABLE_K38),YES)
K38 =-DENABLE_KERNEL38
else
K38 =
endif
ifeq ($(ENABLE_K39),YES)
K39 =-DENABLE_KERNEL39
else
K39 =
endif
ifeq ($(ENABLE_K40),YES)
K40 =-DENABLE_KERNEL40
else
K40 =
endif
ENABLE_KERNELS = $(K1) $(K2) $(K3) $(K4) $(K5) $(K6) $(K7) $(K8) $(K9) $(K10) $(K11) $(K12) $(K13) $(K14) $(K15) $(K16) $(K17) $(K18) $(K19) $(K20) $(K21) $(K22) $(K23) $(K24) $(K25) $(K26) $(K27) $(K28) $(K29) $(K30) $(K31) $(K32) $(K33) $(K34) $(K35) $(K36) $(K37) $(K38) $(K39) $(K40)
# =============================
# Reproduce result (remove randomness)
......@@ -461,9 +493,13 @@ FIXED_POINT_INTRAE=NO
FIXED_POINT_LS1=YES
FIXED_POINT_LS2=YES
FIXED_POINT_LS3=YES
FIXED_POINT_LS4=YES
FIXED_POINT_LS5=YES
#FIXED_POINT_LS1=NO
#FIXED_POINT_LS2=NO
#FIXED_POINT_LS3=NO
#FIXED_POINT_LS4=NO
#FIXED_POINT_LS5=NO
SINGLE_COPY_POP_ENE=YES
......@@ -505,6 +541,18 @@ else
FIPOLS3_FLAG=
endif
ifeq ($(FIXED_POINT_LS4), YES)
FIPOLS4_FLAG=-DFIXED_POINT_LS4
else
FIPOLS4_FLAG=
endif
ifeq ($(FIXED_POINT_LS5), YES)
FIPOLS5_FLAG=-DFIXED_POINT_LS5
else
FIPOLS5_FLAG=
endif
ifeq ($(SINGLE_COPY_POP_ENE), YES)
COPYPOPENE_FLAG=-DSINGLE_COPY_POP_ENE
else
......@@ -517,7 +565,7 @@ else
SEP_FGRID_FLAG=
endif
FIPO_FLAG = $(FIPOCO_FLAG) $(FIPOIE_FLAG) $(FIPOIA_FLAG) $(FIPOLS1_FLAG) $(FIPOLS2_FLAG) $(FIPOLS3_FLAG) $(COPYPOPENE_FLAG) $(SEP_FGRID_FLAG)
FIPO_FLAG = $(FIPOCO_FLAG) $(FIPOIE_FLAG) $(FIPOIA_FLAG) $(FIPOLS1_FLAG) $(FIPOLS2_FLAG) $(FIPOLS3_FLAG) $(FIPOLS4_FLAG) $(FIPOLS5_FLAG) $(COPYPOPENE_FLAG) $(SEP_FGRID_FLAG)
# =============================
# AOC flags
......
......@@ -135,6 +135,14 @@ while(active) {
case 0x03:
fl_tmp = read_channel_altera(chan_LS2Conf_LS3_genotype);
break;
case 0x04:
fl_tmp = read_channel_altera(chan_LS2Conf_LS4_genotype);
break;
case 0x05:
fl_tmp = read_channel_altera(chan_LS2Conf_LS5_genotype);
break;
}
if (i > 2) {
......
This diff is collapsed.
......@@ -19,6 +19,8 @@ while(active) {
bool LS1_end_valid = false;
bool LS2_end_valid = false;
bool LS3_end_valid = false;
bool LS4_end_valid = false;
bool LS5_end_valid = false;
bool Off_active;
bool IC_active;
......@@ -26,6 +28,8 @@ while(active) {
bool LS1_end_active;
bool LS2_end_active;
bool LS3_end_active;
bool LS4_end_active;
bool LS5_end_active;
while (
(Off_valid == false) &&
......@@ -33,7 +37,9 @@ while(active) {
(GG_valid == false) &&
(LS1_end_valid == false) &&
(LS2_end_valid == false) &&
(LS3_end_valid == false)
(LS3_end_valid == false) &&
(LS4_end_valid == false) &&
(LS5_end_valid == false)
){
Off_active = read_channel_nb_altera(chan_IGLArbiter_Off, &Off_valid);
IC_active = read_channel_nb_altera(chan_GA2IGL_IC_active, &IC_valid);
......@@ -41,11 +47,13 @@ while(active) {
LS1_end_active = read_channel_nb_altera(chan_LS2Arbiter_LS1_end, &LS1_end_valid);
LS2_end_active = read_channel_nb_altera(chan_LS2Arbiter_LS2_end, &LS2_end_valid);
LS3_end_active = read_channel_nb_altera(chan_LS2Arbiter_LS3_end, &LS3_end_valid);
LS4_end_active = read_channel_nb_altera(chan_LS2Arbiter_LS4_end, &LS4_end_valid);
LS5_end_active = read_channel_nb_altera(chan_LS2Arbiter_LS5_end, &LS5_end_valid);
}
uchar bound_tmp = 0;
active = Off_valid ? 0x00 : 0x01;
char mode [3]; // mode for all LS
char mode [5]; // mode for all LS
/*
float genotypeICGG [ACTUAL_GENOTYPE_LENGTH];
......@@ -54,110 +62,96 @@ while(active) {
// get genotype from IC, GG, LS1, LS2, LS3
if (active == 0x01) {
//#pragma ivdep
/*
for (uchar i=0; i<DockConst_num_of_genes; i++) {
*/
if (IC_valid == true) {
bound_tmp++;
/*
if (i == 0) {bound_tmp++; }
genotypeICGG [i] = read_channel_altera(chan_IC2Conf_genotype);
*/
}
else if (GG_valid == true) {
bound_tmp++;
/*
if (i == 0) {bound_tmp++; }
genotypeICGG [i] = read_channel_altera(chan_GG2Conf_genotype);
*/
}
else{
/*
float genotype1;
float genotype2;
float genotype3;
*/
#if 0
if (LS1_end_valid == true) {
//printf("%-15s %5s\n", "LS1_valid: ", "reading genotypes");
if (i == 0) {bound_tmp++; }
genotype1 /*[i]*/ = read_channel_altera(chan_LS2Conf_LS1_genotype);
}
#endif
/*
if (LS2_end_valid == true) {
genotype2 = read_channel_altera(chan_LS2Conf_LS2_genotype);
}
if (LS3_end_valid == true) {
genotype3 = read_channel_altera(chan_LS2Conf_LS3_genotype);
if (IC_valid == true) {
bound_tmp++;
}
else if (GG_valid == true) {
bound_tmp++;
}
else{
// Reorder the mode & genotype coming from LS
if (LS1_end_valid) {mode[0] = 0x01; bound_tmp++;
if (LS2_end_valid) {mode[1] = 0x02; bound_tmp++;
if (LS3_end_valid) {mode[2] = 0x03; bound_tmp++;
if (LS4_end_valid) {mode[3] = 0x04; bound_tmp++;
if (LS5_end_valid) {mode[4] = 0x05; bound_tmp++;}
}
else {
if (LS5_end_valid) {mode[3] = 0x05; bound_tmp++;}
}
}
else { // LS1: yes, LS2: yes, LS3: no
if (LS4_end_valid) {mode[2] = 0x04; bound_tmp++;
if (LS5_end_valid) {mode[3] = 0x05; bound_tmp++;}
}
else {
if (LS5_end_valid) {mode[2] = 0x05; bound_tmp++;}
}
}
}
*/
// Reorder the mode & genotype coming from LS
if (LS1_end_valid) {
mode[0] = 0x01; bound_tmp++;
/*
genotype1 = read_channel_altera(chan_LS2Conf_LS1_genotype);
if (i == 0) {mode[0] = 0x01; bound_tmp++;}
genotype[0][i & MASK_GENOTYPE] = genotype1;
*/
if (LS2_end_valid) {
mode[1] = 0x02; bound_tmp++;
/*
if (i == 0) {mode[1] = 0x02; bound_tmp++;}
genotype[1][i & MASK_GENOTYPE] = genotype2;
*/
else { // LS1: yes, LS2: no
if (LS3_end_valid) {mode[1] = 0x03; bound_tmp++;
if (LS4_end_valid) {mode[2] = 0x04; bound_tmp++;
if (LS5_end_valid) {mode[3] = 0x05; bound_tmp++;}
}
else {
if (LS5_end_valid) {mode[2] = 0x05; bound_tmp++;}
}
}
else { // LS1: yes, LS2: no, LS3: no
if (LS4_end_valid) {mode[1] = 0x04; bound_tmp++;
if (LS5_end_valid) {mode[2] = 0x05; bound_tmp++;}
}
else {
if (LS5_end_valid) {mode[1] = 0x05; bound_tmp++;}
}
if (LS3_end_valid) {
mode[2] = 0x03; bound_tmp++;
/*
if (i == 0) {mode[2] = 0x03; bound_tmp++;}
genotype[2][i & MASK_GENOTYPE] = genotype3;
*/
}
}
}
else { // LS1: no
if (LS2_end_valid) {mode[0] = 0x02; bound_tmp++;
if (LS3_end_valid) {mode[1] = 0x03; bound_tmp++;
if (LS4_end_valid) {mode[2] = 0x04; bound_tmp++;
if (LS5_end_valid) {mode[3] = 0x05; bound_tmp++;}
}
else {
if (LS5_end_valid) {mode[2] = 0x05; bound_tmp++;}
}
}
else {
if (LS3_end_valid) {
mode[1] = 0x03; bound_tmp++;
/*
if (i == 0) {mode[1] = 0x03; bound_tmp++;}
genotype[1][i & MASK_GENOTYPE] = genotype3;
*/
else { // LS1: no, LS2: yes, LS3: no
if (LS4_end_valid) {mode[1] = 0x04; bound_tmp++;
if (LS5_end_valid) {mode[2] = 0x05; bound_tmp++;}
}
else {
if (LS5_end_valid) {mode[1] = 0x05; bound_tmp++;}
}
}
}
else {
if (LS2_end_valid) {
mode[0] = 0x02; bound_tmp++;
/*
if (i == 0) {mode[0] = 0x02; bound_tmp++;}
genotype[0][i & MASK_GENOTYPE] = genotype2;
*/
if (LS3_end_valid) {
mode[1] = 0x03; bound_tmp++;
/*
if (i == 0) {mode[1] = 0x03; bound_tmp++;}
genotype[1][i & MASK_GENOTYPE] = genotype3;
*/
else { // LS1: no, LS2: no
if (LS3_end_valid) {mode[0] = 0x03; bound_tmp++;
if (LS4_end_valid) {mode[1] = 0x04; bound_tmp++;
if (LS5_end_valid) {mode[2] = 0x05; bound_tmp++;}
}
else {
if (LS5_end_valid) {mode[1] = 0x05; bound_tmp++;}
}
}
else {
if (LS3_end_valid) {
mode[0] = 0x03; bound_tmp++;
/*
if (i == 0) {mode[0] = 0x03; bound_tmp++;}
genotype[0][i & MASK_GENOTYPE] = genotype3;
*/
else { // LS1: no, LS2: no, LS3: no
if (LS4_end_valid) {mode[0] = 0x04; bound_tmp++;
if (LS5_end_valid) {mode[1] = 0x05; bound_tmp++;}
}
else {
if (LS5_end_valid) {mode[0] = 0x05; bound_tmp++;}
}
}
}
}
/*
} // End of for-loop for (uchar i=0; i<DockConst_num_of_genes; i++) { }
*/
}
}
} // End if (active == true)
uchar bound = active ? bound_tmp : 1;
......
......@@ -485,6 +485,12 @@ while(active) {
// LS 3
case 0x03: write_channel_altera(chan_Intere2StoreLS_LS3_intere, final_interE); break;
// LS 4
case 0x04: write_channel_altera(chan_Intere2StoreLS_LS4_intere, final_interE); break;
// LS 5
case 0x05: write_channel_altera(chan_Intere2StoreLS_LS5_intere, final_interE); break;
}
// --------------------------------------------------------------
......
......@@ -225,6 +225,12 @@ while(active) {
// LS 3
case 0x03: write_channel_altera(chan_Intrae2StoreLS_LS3_intrae, intraE); break;
// LS 4
case 0x04: write_channel_altera(chan_Intrae2StoreLS_LS4_intrae, intraE); break;
// LS 5
case 0x05: write_channel_altera(chan_Intrae2StoreLS_LS5_intrae, intraE); break;
}
// --------------------------------------------------------------
......
This diff is collapsed.
This diff is collapsed.
......@@ -113,6 +113,7 @@ void Krnl_Prng_GG_float(unsigned int Host_seed,
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
#if 0
__kernel __attribute__ ((max_global_work_dim(0)))
void Krnl_Prng_LS123_ushort(unsigned int Host_seed1,
unsigned int Host_seed2,
......@@ -197,6 +198,68 @@ void Krnl_Prng_LS123_ushort(unsigned int Host_seed1,
*/
} // End of while(active)
}
#endif
__kernel __attribute__ ((max_global_work_dim(0)))
void Krnl_Prng_LS123_ushort(unsigned int Host_seed1,
unsigned int Host_seed2,
unsigned int Host_seed3,
unsigned int Host_seed4,
unsigned int Host_seed5,
unsigned int DockConst_pop_size){
uint lfsr[5];
lfsr[0] = Host_seed1;
lfsr[1] = Host_seed2;
lfsr[2] = Host_seed3;
lfsr[3] = Host_seed4;
lfsr[4] = Host_seed5;
bool valid = false;
while(!valid) {
bool active = true;
active = read_channel_nb_altera(chan_Arbiter_LS123_ushort_off, &valid);
ushort tmp[5];
#pragma unroll
for (uint i=0; i<5; i++){
uchar lsb[5];
lsb [i] = lfsr[i] & 0x01u;
lfsr[i] >>= 1;
lfsr[i] ^= (-lsb[i]) & 0xA3000000u;
tmp [i] = (DockConst_pop_size/MAX_UINT)*lfsr[i];
}
// to avoid having same entities undergoing LS simultaneously
if (
(tmp[0] == tmp[1]) || (tmp[0] == tmp[2]) || (tmp[0] == tmp[3]) || (tmp[0] == tmp[4]) ||
(tmp[1] == tmp[2]) || (tmp[1] == tmp[3]) || (tmp[1] == tmp[4]) ||
(tmp[2] == tmp[3]) || (tmp[2] == tmp[4]) ||
(tmp[3] == tmp[4])
) {
tmp[1] = tmp[0] + 1;
tmp[2] = tmp[1] + 2;
tmp[3] = tmp[2] + 3;
tmp[4] = tmp[3] + 4;
}
bool success = false;
ushort8 tmp123;
tmp123.s0 = tmp[0];
tmp123.s1 = tmp[1];
tmp123.s2 = tmp[2];
tmp123.s3 = tmp[3];
tmp123.s4 = tmp[4];
if(!valid) {
success = write_channel_nb_altera(chan_PRNG2GA_LS123_ushort_prng, tmp123);
}
} // End of while(active)
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
......@@ -303,5 +366,73 @@ void Krnl_Prng_LS3_float(unsigned int Host_seed,
}
} // End of while(active)
}
__kernel __attribute__ ((max_global_work_dim(0)))
void Krnl_Prng_LS4_float(unsigned int Host_seed,
unsigned char DockConst_num_of_genes){
uint lfsr = Host_seed;
bool valid = false;
while(!valid) {
bool active = true;
active = read_channel_nb_altera(chan_Arbiter_LS4_float_off, &valid);
for(uchar i=0; i<DockConst_num_of_genes; i++) {
float tmp;
uchar lsb;
lsb = lfsr & 0x01u;
lfsr >>= 1;
lfsr ^= (-lsb) & 0xA3000000u;
tmp = (0.999999f/MAX_UINT)*lfsr;
bool success = false;
#if defined (FIXED_POINT_LS2)
fixedpt fixpt_tmp = fixedpt_fromfloat(tmp);
if(!valid) {
success = write_channel_nb_altera(chan_PRNG2GA_LS4_float_prng, *(float*) &fixpt_tmp);
}
#else
if(!valid) {
success = write_channel_nb_altera(chan_PRNG2GA_LS4_float_prng, tmp);
}
#endif
}
} // End of while(active)
}
__kernel __attribute__ ((max_global_work_dim(0)))
void Krnl_Prng_LS5_float(unsigned int Host_seed,
unsigned char DockConst_num_of_genes){
uint lfsr = Host_seed;
bool valid = false;
while(!valid) {
bool active = true;
active = read_channel_nb_altera(chan_Arbiter_LS5_float_off, &valid);
for(uchar i=0; i<DockConst_num_of_genes; i++) {
float tmp;
uchar lsb;
lsb = lfsr & 0x01u;
lfsr >>= 1;
lfsr ^= (-lsb) & 0xA3000000u;
tmp = (0.999999f/MAX_UINT)*lfsr;
bool success = false;
#if defined (FIXED_POINT_LS2)
fixedpt fixpt_tmp = fixedpt_fromfloat(tmp);
if(!valid) {
success = write_channel_nb_altera(chan_PRNG2GA_LS5_float_prng, *(float*) &fixpt_tmp);
}
#else
if(!valid) {
success = write_channel_nb_altera(chan_PRNG2GA_LS5_float_prng, tmp);
}
#endif
}
} // End of while(active)
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
......@@ -526,7 +526,12 @@ NO HW TEST, THIS IS A CLEANUP COMMIT
>>> commit "removed unneeded kernels files"
. Expand from 3LS to 5LS blocks
165. Expand from 3LS to 5LS blocks: `Conform`, `GA`, `IGL_Arbiter`, `InterE`, `IntraE`, `PRNG`, `performdocking`
Both run in Sauron (non-instrumented freq=172MHz , intrumented freq=179 MHz)
Speedup vs i5 cpu core: 3ptb: 59/34 = 1.73x, 1stp: 84/58 = 1.44x
(instrumented version runs faster: 59/32 = 1.84x, 84/56=1.5x)
>>> commit "LS replicated 5 times"
XXX, Between Conform and InterE, IntraE create a wider channel:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment