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

#36, first commit (swemu OK) of tradition GA with sdx174


Former-commit-id: 1ca1d501
parent e9dc7a4c
......@@ -25,25 +25,6 @@ ENABLE_KERNELS = -DENABLE_KRNL_GA \
-DENABLE_KRNL_PRNG_BT_USHORT_FLOAT \
-DENABLE_KRNL_PRNG_GG_UCHAR \
-DENABLE_KRNL_PRNG_GG_FLOAT \
-DENABLE_KRNL_PRNG_LS123_USHORT \
-DENABLE_KRNL_PRNG_LS_FLOAT \
-DENABLE_KRNL_PRNG_LS2_FLOAT \
-DENABLE_KRNL_PRNG_LS3_FLOAT \
-DENABLE_KRNL_PRNG_LS4_FLOAT \
-DENABLE_KRNL_PRNG_LS5_FLOAT \
-DENABLE_KRNL_PRNG_LS6_FLOAT \
-DENABLE_KRNL_PRNG_LS7_FLOAT \
-DENABLE_KRNL_PRNG_LS8_FLOAT \
-DENABLE_KRNL_PRNG_LS9_FLOAT \
-DENABLE_KRNL_LS \
-DENABLE_KRNL_LS2 \
-DENABLE_KRNL_LS3 \
-DENABLE_KRNL_LS4 \
-DENABLE_KRNL_LS5 \
-DENABLE_KRNL_LS6 \
-DENABLE_KRNL_LS7 \
-DENABLE_KRNL_LS8 \
-DENABLE_KRNL_LS9 \
-DENABLE_KRNL_IGL_ARBITER
# Fixed-point
......@@ -51,7 +32,6 @@ ENABLE_KERNELS = -DENABLE_KRNL_GA \
FIXED_POINT_CONFORM=NO
FIXED_POINT_INTERE=NO
FIXED_POINT_INTRAE=NO
FIXED_POINT_ALL_LS=NO
ifeq ($(FIXED_POINT_CONFORM), YES)
FIPOCO_FLAG=-DFIXED_POINT_CONFORM
......@@ -71,24 +51,9 @@ else
FIPOIA_FLAG=
endif
ifeq ($(FIXED_POINT_ALL_LS), YES)
FIPO_ALL_LS_FLAG=-DFIXED_POINT_LS1 -DFIXED_POINT_LS2 -DFIXED_POINT_LS3 -DFIXED_POINT_LS4 -DFIXED_POINT_LS5 -DFIXED_POINT_LS6 -DFIXED_POINT_LS7 -DFIXED_POINT_LS8 -DFIXED_POINT_LS9
else
FIPO_ALL_LS_FLAG=
endif
FIPO_FLAG = $(FIPOCO_FLAG) \
$(FIPOIE_FLAG) \
$(FIPOIA_FLAG) \
$(FIPOLS1_FLAG) \
$(FIPOLS2_FLAG) \
$(FIPOLS3_FLAG) \
$(FIPOLS4_FLAG) \
$(FIPOLS5_FLAG) \
$(FIPOLS6_FLAG) \
$(FIPOLS7_FLAG) \
$(FIPOLS8_FLAG) \
$(FIPOLS9_FLAG)
$(FIPOIA_FLAG)
# Other configs
......
......@@ -81,15 +81,6 @@ while(active) {
switch (mode) {
case 'I': read_pipe_block(chan_IC2Conf_genotype, &fl_tmp); break;
case 'G': read_pipe_block(chan_GG2Conf_genotype, &fl_tmp); break;
case 0x01: read_pipe_block(chan_LS2Conf_LS1_genotype, &fl_tmp); break;
case 0x02: read_pipe_block(chan_LS2Conf_LS2_genotype, &fl_tmp); break;
case 0x03: read_pipe_block(chan_LS2Conf_LS3_genotype, &fl_tmp); break;
case 0x04: read_pipe_block(chan_LS2Conf_LS4_genotype, &fl_tmp); break;
case 0x05: read_pipe_block(chan_LS2Conf_LS5_genotype, &fl_tmp); break;
case 0x06: read_pipe_block(chan_LS2Conf_LS6_genotype, &fl_tmp); break;
case 0x07: read_pipe_block(chan_LS2Conf_LS7_genotype, &fl_tmp); break;
case 0x08: read_pipe_block(chan_LS2Conf_LS8_genotype, &fl_tmp); break;
case 0x09: read_pipe_block(chan_LS2Conf_LS9_genotype, &fl_tmp); break;
}
if (i > 2) {
......
......@@ -28,15 +28,6 @@ pipe int chan_GA2IGL_GG_active __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_
// Send genotypes from producers (IC, GG, LSs) to Conform
pipe float chan_IC2Conf_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_GG2Conf_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_LS2Conf_LS1_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_LS2Conf_LS2_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_LS2Conf_LS3_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_LS2Conf_LS4_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_LS2Conf_LS5_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_LS2Conf_LS6_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_LS2Conf_LS7_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_LS2Conf_LS8_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_LS2Conf_LS9_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
// Send ligand-atom positions from Conform to InterE & IntraE
// Resized to valid SDAccel depths: 16, 32, ...
......@@ -50,128 +41,21 @@ pipe char chan_Conf2Intrae_actmode __attribute__((xcl_reqd_pipe_depth(P
// Resized to valid SDAccel depths: 16, 32, ...
pipe float chan_Intere2StoreIC_intere __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_Intere2StoreGG_intere __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_Intere2StoreLS_LS1_intere __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_Intere2StoreLS_LS2_intere __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_Intere2StoreLS_LS3_intere __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_Intere2StoreLS_LS4_intere __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_Intere2StoreLS_LS5_intere __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_Intere2StoreLS_LS6_intere __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_Intere2StoreLS_LS7_intere __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_Intere2StoreLS_LS8_intere __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_Intere2StoreLS_LS9_intere __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_Intrae2StoreIC_intrae __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_Intrae2StoreGG_intrae __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_Intrae2StoreLS_LS1_intrae __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_Intrae2StoreLS_LS2_intrae __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_Intrae2StoreLS_LS3_intrae __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_Intrae2StoreLS_LS4_intrae __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_Intrae2StoreLS_LS5_intrae __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_Intrae2StoreLS_LS6_intrae __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_Intrae2StoreLS_LS7_intrae __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_Intrae2StoreLS_LS8_intrae __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_Intrae2StoreLS_LS9_intrae __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
// Send PRNG outputs from generators to consumers
// Resized to valid SDAccel depths: 16, 32, ...
pipe float8 chan_PRNG2GA_BT_ushort_float_prng __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe uchar2 chan_PRNG2GA_GG_uchar_prng __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_PRNG2GA_GG_float_prng __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe ushort16 chan_PRNG2GA_LS123_ushort_prng __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_PRNG2LS_float_prng __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_PRNG2LS2_float_prng __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_PRNG2LS3_float_prng __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_PRNG2LS4_float_prng __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_PRNG2LS5_float_prng __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_PRNG2LS6_float_prng __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_PRNG2LS7_float_prng __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_PRNG2LS8_float_prng __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_PRNG2LS9_float_prng __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
// Turn-off signals to PRNG generators
// Resized to valid SDAccel depths: 16, 32, ...
pipe int chan_GA2PRNG_BT_ushort_float_off __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_GA2PRNG_GG_uchar_off __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_GA2PRNG_GG_float_off __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_GA2PRNG_LS123_ushort_off __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_GA2PRNG_LS_float_off __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_GA2PRNG_LS2_float_off __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_GA2PRNG_LS3_float_off __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_GA2PRNG_LS4_float_off __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_GA2PRNG_LS5_float_off __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_GA2PRNG_LS6_float_off __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_GA2PRNG_LS7_float_off __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_GA2PRNG_LS8_float_off __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_GA2PRNG_LS9_float_off __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
// Send energy values and genotypes to LSs
// Resized to valid SDAccel depths: 16, 32, ...
pipe float chan_GA2LS_LS1_energy __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_GA2LS_LS2_energy __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_GA2LS_LS3_energy __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_GA2LS_LS4_energy __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_GA2LS_LS5_energy __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_GA2LS_LS6_energy __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_GA2LS_LS7_energy __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_GA2LS_LS8_energy __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float chan_GA2LS_LS9_energy __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
// Resized to valid SDAccel depths: 16, 32, ...
pipe float chan_GA2LS_LS1_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_GA2LS_LS2_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_GA2LS_LS3_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_GA2LS_LS4_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_GA2LS_LS5_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_GA2LS_LS6_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_GA2LS_LS7_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_GA2LS_LS8_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_GA2LS_LS9_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
// Send LS status from LSs to IGL_Arbiter
pipe int chan_LS2Arbiter_LS1_end __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_LS2Arbiter_LS2_end __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_LS2Arbiter_LS3_end __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_LS2Arbiter_LS4_end __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_LS2Arbiter_LS5_end __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_LS2Arbiter_LS6_end __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_LS2Arbiter_LS7_end __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_LS2Arbiter_LS8_end __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_LS2Arbiter_LS9_end __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
// Get LS-eval-count, new energy, new genotype from LSs
// Resized to valid SDAccel depths: 16, 32, ...
pipe float2 chan_LS2GA_LS1_evalenergy __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float2 chan_LS2GA_LS2_evalenergy __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float2 chan_LS2GA_LS3_evalenergy __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float2 chan_LS2GA_LS4_evalenergy __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float2 chan_LS2GA_LS5_evalenergy __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float2 chan_LS2GA_LS6_evalenergy __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float2 chan_LS2GA_LS7_evalenergy __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float2 chan_LS2GA_LS8_evalenergy __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe float2 chan_LS2GA_LS9_evalenergy __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
// Resized to valid SDAccel depths: 16, 32, ...
pipe float chan_LS2GA_LS1_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_LS2GA_LS2_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_LS2GA_LS3_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_LS2GA_LS4_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_LS2GA_LS5_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_LS2GA_LS6_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_LS2GA_LS7_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_LS2GA_LS8_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
pipe float chan_LS2GA_LS9_genotype __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_64)));
// Turn-off signals to LSs
// Resized to valid SDAccel depths: 16, 32, ...
pipe int chan_GA2LS_Off1_active __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_GA2LS_Off2_active __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_GA2LS_Off3_active __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_GA2LS_Off4_active __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_GA2LS_Off5_active __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_GA2LS_Off6_active __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_GA2LS_Off7_active __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_GA2LS_Off8_active __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
pipe int chan_GA2LS_Off9_active __attribute__((xcl_reqd_pipe_depth(PIPE_DEPTH_16)));
// Send genotype-producer-pipe selector and genotype
// from IGL_Arbiter to Conform
......@@ -597,186 +481,6 @@ void Krnl_GA(
// Subject num_of_entity_for_ls pieces of offsprings to LS
// ------------------------------------------------------------------
uint ls_eval_cnt = 0;
/*
#pragma ivdep
*/
__attribute__((xcl_pipeline_loop))
LOOP_FOR_GA_LS_OUTER:
for (ushort ls_ent_cnt=0; ls_ent_cnt<DockConst_num_of_lsentities; ls_ent_cnt+=9) {
// Choose random & different entities on every iteration
ushort16 entity_ls;
read_pipe_block(chan_PRNG2GA_LS123_ushort_prng, &entity_ls);
/*
mem_fence(CLK_CHANNEL_MEM_FENCE);
*/
//printf("test point LS 1\n");
ushort entity_ls1 = entity_ls.s0;
ushort entity_ls2 = entity_ls.s1;
ushort entity_ls3 = entity_ls.s2;
ushort entity_ls4 = entity_ls.s3;
ushort entity_ls5 = entity_ls.s4;
ushort entity_ls6 = entity_ls.s5;
ushort entity_ls7 = entity_ls.s6;
ushort entity_ls8 = entity_ls.s7;
ushort entity_ls9 = entity_ls.s8;
write_pipe_block(chan_GA2LS_LS1_energy, &LocalEneNext[entity_ls1]);
write_pipe_block(chan_GA2LS_LS2_energy, &LocalEneNext[entity_ls2]);
write_pipe_block(chan_GA2LS_LS3_energy, &LocalEneNext[entity_ls3]);
write_pipe_block(chan_GA2LS_LS4_energy, &LocalEneNext[entity_ls4]);
write_pipe_block(chan_GA2LS_LS5_energy, &LocalEneNext[entity_ls5]);
write_pipe_block(chan_GA2LS_LS6_energy, &LocalEneNext[entity_ls6]);
write_pipe_block(chan_GA2LS_LS7_energy, &LocalEneNext[entity_ls7]);
write_pipe_block(chan_GA2LS_LS8_energy, &LocalEneNext[entity_ls8]);
write_pipe_block(chan_GA2LS_LS9_energy, &LocalEneNext[entity_ls9]);
//printf("test point LS 2\n");
/*
mem_fence(CLK_CHANNEL_MEM_FENCE);
*/
__attribute__((xcl_pipeline_loop))
LOOP_GA_LS_INNER_WRITE_GENOTYPE:
for (uchar gene_cnt=0; gene_cnt<DockConst_num_of_genes; gene_cnt++) {
write_pipe_block(chan_GA2LS_LS1_genotype, &LocalPopNext[entity_ls1][gene_cnt & MASK_GENOTYPE]);
write_pipe_block(chan_GA2LS_LS2_genotype, &LocalPopNext[entity_ls2][gene_cnt & MASK_GENOTYPE]);
write_pipe_block(chan_GA2LS_LS3_genotype, &LocalPopNext[entity_ls3][gene_cnt & MASK_GENOTYPE]);
write_pipe_block(chan_GA2LS_LS4_genotype, &LocalPopNext[entity_ls4][gene_cnt & MASK_GENOTYPE]);
write_pipe_block(chan_GA2LS_LS5_genotype, &LocalPopNext[entity_ls5][gene_cnt & MASK_GENOTYPE]);
write_pipe_block(chan_GA2LS_LS6_genotype, &LocalPopNext[entity_ls6][gene_cnt & MASK_GENOTYPE]);
write_pipe_block(chan_GA2LS_LS7_genotype, &LocalPopNext[entity_ls7][gene_cnt & MASK_GENOTYPE]);
write_pipe_block(chan_GA2LS_LS8_genotype, &LocalPopNext[entity_ls8][gene_cnt & MASK_GENOTYPE]);
write_pipe_block(chan_GA2LS_LS9_genotype, &LocalPopNext[entity_ls9][gene_cnt & MASK_GENOTYPE]);
}
/*
mem_fence(CLK_CHANNEL_MEM_FENCE);
*/
//printf("test point LS 3\n");
float2 evalenergy_tmp1;
float2 evalenergy_tmp2;
float2 evalenergy_tmp3;
float2 evalenergy_tmp4;
float2 evalenergy_tmp5;
float2 evalenergy_tmp6;
float2 evalenergy_tmp7;
float2 evalenergy_tmp8;
float2 evalenergy_tmp9;
nb_pipe_status ls1_done = PIPE_STATUS_FAILURE;
nb_pipe_status ls2_done = PIPE_STATUS_FAILURE;
nb_pipe_status ls3_done = PIPE_STATUS_FAILURE;
nb_pipe_status ls4_done = PIPE_STATUS_FAILURE;
nb_pipe_status ls5_done = PIPE_STATUS_FAILURE;
nb_pipe_status ls6_done = PIPE_STATUS_FAILURE;
nb_pipe_status ls7_done = PIPE_STATUS_FAILURE;
nb_pipe_status ls8_done = PIPE_STATUS_FAILURE;
nb_pipe_status ls9_done = PIPE_STATUS_FAILURE;
__attribute__((xcl_pipeline_loop))
LOOP_WHILE_GA_LS_INNER_READ_ENERGIES:
while( (ls1_done != PIPE_STATUS_SUCCESS) ||
(ls2_done != PIPE_STATUS_SUCCESS) ||
(ls3_done != PIPE_STATUS_SUCCESS) ||
(ls4_done != PIPE_STATUS_SUCCESS) ||
(ls5_done != PIPE_STATUS_SUCCESS) ||
(ls6_done != PIPE_STATUS_SUCCESS) ||
(ls7_done != PIPE_STATUS_SUCCESS) ||
(ls8_done != PIPE_STATUS_SUCCESS) ||
(ls9_done != PIPE_STATUS_SUCCESS)
)
{
if (ls1_done != PIPE_STATUS_SUCCESS) {
ls1_done = read_pipe(chan_LS2GA_LS1_evalenergy, &evalenergy_tmp1);
}
else if (ls2_done != PIPE_STATUS_SUCCESS) {
ls2_done = read_pipe(chan_LS2GA_LS2_evalenergy, &evalenergy_tmp2);
}
else if (ls3_done != PIPE_STATUS_SUCCESS) {
ls3_done = read_pipe(chan_LS2GA_LS3_evalenergy, &evalenergy_tmp3);
}
else if (ls4_done != PIPE_STATUS_SUCCESS) {
ls4_done = read_pipe(chan_LS2GA_LS4_evalenergy, &evalenergy_tmp4);
}
else if (ls5_done != PIPE_STATUS_SUCCESS) {
ls5_done = read_pipe(chan_LS2GA_LS5_evalenergy, &evalenergy_tmp5);
}
else if (ls6_done != PIPE_STATUS_SUCCESS) {
ls6_done = read_pipe(chan_LS2GA_LS6_evalenergy, &evalenergy_tmp6);
}
else if (ls7_done != PIPE_STATUS_SUCCESS) {
ls7_done = read_pipe(chan_LS2GA_LS7_evalenergy, &evalenergy_tmp7);
}
else if (ls8_done != PIPE_STATUS_SUCCESS) {
ls8_done = read_pipe(chan_LS2GA_LS8_evalenergy, &evalenergy_tmp8);
}
else if (ls9_done != PIPE_STATUS_SUCCESS) {
ls9_done = read_pipe(chan_LS2GA_LS9_evalenergy, &evalenergy_tmp9);
}
}
#if defined (DEBUG_KRNL_LS)
printf("LS - got all eval & energies back\n");
#endif
float eetmp1 = evalenergy_tmp1.x;
float eetmp2 = evalenergy_tmp2.x;
float eetmp3 = evalenergy_tmp3.x;
float eetmp4 = evalenergy_tmp4.x;
float eetmp5 = evalenergy_tmp5.x;
float eetmp6 = evalenergy_tmp6.x;
float eetmp7 = evalenergy_tmp7.x;
float eetmp8 = evalenergy_tmp8.x;
float eetmp9 = evalenergy_tmp9.x;
uint eval_tmp1 = *(uint*)&eetmp1;
uint eval_tmp2 = *(uint*)&eetmp2;
uint eval_tmp3 = *(uint*)&eetmp3;
uint eval_tmp4 = *(uint*)&eetmp4;
uint eval_tmp5 = *(uint*)&eetmp5;
uint eval_tmp6 = *(uint*)&eetmp6;
uint eval_tmp7 = *(uint*)&eetmp7;
uint eval_tmp8 = *(uint*)&eetmp8;
uint eval_tmp9 = *(uint*)&eetmp9;
LocalEneNext[entity_ls1] = evalenergy_tmp1.y;
LocalEneNext[entity_ls2] = evalenergy_tmp2.y;
LocalEneNext[entity_ls3] = evalenergy_tmp3.y;
LocalEneNext[entity_ls4] = evalenergy_tmp4.y;
LocalEneNext[entity_ls5] = evalenergy_tmp5.y;
LocalEneNext[entity_ls6] = evalenergy_tmp6.y;
LocalEneNext[entity_ls7] = evalenergy_tmp7.y;
LocalEneNext[entity_ls8] = evalenergy_tmp8.y;
LocalEneNext[entity_ls9] = evalenergy_tmp9.y;
/*
#pragma ivdep
*/
__attribute__((xcl_pipeline_loop))
LOOP_FOR_GA_LS_INNER_READ_GENOTYPE:
for (uchar gene_cnt=0; gene_cnt<DockConst_num_of_genes; gene_cnt++) {
read_pipe_block(chan_LS2GA_LS1_genotype, &LocalPopNext[entity_ls1][gene_cnt & MASK_GENOTYPE]);
read_pipe_block(chan_LS2GA_LS2_genotype, &LocalPopNext[entity_ls2][gene_cnt & MASK_GENOTYPE]);
read_pipe_block(chan_LS2GA_LS3_genotype, &LocalPopNext[entity_ls3][gene_cnt & MASK_GENOTYPE]);
read_pipe_block(chan_LS2GA_LS4_genotype, &LocalPopNext[entity_ls4][gene_cnt & MASK_GENOTYPE]);
read_pipe_block(chan_LS2GA_LS5_genotype, &LocalPopNext[entity_ls5][gene_cnt & MASK_GENOTYPE]);
read_pipe_block(chan_LS2GA_LS6_genotype, &LocalPopNext[entity_ls6][gene_cnt & MASK_GENOTYPE]);
read_pipe_block(chan_LS2GA_LS7_genotype, &LocalPopNext[entity_ls7][gene_cnt & MASK_GENOTYPE]);
read_pipe_block(chan_LS2GA_LS8_genotype, &LocalPopNext[entity_ls8][gene_cnt & MASK_GENOTYPE]);
read_pipe_block(chan_LS2GA_LS9_genotype, &LocalPopNext[entity_ls9][gene_cnt & MASK_GENOTYPE]);
}
ls_eval_cnt += eval_tmp1 + eval_tmp2 + eval_tmp3 + eval_tmp4 + eval_tmp5 + eval_tmp6 + eval_tmp7 + eval_tmp8 + eval_tmp9;
#if defined (DEBUG_KRNL_LS)
printf("%u, ls_eval_cnt: %u\n", ls_ent_cnt, ls_eval_cnt);
printf("LS - got all genotypes back\n");
#endif
} // End of for-loop ls_ent_cnt
// ------------------------------------------------------------------
// Update current pops & energies
......@@ -794,7 +498,7 @@ void Krnl_GA(
}
// Update energy evaluations count: count LS and GG evals
eval_cnt += ls_eval_cnt + DockConst_pop_size;
eval_cnt += DockConst_pop_size;
// Update generation count
generation_cnt++;
......@@ -813,34 +517,10 @@ void Krnl_GA(
write_pipe_block(chan_GA2PRNG_BT_ushort_float_off, &tmp_int_one);
write_pipe_block(chan_GA2PRNG_GG_uchar_off, &tmp_int_one);
write_pipe_block(chan_GA2PRNG_GG_float_off, &tmp_int_one);
write_pipe_block(chan_GA2PRNG_LS123_ushort_off, &tmp_int_one);
write_pipe_block(chan_GA2PRNG_LS_float_off, &tmp_int_one);
write_pipe_block(chan_GA2PRNG_LS2_float_off, &tmp_int_one);
write_pipe_block(chan_GA2PRNG_LS3_float_off, &tmp_int_one);
write_pipe_block(chan_GA2PRNG_LS4_float_off, &tmp_int_one);
write_pipe_block(chan_GA2PRNG_LS5_float_off, &tmp_int_one);
write_pipe_block(chan_GA2PRNG_LS6_float_off, &tmp_int_one);
write_pipe_block(chan_GA2PRNG_LS7_float_off, &tmp_int_one);
write_pipe_block(chan_GA2PRNG_LS8_float_off, &tmp_int_one);
write_pipe_block(chan_GA2PRNG_LS9_float_off, &tmp_int_one);
/*
mem_fence(CLK_CHANNEL_MEM_FENCE);
*/
// Turn off LS kernels
write_pipe_block(chan_GA2LS_Off1_active, &tmp_int_one);
write_pipe_block(chan_GA2LS_Off2_active, &tmp_int_one);
write_pipe_block(chan_GA2LS_Off3_active, &tmp_int_one);
write_pipe_block(chan_GA2LS_Off4_active, &tmp_int_one);
write_pipe_block(chan_GA2LS_Off5_active, &tmp_int_one);
write_pipe_block(chan_GA2LS_Off6_active, &tmp_int_one);
write_pipe_block(chan_GA2LS_Off7_active, &tmp_int_one);
write_pipe_block(chan_GA2LS_Off8_active, &tmp_int_one);
write_pipe_block(chan_GA2LS_Off9_active, &tmp_int_one);
/*
mem_fence(CLK_CHANNEL_MEM_FENCE);
*/
// Turn off IGL_Arbiter, Conform, InterE, IntraE kernerls
write_pipe_block(chan_IGLArbiter_Off, &tmp_int_one);
......@@ -882,16 +562,6 @@ void Krnl_GA(
#include "Krnl_PRNG.cl"
#include "Krnl_LS.cl"
#include "Krnl_LS2.cl"
#include "Krnl_LS3.cl"
#include "Krnl_LS4.cl"
#include "Krnl_LS5.cl"
#include "Krnl_LS6.cl"
#include "Krnl_LS7.cl"
#include "Krnl_LS8.cl"
#include "Krnl_LS9.cl"
//#include "Krnl_IGL_Arbiter.cl"
#include "Krnl_IGL_SimplifArbiter.cl"
......
......@@ -37,125 +37,37 @@ void Krnl_IGL_Arbiter(/*unsigned char DockConst_num_of_genes*/
__attribute__((xcl_pipeline_loop))
LOOP_WHILE_IGL_MAIN:
while(active) {
nb_pipe_status Off_valid = PIPE_STATUS_FAILURE;
nb_pipe_status IC_valid = PIPE_STATUS_FAILURE;
nb_pipe_status GG_valid = PIPE_STATUS_FAILURE;
nb_pipe_status LS1_end_valid = PIPE_STATUS_FAILURE;
nb_pipe_status LS2_end_valid = PIPE_STATUS_FAILURE;
nb_pipe_status LS3_end_valid = PIPE_STATUS_FAILURE;
nb_pipe_status LS4_end_valid = PIPE_STATUS_FAILURE;
nb_pipe_status LS5_end_valid = PIPE_STATUS_FAILURE;
nb_pipe_status LS6_end_valid = PIPE_STATUS_FAILURE;
nb_pipe_status LS7_end_valid = PIPE_STATUS_FAILURE;
nb_pipe_status LS8_end_valid = PIPE_STATUS_FAILURE;
nb_pipe_status LS9_end_valid = PIPE_STATUS_FAILURE;
nb_pipe_status Off_valid = PIPE_STATUS_FAILURE;
nb_pipe_status IC_valid = PIPE_STATUS_FAILURE;
nb_pipe_status GG_valid = PIPE_STATUS_FAILURE;
int Off_active;
int IC_active;
int GG_active;
int LS1_end_active;
int LS2_end_active;
int LS3_end_active;
int LS4_end_active;
int LS5_end_active;
int LS6_end_active;
int LS7_end_active;
int LS8_end_active;
int LS9_end_active;
__attribute__((xcl_pipeline_loop))
LOOP_WHILE_IGL_INNER:
while (
(Off_valid != PIPE_STATUS_SUCCESS) &&
(IC_valid != PIPE_STATUS_SUCCESS) &&
(GG_valid != PIPE_STATUS_SUCCESS) &&
(LS1_end_valid != PIPE_STATUS_SUCCESS) &&
(LS2_end_valid != PIPE_STATUS_SUCCESS) &&
(LS3_end_valid != PIPE_STATUS_SUCCESS) &&
(LS4_end_valid != PIPE_STATUS_SUCCESS) &&
(LS5_end_valid != PIPE_STATUS_SUCCESS) &&
(LS6_end_valid != PIPE_STATUS_SUCCESS) &&
(LS7_end_valid != PIPE_STATUS_SUCCESS) &&
(LS8_end_valid != PIPE_STATUS_SUCCESS) &&
(LS9_end_valid != PIPE_STATUS_SUCCESS)
(GG_valid != PIPE_STATUS_SUCCESS)
){
Off_valid = read_pipe(chan_IGLArbiter_Off, &Off_active);
IC_valid = read_pipe(chan_GA2IGL_IC_active, &IC_active);
GG_valid = read_pipe(chan_GA2IGL_GG_active, &GG_active);
LS1_end_valid = read_pipe(chan_LS2Arbiter_LS1_end, &LS1_end_active);
LS2_end_valid = read_pipe(chan_LS2Arbiter_LS2_end, &LS2_end_active);
LS3_end_valid = read_pipe(chan_LS2Arbiter_LS3_end, &LS3_end_active);
LS4_end_valid = read_pipe(chan_LS2Arbiter_LS4_end, &LS4_end_active);
LS5_end_valid = read_pipe(chan_LS2Arbiter_LS5_end, &LS5_end_active);
LS6_end_valid = read_pipe(chan_LS2Arbiter_LS6_end, &LS6_end_active);
LS7_end_valid = read_pipe(chan_LS2Arbiter_LS7_end, &LS7_end_active);
LS8_end_valid = read_pipe(chan_LS2Arbiter_LS8_end, &LS8_end_active);
LS9_end_valid = read_pipe(chan_LS2Arbiter_LS9_end, &LS9_end_active);
}
active = (Off_valid == PIPE_STATUS_SUCCESS)? 0x00 : 0x01;
bool mode_LS_bool [9];
__attribute__((opencl_unroll_hint))
LOOP_FOR_IGL_INIT_MODE_LS_BOOL:
for(uchar i=0; i<9; i++) {
mode_LS_bool [i] = false;
}
// Determine "mode_LS_bool" value
// This considers all possible cases as all LS could be
// potentially producing genotypes simultaneously.
if (active == 0x01) {
if ((IC_valid != PIPE_STATUS_SUCCESS) && (GG_valid != PIPE_STATUS_SUCCESS)) {
if (LS1_end_valid == PIPE_STATUS_SUCCESS) {mode_LS_bool [0] = true; /*printf("LS1 valid!\n");*/}
if (LS2_end_valid == PIPE_STATUS_SUCCESS) {mode_LS_bool [1] = true; /*printf("LS2 valid!\n");*/}
if (LS3_end_valid == PIPE_STATUS_SUCCESS) {mode_LS_bool [2] = true; /*printf("LS3 valid!\n");*/}
if (LS4_end_valid == PIPE_STATUS_SUCCESS) {mode_LS_bool [3] = true; /*printf("LS4 valid!\n");*/}
if (LS5_end_valid == PIPE_STATUS_SUCCESS) {mode_LS_bool [4] = true; /*printf("LS5 valid!\n");*/}
if (LS6_end_valid == PIPE_STATUS_SUCCESS) {mode_LS_bool [5] = true; /*printf("LS6 valid!\n");*/}
if (LS7_end_valid == PIPE_STATUS_SUCCESS) {mode_LS_bool [6] = true; /*printf("LS7 valid!\n");*/}
if (LS8_end_valid == PIPE_STATUS_SUCCESS) {mode_LS_bool [7] = true; /*printf("LS8 valid!\n");*/}
if (LS9_end_valid == PIPE_STATUS_SUCCESS) {mode_LS_bool [8] = true; /*printf("LS9 valid!\n");*/}
}
} // End if (active == 0x01)
// Send "mode" to Conform
__attribute__((xcl_pipeline_loop))
LOOP_FOR_IGL_WRITE_MODE:
for (uchar j=0; j<9; j++) {
bool enable_write_channel = false;
char mode_tmp;
const char mode_Off = 0x00;
const char mode_IC = 'I';
const char mode_GG = 'G';
const char mode_LS [9] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09};
if (Off_valid == PIPE_STATUS_SUCCESS) {
enable_write_channel = (j==0)? true:false;
mode_tmp = mode_Off;
}
else if (IC_valid == PIPE_STATUS_SUCCESS) {
enable_write_channel = (j==0)? true:false;
mode_tmp = mode_IC;
}
else if (GG_valid == PIPE_STATUS_SUCCESS) {
enable_write_channel = (j==0)? true:false;
mode_tmp = mode_GG;
}
else{
if (mode_LS_bool[j] == true) {
enable_write_channel = true;
mode_tmp = mode_LS [j];