public void run() {
// generate test data
- int iter = 1000; //200;
+ int iter = 1200; //200;
int seed = 1967;
//Vector testdata = new Vector(iter);
FibHeap fh = new FibHeap();
public static final int kMaxTreeDepth;// = 16;
public TestRunner() {
- kStretchTreeDepth = 13;// 1Mb 18; // about 16Mb
- kLongLivedTreeDepth = 11; // 1/4Mb 16; // about 4Mb
- kArraySize = 125000/8; // 1/4Mb 500000; // about 4Mb
+ kStretchTreeDepth = 15;// 1Mb 18; // about 16Mb
+ kLongLivedTreeDepth = 14; // 1/4Mb 16; // about 4Mb
+ kArraySize = 125000; // 1/4Mb 500000; // about 4Mb
kMinTreeDepth = 4;
kMaxTreeDepth = 16;
}
//System.printString("task t1\n");
int threadnum = 62;
- int size = 30000;
+ int size = 20000;
int nodenum = size*10;
for(int i = 0; i < threadnum; ++i) {
TestRunner tr = new TestRunner(i, size, nodenum){run};
* @return The scene just created
*/
- Scene createScene() {
+ public Scene createScene() {
int x = 0;
int y = 0;
//System.printString("task t1\n");
int threadnum = 62;
- int size = threadnum * 25;
+ int size = threadnum * 30;
Composer comp = new Composer(threadnum, size){compose};
+ RayTracer rt = new RayTracer();
+ Scene scene = rt.createScene();
for(int i = 0; i < threadnum; ++i) {
- TestRunner tr = new TestRunner(i, threadnum, size){run};
+ TestRunner tr = new TestRunner(i, threadnum, size, scene){run};
}
taskexit(s{!initialstate});
public TestRunner(int id,
int numCore,
- int size) {
+ int size,
+ Scene scene) {
super();
this.id = id;
this.numCore = numCore;
this.size = size;
+ // create the objects to be rendered
+ this.scene = scene; //createScene();
+
// set image size
width=size;
height=size;
- this.image=new int[size][];
+ // get lights, objects etc. from scene.
+ setScene(this.scene);
- // create the objects to be rendered
- scene = createScene();
+ numobjects = this.scene.getObjects();
+ /*this.image=new int[size][];
// get lights, objects etc. from scene.
setScene(scene);
- numobjects = scene.getObjects();
+ numobjects = scene.getObjects();*/
}
+ public void init() {
+ this.image=new int[this.size][];
+ }
+
public void JGFvalidate() {
// long refval[] = {2676692,29827635};
// long refval[] = new long[2];
}
public void run() {
+ this.init();
int heightPerCore=height/numCore;
int startidx=heightPerCore * this.id;
CallGraph callGraph = new CallGraph(state);
Liveness liveness = new Liveness();
ArrayReferencees ar = new ArrayReferencees(state);
- OwnershipAnalysis oa = new OwnershipAnalysis(state,
+ OwnershipAnalysis oa = null; /*new OwnershipAnalysis(state,
tu,
callGraph,
liveness,
state.OWNERSHIPALLOCDEPTH,
state.OWNERSHIPWRITEDOTS,
state.OWNERSHIPWRITEALL,
- state.OWNERSHIPALIASFILE);
+ state.OWNERSHIPALIASFILE);*/
// synthesis a layout according to target multicore processor
MCImplSynthesis mcImplSynthesis = new MCImplSynthesis(state,
*((int *)bamboo_cur_msp) = 0;
}
#ifdef GC_PROFILE
- // TODO
- /*num_mapinforequest = 0;
- num_mapinforequest_i = 0;
- flushstalltime = 0;
- flushstalltime_i = 0;
- num_markrequest = 0;
- marktime = 0;*/
+ // TODO
+ /*num_mapinforequest = 0;
+ num_mapinforequest_i = 0;
+ flushstalltime = 0;
+ flushstalltime_i = 0;
+ num_markrequest = 0;
+ marktime = 0;*/
+ gc_num_livespace = 0;
+ gc_num_freespace = 0;
+ gc_num_lobj = 0;
+ gc_num_lobjspace = 0;
+#endif
+#ifdef GC_PROFILE_S
+ gc_num_profiles = NUMCORESACTIVE - 1;
#endif
} // void initGC()
inline bool cacheLObjs() {
// check the total mem size need for large objs
- int sumsize = 0;
+ unsigned long long sumsize = 0;
int size = 0;
#ifdef DEBUG
BAMBOO_DEBUGPRINT(0xe801);
tmp_host = gclobjtail2->hosts[gclobjtailindex2-1];
tmp_len = gclobjtail2->lengths[gclobjtailindex2 - 1];
sumsize += tmp_len;
+#ifdef GC_PROFILE
+ gc_num_lobj++;
+#endif
#ifdef DEBUG
BAMBOO_DEBUGPRINT_REG(gclobjtail2->lobjs[gclobjtailindex2-1]);
BAMBOO_DEBUGPRINT_REG(tmp_len);
}
} // while(gc_lobjmoreItems2())
+#ifdef GC_PROFILE
+ gc_num_lobjspace = sumsize;
+#endif
// check if there are enough space to cache these large objs
INTPTR dst = gcbaseva + (BAMBOO_SHARED_MEM_SIZE) -sumsize;
if(gcheaptop > dst) {
break;
}
} while(true);
+
+#ifdef GC_PROFILE
+ // check how many live space there are
+ gc_num_livespace = 0;
+ for(int tmpi = 0; tmpi < gcnumblock; tmpi++) {
+ gc_num_livespace += bamboo_smemtbl[tmpi];
+ }
+ gc_num_freespace = (BAMBOO_SHARED_MEM_SIZE) - gc_num_livespace;
+#endif
#ifdef DEBUG
BAMBOO_DEBUGPRINT(0xea08);
BAMBOO_DEBUGPRINT_REG(gcheaptop);
printf("(%x,%x) Start flush phase\n", udn_tile_coord_x(),
udn_tile_coord_y());
#endif
+#ifdef GC_PROFILE_S
+ /*BAMBOO_DEBUGPRINT(0xaaaa);
+ BAMBOO_DEBUGPRINT_REG(gc_num_obj);
+ BAMBOO_DEBUGPRINT_REG(gc_num_liveobj);
+ BAMBOO_DEBUGPRINT_REG(gc_num_forwardobj);
+ BAMBOO_DEBUGPRINT(0xaaab);*/
+ // send the num of obj/liveobj/forwardobj to the startupcore
+ if(STARTUPCORE != BAMBOO_NUM_OF_CORE) {
+ send_msg_4(STARTUPCORE, GCPROFILES, gc_num_obj,
+ gc_num_liveobj, gc_num_forwardobj, false);
+ }
+#endif // GC_PROFLIE_S
flush(stackptr);
#ifdef RAWPATH // TODO GC_DEBUG
printf("(%x,%x) Finish flush phase\n", udn_tile_coord_x(),
#ifdef RAWPATH // TODO GC_DEBUG
printf("(%x,%x) Finish gc!\n", udn_tile_coord_x(), udn_tile_coord_y());
#endif
-#ifdef GC_PROFILE_S
- BAMBOO_DEBUGPRINT(0xaaaa);
- BAMBOO_DEBUGPRINT_REG(gc_num_obj);
- BAMBOO_DEBUGPRINT_REG(gc_num_liveobj);
- BAMBOO_DEBUGPRINT_REG(gc_num_forwardobj);
- BAMBOO_DEBUGPRINT(0xaaab);
-#endif // GC_PROFLIE_S
} // void gc_collect(struct garbagelist * stackptr)
inline void gc_nocollect(struct garbagelist * stackptr) {
printf("(%x,%x) Start flush phase\n", udn_tile_coord_x(),
udn_tile_coord_y());
#endif
+#ifdef GC_PROFILE_S
+ /*BAMBOO_DEBUGPRINT(0xaaaa);
+ BAMBOO_DEBUGPRINT_REG(gc_num_obj);
+ BAMBOO_DEBUGPRINT_REG(gc_num_liveobj);
+ BAMBOO_DEBUGPRINT_REG(gc_num_forwardobj);
+ BAMBOO_DEBUGPRINT(0xaaab);*/
+ if(STARTUPCORE != BAMBOO_NUM_OF_CORE) {
+ send_msg_4(STARTUPCORE, GCPROFILES, gc_num_obj,
+ gc_num_liveobj, gc_num_forwardobj, false);
+ }
+#endif // GC_PROFLIE_S
flush(stackptr);
#ifdef RAWPATH // TODO GC_DEBUG
printf("(%x,%x) Finish flush phase\n", udn_tile_coord_x(),
#ifdef RAWPATH // TODO GC_DEBUG
printf("(%x,%x) Finish gc!\n", udn_tile_coord_x(), udn_tile_coord_y());
#endif
-#ifdef GC_PROFILE_S
- BAMBOO_DEBUGPRINT(0xaaaa);
- BAMBOO_DEBUGPRINT_REG(gc_num_obj);
- BAMBOO_DEBUGPRINT_REG(gc_num_liveobj);
- BAMBOO_DEBUGPRINT_REG(gc_num_forwardobj);
- BAMBOO_DEBUGPRINT(0xaaab);
-#endif // GC_PROFLIE_S
} // void gc_collect(struct garbagelist * stackptr)
inline void gc(struct garbagelist * stackptr) {
BAMBOO_DEBUGPRINT_REG(gc_num_obj);
BAMBOO_DEBUGPRINT_REG(gc_num_liveobj);
BAMBOO_DEBUGPRINT_REG(gc_num_forwardobj);
+ BAMBOO_DEBUGPRINT_REG(gc_num_profiles);
BAMBOO_DEBUGPRINT(0xaaab);
+ if(STARTUPCORE == BAMBOO_NUM_OF_CORE) {
+ BAMBOO_DEBUGPRINT(0xaaac);
+ BAMBOO_DEBUGPRINT_REG(gc_num_livespace);
+ BAMBOO_DEBUGPRINT_REG(gc_num_freespace);
+ BAMBOO_DEBUGPRINT(0xaaad);
+ }
#endif // GC_PROFLIE_S
} else if(BAMBOO_NUM_OF_CORE < NUMCORES4GC) {
gcprocessing = true;
if(!gc_infoOverflow) {
GCInfo* gcInfo = gc_infoArray[gc_infoIndex];
gcInfo->time[gcInfo->index++] = BAMBOO_GET_EXE_TIME();
+ gcInfo->time[gcInfo->index++] = gc_num_livespace;
+ gcInfo->time[gcInfo->index++] = gc_num_freespace;
+ gcInfo->time[gcInfo->index++] = gc_num_lobj;
+ gcInfo->time[gcInfo->index++] = gc_num_lobjspace;
gc_infoIndex++;
if(gc_infoIndex == GCINFOLENGTH) {
gc_infoOverflow = true;
GCInfo * gcInfo = gc_infoArray[i];
unsigned long long tmp = 0;
BAMBOO_DEBUGPRINT(0xddda);
- for(j = 0; j < gcInfo->index; j++) {
+ for(j = 0; j < gcInfo->index - 4; j++) {
BAMBOO_DEBUGPRINT(gcInfo->time[j]);
BAMBOO_DEBUGPRINT(gcInfo->time[j]-tmp);
BAMBOO_DEBUGPRINT(0xdddb);
}
tmp = (tmp-gcInfo->time[0]);
BAMBOO_DEBUGPRINT_REG(tmp);
- BAMBOO_DEBUGPRINT(0xdddc);
+ BAMBOO_DEBUGPRINT(0xdddc);
+ BAMBOO_DEBUGPRINT(gcInfo->time[gcInfo->index - 4]);
+ BAMBOO_DEBUGPRINT(gcInfo->time[gcInfo->index - 3]);
+ BAMBOO_DEBUGPRINT(gcInfo->time[gcInfo->index - 2]);
+ BAMBOO_DEBUGPRINT(gcInfo->time[gcInfo->index - 1]);
+ BAMBOO_DEBUGPRINT(0xddde);
totalgc += tmp;
}
- BAMBOO_DEBUGPRINT(0xdddd);
+ BAMBOO_DEBUGPRINT(0xdddf);
BAMBOO_DEBUGPRINT_REG(totalgc);
if(gc_infoOverflow) {
#define GCINFOLENGTH 100
typedef struct gc_info {
- unsigned long long time[8];
+ unsigned long long time[12];
int index;
} GCInfo;
GCInfo * gc_infoArray[GCINFOLENGTH];
int gc_infoIndex;
bool gc_infoOverflow;
+unsigned long long gc_num_livespace;
+unsigned long long gc_num_freespace;
+unsigned long long gc_num_lobjspace;
+unsigned int gc_num_lobj;
// TODO
/*unsigned long long flushstalltime;
unsigned int gc_num_liveobj;
unsigned int gc_num_obj;
unsigned int gc_num_forwardobj;
+int gc_num_profiles;
#endif // GC_PROFILE_S
#endif // GC_PROFILE
// + NUMCORES4GC bamboo_rmsp
// These three types of table are always reside at the bottom of the shared
// memory and will never be moved or garbage collected
+#ifdef GC_SMALLPAGESIZE
+#define BAMBOO_RMSP_SIZE (1024 * 1024)
+#else
#define BAMBOO_RMSP_SIZE (BAMBOO_SMEM_SIZE) // (45 * 16 * 1024)
+#endif
mspace bamboo_rmsp;
// shared pointer mapping tbl
//volatile struct GCSharedHash * gcsharedptbl;
GCLOBJREQUEST, // 0xF4
GCLOBJINFO, // 0xF5
GCLOBJMAPPING, // 0xF6
+#ifdef GC_PROFILE_S
+ GCPROFILES, // 0xF7
+#endif
#endif
MSGEND
} MSGTYPE;
#define BAMBOO_SMEM_SIZE (64 * 64) // (BAMBOO_PAGE_SIZE)
#define BAMBOO_SHARED_MEM_SIZE ((BAMBOO_PAGE_SIZE) *(BAMBOO_NUM_PAGES))
#else
+#ifdef GC_LARGESHAREDHEAP
+#define BAMBOO_NUM_PAGES (62*(2+7))
+#else
#define BAMBOO_NUM_PAGES (62*(2+3)) //(15 * 1024) //(64 * 4 * 0.75) //(1024 * 1024 * 3.5) 3G
+#endif
+#ifdef GC_LARGEPAGESIZE
#define BAMBOO_PAGE_SIZE (4 * 1024 * 1024) // (4096)
#define BAMBOO_SMEM_SIZE (4 * 1024 * 1024)
+#elif defined GC_SMALLPAGESIZE
+#define BAMBOO_PAGE_SIZE (256 * 1024) // (4096)
+#define BAMBOO_SMEM_SIZE (256 * 1024)
+#else
+#define BAMBOO_PAGE_SIZE (1024 * 1024) // (4096)
+#define BAMBOO_SMEM_SIZE (1024 * 1024)
+#endif // GC_LARGEPAGESIZE
#define BAMBOO_SHARED_MEM_SIZE ((BAMBOO_PAGE_SIZE) * (BAMBOO_NUM_PAGES)) //(1024 * 1024 * 240)
//((unsigned long long int)(3.0 * 1024 * 1024 * 1024)) // 3G
#endif // GC_DEBUG
#ifdef GC_PROFILE
gc_infoIndex = 0;
gc_infoOverflow = false;
+ gc_num_livespace = 0;
+ gc_num_freespace = 0;
#endif
#endif
numconfirm = 0;
gc_num_obj = 0;
gc_num_liveobj = 0;
gc_num_forwardobj = 0;
+ gc_num_profiles = NUMCORESACTIVE - 1;
#endif
#else
// create the lock table, lockresult table and obj queue
#ifdef MULTICORE_GC
case GCFINISHMARK:
case GCMOVESTART:
+#ifdef GC_PROFILE_S
+ case GCPROFILES:
+#endif
#endif
{
msglength = 4;
//MGCHashadd_I(gcpointertbl, data1, data2);
mgcsharedhashInsert_I(gcsharedptbl, data1, data2);
}
+
+#ifdef GC_PROFILE_S
+INLINE void processmsg_gcprofiles_I() {
+ int data1 = msgdata[msgdataindex];
+ MSG_INDEXINC_I();
+ int data2 = msgdata[msgdataindex];
+ MSG_INDEXINC_I();
+ int data3 = msgdata[msgdataindex];
+ MSG_INDEXINC_I();
+ gc_num_obj += data1;
+ gc_num_liveobj += data2;
+ gc_num_forwardobj += data3;
+ gc_num_profiles--;
+}
+#endif
#endif // #ifdef MULTICORE_GC
// receive object transferred from other cores
break;
} // case GCLOBJMAPPING
+#ifdef GC_PROFILE_S
+ case GCPROFILES: {
+ // received a gcprofiles msg
+ processmsg_gcprofiles_I();
+ break;
+ }
+#endif
#endif // #ifdef MULTICORE_GC
default:
echo "-gccache_ran set the gc shared memory cache strategy as random (should be used together with -multicoregc)"
echo "-gccontroller_near set the gc shared memory to use the nearest controller for each core (should be used together with -multicoregc)"
echo "-gccontroller_remote set the gc shared memory to use a remote controller for each core (should be used together with -multicoregc)"
+echo "-gcsmallpagesize set the gc shared memory to use small page size (should be used together with -multicoregc)"
+echo "-gclargepagesize set the gc shared memory to use large page size (should be used together with -multicoregc)"
+echo "-gclargesharedheap set the gc shared memory as large (should be used together with -multicoregc)"
echo -gcprofile build with gcprofile options
echo -gcprofile_s build with gcprofile_s options
echo -accurateprofile build with accurate profile information including pre/post task processing info
GCCACHERANFLAG=false;
GCCONTROLLERNEARFLAG=false;
GCCONTROLLERREMOTEFLAG=false;
+GCSMALLPAGESIZEFLAG=false;
+GCLARGEPAGESIZEFLAG=false;
+GCLARGESHAREDHEAPFLAG=false;
USEDMALLOC=false
THREADFLAG=false
FASTCHECK=false
elif [[ $1 = '-gccontroller_remote' ]]
then
GCCONTROLLERREMOTEFLAG=true
+elif [[ $1 = '-gcsmallpagesize' ]]
+then
+GCSMALLPAGESIZEFLAG=true
+elif [[ $1 = '-gclargepagesize' ]]
+then
+GCLARGEPAGESIZEFLAG=true
+elif [[ $1 = '-gclargesharedheap' ]]
+then
+GCLARGESHAREDHEAPFLAG=true
elif [[ $1 = '-dmalloc' ]]
then
USEDMALLOC=true
TILERACFLAGS="${TILERACFLAGS} -DCONTROLLER_REMOTE"
fi
+if $GCSMALLPAGESIZEFLAG
+then # GC_SMALLPAGESIZE version
+TILERACFLAGS="${TILERACFLAGS} -DGC_SMALLPAGESIZE"
+fi
+
+if $GCLARGEPAGESIZEFLAG
+then # GC_LARGEPAGESIZE version
+TILERACFLAGS="${TILERACFLAGS} -DGC_LARGEPAGESIZE"
+fi
+
+if $GCLARGESHAREDHEAPFLAG
+then # GC_LARGESHAREDHEAP version
+TILERACFLAGS="${TILERACFLAGS} -DGC_LARGESHAREDHEAP"
+fi
+
+
cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$MAKEFILE ./Makefile
if $TILERABMEFLAG
then # TILERABMEFLAG