From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <199812010624.PAA02425@et.u-tokai.ac.jp> Date: Tue, 1 Dec 1998 15:24:27 +0900 (JST) From: naohiko shimizu Subject: Re: Questions on performance methods In-Reply-To: <199811300254.LAA26438@et.u-tokai.ac.jp> In article <9811301409.AA28540@liszt.amt.tay1.dec.com> gorton@amt.tay1.dec.com writes: >> >> Naohiko Shimizu wrote: >> >> >But I myself is not comfortable with 21264, because it does not >> >improve the peak floating point performance from 21164. The 21364 >> >will use the same core with 21264 and then we cannot expect >> >outperformed performance with these chips. >> >> If by 'peak floating point performance' you mean "number of floating >> point instructions issued/cycle" then this is a correct statement. >> >> However, since it is an out-of-order machine, the actual elapsed time >> to complete a job can be significantly less on a 21264 machine than on >> a 21164 machine with the same clock rate. >> Rick, if you feel that my post was miss leading for general users, please excuse me. As I wrote, we can retrieve full power of 21264 with higher level languages and it will be very nice for general. The chip is well designed, I think. But I wonder that if 21164A uses same process rule, it will mark higher clock rating. And the easy optimizable routine may have higher performance with (enhanced) 21164A. >> Additionally, the number of cycles to execute some FP operations is >> significantly better on the 21264 vs. the 21164 (i.e. divide) >> The addition of instructions in the architecture to perform SQRT >> (among other items) will result in additional performance gains. I think multiply-accumulate type instruction is usefull for many applicatoins, wouldn't you disscussed to include such instructions? In article <19981130095516.B4303@keksy.mchp.siemens.de> martin.kahlert@mchp.siemens.de writes: >> Is it very stupid to ask what TLB and MAF means? >> Sorry, to aks that silly questions. TLB is reffered as DTB in the Digital documentations. It is a data address translation buffer to support virtual addressing, and no load can be issued behind DTB miss. Because, if DTB miss occured the processor must check page table in the main memory to decide whether an page fault interrupt may or may not be occured. The interrupt must be precise and all instructions issued behind the load must be cancelled. Then shortage of DTB cause performance degradation. I think 21164A could have 1024 two way DTB with a few victim entries, instead of full associative 64 entries DTB. The combination of Miss Address File(MAF) and pipelined Scache(L2 cache) is the key point to get higher performance with 21164(A). I will explain a little more: 21164(A) is not an out-of-order processor, but only the load instruction can be treated as out-of-order with MAF. There are 5 MAF in 21164(A), and each can hold a cache miss load address. Then we can issue 5 independent address load which does not hit the cache without stall. And four of them can have upto four miss load which share the same cache line. So we can issue upto 21 miss load without stall. Additionaly, Scache can handle L2->L1 cache block transfer as a pipeline. The latency of Scache is 12 cycles, and if the loop is longer than 12, the code will not stall for cache miss as far as Scache hit. If Scache miss is occured, only two outstanding loads is allowed. (21164PC can issue three outstanding loads, and 21264 will have eight.) Then we need to control where the outstanding loads will be placed. The basics are the same for 21264, and carefully designed program will mark higher performance even for out-of-order processors. BTW, when will the hardware refference manual for 21264 will be released? Typical high performance programs for 21164(A) can be organized as following. 21164(A) can issue two load per cycle, and this code is software pipelined. foo:        load A[i+0] load A[i+1]        load A[i+2] load A[i+3]        load B[i+0] load B[i+1]        load B[i+2] load B[i+3]        load C[i+0] load C[i+1]        load C[i+2] load C[i+3]        load D[i+0] load D[i+1]        load D[i+2] load D[i+3] loop:        execute something with A,B,C,D        load A[i+4] load A[i+5]        load A[i+6] load A[i+7]        load B[i+4] load B[i+5]        load B[i+6] load B[i+7]        load C[i+4] load C[i+5]        load C[i+6] load C[i+7]        load D[i+4] load D[i+5]        load D[i+6] load D[i+7]        update i by 4        goto loop In article <199811300254.LAA26438@et.u-tokai.ac.jp> nshimizu@et.u-tokai.ac.jp writes: >> If the N is large (N > 10000), the code I and Goto wrote will use too much >> memory traffic. Then we still have a chance to improve the >> performance with blocking. Last night it was almost 3am in localtime >> when I read the mail, and I had not enough time to code. >> I tune the code with prefetching and code optimization. This may be my final for this problem. The q[] should have at least additional 9 dummy entiries for prefetching. Use gcc/egcs to compile the code.(still not debuged) ---------------------------------------------------------------------------- #define BLOCKINGSIZE 1000 #define prefetch(x) asm volatile ("ldt $f31,%0" :: "m"((x))) void dsqrtiv(double *, double *, int); double find_jastrow_sub(double *vtemp, double b, int count) {   int i;   double tmp0,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6,tmp7;   double vtmp[8];     dsqrtiv(vtemp, vtemp, count); /* Unrolling and software pipelining the loop. 8 times unrolling is enough for the Scache pipeline. */     i = 0;     tmp0 = tmp1 = tmp2 = tmp3 =     tmp4 = tmp5 = tmp6 = tmp7 = 1.0;     vtmp[0] = vtemp[i];     vtmp[1] = vtemp[i+1];     vtmp[2] = vtemp[i+2];     vtmp[3] = vtemp[i+3];     vtmp[4] = vtemp[i+4];     vtmp[5] = vtemp[i+5];     vtmp[6] = vtemp[i+6];     vtmp[7] = vtemp[i+7];     for(i=0;i < count-8; i+=8){           tmp0 *= (1.0 - b * vtmp[0]);           tmp1 *= (1.0 - b * vtmp[1]);           tmp2 *= (1.0 - b * vtmp[2]);           tmp3 *= (1.0 - b * vtmp[3]);           tmp4 *= (1.0 - b * vtmp[4]);           tmp5 *= (1.0 - b * vtmp[5]);           tmp6 *= (1.0 - b * vtmp[6]);           tmp7 *= (1.0 - b * vtmp[7]);           vtmp[0] = vtemp[i+8];           vtmp[1] = vtemp[i+9];           vtmp[2] = vtemp[i+10];           vtmp[3] = vtemp[i+11];           vtmp[4] = vtemp[i+12];           vtmp[5] = vtemp[i+13];           vtmp[6] = vtemp[i+14];           vtmp[7] = vtemp[i+15];     } /* The rest of the loop will be here. */     for(i=0;i < count - i;i++)           tmp0 *= (1.0 - b * vtmp[i]);     return tmp0*tmp1*tmp2*tmp3*tmp4*tmp5*tmp6*tmp7;   } int find_jastrow(double *result,int j,struct coord *q,double r[3],double b){   int i,vcnt;   double tmp, tmp1, tmp2, tmp3;   double t1, t2, t3;   double r1, r2, r3;   double bp2;   double vtemp[BLOCKINGSIZE+16];   r1 = r[0];   r2 = r[1];   r3 = r[2];      tmp = 1.0;   vcnt = 0;   bp2 = b*b;   if(b>0){ /*  To reduce inner loop conditional branch, I separate the loop.  This may not be required if the compiler is smart enough.  When b**2 < rij, we should return immediately, without calling sqrt.  Then I add one conditional branch *_*. */     i = 0;     tmp1 = q[i].x[0]-r1;     tmp2 = q[i].x[1]-r2;     tmp3 = q[i].x[2]-r3;     for(i=0;i < j;i++){         t1 = tmp1*tmp1;         t2 = tmp2*tmp2;         t3 = tmp3*tmp3;         tmp1 = q[i+1].x[0]-r1;         tmp2 = q[i+1].x[1]-r2;         tmp3 = q[i+1].x[2]-r3;         prefetch(q[i+9].x[0]);         if((vtemp[vcnt++] = t1 + t2 + t3) > bp2) {              *result = 0.0;              return 0;         }         if(vcnt >= BLOCKINGSIZE) {              tmp *= find_jastrow_sub(vtemp, b, vcnt);              vcnt = 0;         }       }     tmp1 = q[j+1].x[0]-r1;     tmp2 = q[j+1].x[1]-r2;     tmp3 = q[j+1].x[2]-r3;     for(i=j+1;i < N;i++){         t1 = tmp1*tmp1;         t2 = tmp2*tmp2;         t3 = tmp3*tmp3;         tmp1 = q[i+1].x[0]-r1;         tmp2 = q[i+1].x[1]-r2;         tmp3 = q[i+1].x[2]-r3;         prefetch(q[i+9].x[0]);         if((vtemp[vcnt++] = t1 + t2 + t3) > bp2) {              *result = 0.0;              return 0;         }         if(vcnt >= BLOCKINGSIZE) {              tmp *= find_jastrow_sub(vtemp, b, vcnt);              vcnt = 0;         }       }     tmp *= find_jastrow_sub(vtemp, b, vcnt);   }   *result = tmp;   return 1; } Naohiko Shimizu Dept. Communication Engr./Univ. TOKAI. 1117 Kitakaname Hiratsuka 259-12 Japan TEL.+81-463-58-1211(ext. 4084) FAX.+81-463-58-8320