Friday, May 21, 2010

ACA 2010 MEng

This examination is partly based on the Intel Nehalem processor architecture, as
described in the article “Nehalem: Intel’s Future Processor and System”, by David
Kanter (Real World Technologies, 04-02-2008), which you should have available to
you in the examination. Where the article is incomplete, you are invited to speculate
using your understanding of the underlying architectural principles.


1a
Which parts of Nehalem’s branch predictor need to be replicated for each thread?

Another improved branch target prediction mechanism in Nehalem is the return stack buffer (RSB). When a function is called, the RSB records the address, so that when the function is returned, it will just pick up where it left off instead of ending up at the wrong address. A RSB can overflow if too many functions are called recursively and it can also get corrupted and produce bad return addresses if the branch predictor speculates down a wrong path. Nehalem actually renames the RSB, which avoids return stack overflows, and ensures that most misspeculation does not corrupt the RSB. There is a dedicated RSB for each thread to avoid any cross-contamination.

return stack buffer
b
Nehalem’s branch prediction may lead to branch execution time ranging from
zero cycles to many. What is the branch execution time when a level-1 BTB hit
occurs?

when we have a btb hit, BTB will predict the target PC address, this means that we can perform branch prediction in the fetch stage.

if we predict branches in the decode stage, there is one cycle of wasted fetch after every branch instruction, because we don't know what we're supposed to be fetching until the branch finishes decode. if we predict branches in the fetch stage, there are no cycles of wasted fetch.


c
What is the worst case?

BTB hit but miss prediction.


d
What intermediate cases might occur?

BTB miss, but a taken branch.

2a
What happens when Nehalem’s ROB is full?

when ROB is full, we stop issuing instructions until an entry is made free.

The 128 entry ROB is statically partitioned between both threads, which allows each thread to speculate equally far through the instruction stream.


b
What two things happen in the Nehalem microarchitecture when an instruction is
committed?

once an instruction commits, the entry in ROB is reclaimed and the register or memory destination is updated.

if speculation was wrong, ROB is flushed and execution is restarted at the correct successor of the branch.


c
Nehalem’s level-1 data cache has an access latency of four cycles. If this were
increased, for example to six, its capacity could be much larger. What would be
the disadvantages of doing this?

cache latency increase will result the longer execution time for load/store operation, therefore we trade-off the memory bandwidth to capacity,for small number of threads running, the competition for cache is relatively low, therefore the memory bandwidth will result as the bottle neck of the performance.

3
Consider the following code fragment:
float A[N],B[N],C[N];
S1:
for (i=0; i<N; i++) {
S2
if (A[i] > 0) {
S3:
C[i] = A[i] + B[i];
}
}
a
Explain (in outline terms) how this loop could be executed using SSE
instructions.

SSE originally added eight new 128-bit registers known as XMM0 through XMM7.

pseudo code for SSE

for i=0:N/4

A[i*4:i*4+3]-> xmm0

B[i*4:i*4+3]-> xmm1

if(xmm0 >0)

xmm0=xmm0+xmm1;

xmm0->C[i*4:i*4+3]

end

-----------------------------

instruction used

movaps, addps


b
It has been proposed that the SSE-like instructions in some future designs might
operate on much longer registers.
(i) What performance advantage might arise, in suitable applications?
(ii) What problem arises with the example above? How might it be minimised,
in suitable applications?

(i) the future AVX (advanced vector extension) has increased the SIMD vector register from 128 bits to 256 bits. this will double the amount of data parallelism for vector computation. Suitable for floating point-intensive calculations in multimedia, scientific and financial applications.

(ii) the conditional execution which compare the vector register will take longer time since the length has increased. in some cases, we can preprocess the data vector such that the conditional execution can be eliminated.

loop stream detector

The loop stream detector is located inside the IDQ to improve power consumption
and front end efficiency for loops with a short sequence of instructions.
The instruction decoder supports micro-fusion to improve front end throughput,
increase the effective size of queues in the scheduler and re-order buffer (ROB). The
rules for micro-fusion are similar to those of Intel Core microarchitecture.
The instruction queue also supports macro-fusion to combine adjacent instructions
into one micro-ops where possible. In previous generations of Intel Core microarchitecture,
macro-fusion support for CMP/Jcc sequence is limited to the CF and ZF flag,
and macrofusion is not supported in 64-bit mode.

写在毕业

毕业,这天终于来了.

如果光阴似箭,那么岁月就是时间流逝的升华.

如果人生如戏,那么岁月就是生命存在的感悟.

想说的话,该说的话,现在也是时候了. 现在做个总结,等32岁时再来看看自己.

关于生活

4年之前,我天真地带着理想和热情,来到了IC,就像是块烧红了的生铁,有着激动的能量.

4年之后,我冷静地带着理想和热情,离开了IC,就像是块锤炼了的精钢,有着坚毅的品质.

这几年的生活,对我来说,绝对可以说是人生的无价财富, 大到人生意义,小到做事为人,我感到自己的思路更加清晰了.

关于理想

以前的理想就是创业,现在虽然是理想未变,可是对创业的理解却有了天地之别.

以前对创业的理解,无非是功名成就,有一份富裕的家业.至于能否饮水思源,那就看自己有没有必要.

而现在的理解,是实现能够创造价值的理想.

关于友情

关于友情,以前的看法是,物以类聚,人以群分,总是以为自己努力上进,专研学术,自然就有人喜欢.

可是后来才发现,这种看法其实只对了一半,物以类聚,人以群分是没错,可是友情其实源自内心的联系,一个有情有义的联系.

很多时候,个人的实力只是一个建立友情的开始.而真正的感情,确是建立在相互的依靠.

所以要学会更多的与人交流,了解别人的内心,表达自己的情感. 让朋友可以依靠和信任.

关于爱情

一个Geek 的内心

曾几何时,我们都是一群天真的孩子,对世界和社会的好奇让们有了自己的思想.

沟通

言语,表情,行动.

交流

同步,异步,随机

识人

长短,习性,理想

用人

天时,地利,人和

管理

松紧,规矩,原则

回报

无私,感恩,循环