игра брюс 2048
Главная / Программирование / Introduction to performance optimization using Intel SW tools / Тест 4

Introduction to performance optimization using Intel SW tools - тест 4

Упражнение 1:
Номер 1
 What is the Loop Stream Detector for?

Ответ:

 (1) for dividing big loops into a set of small 

 (2) for eliminating the loops 

 (3) for making small loops run faster 

 (4) for eliminating the sampling and decoding instructions for small loops 


Номер 2
 What is required for most of the loop optimizations

Ответ:

 (1) definite total iteration count 

 (2) no jumps outside the loop  

 (3) no if operators inside the loop 

 (4) no unknown function calls inside the loop 


Номер 3
 Choose code fragments which are good for optimizing

Ответ:

 (1) for(i=0;i<U;i++) a[i]=b[i];  

 (2) i=0; do { a[i]=b[i]; i++; } while(i<U); 

 (3) for(i=0;i<U;i++) { a[j]=b[i]; j+=c*i; } 

 (4) for(i=0;i<n;i++) { a[i]=i; if(i<t) break; } 


Упражнение 2:
Номер 1
 Loop invariant code motion

Ответ:

 (1) finding and deleting expressions independent from iteration variables 

 (2) finding and moving outside the loop expressions independent from loop iteration variables 

 (3) moves loop invariants to another loop 

 (4) none of the answers 


Номер 2
 Why performance is improved when invariant is moved out of the loop?

Ответ:

 (1) because invariant code has no sense and could be deleted 

 (2) because it is more effective to calculate them in another loop 

 (3) because this values stay unchanged each iteration and could be evaluated outside of the loop only once 


Номер 3
 What is loop invariant?

Ответ:

 (1) expression, independent of index variables 

 (2) expression, stay unchanged each iteration 

 (3) expression, used to check the condition for loop stop 

 (4) expression with global variables 


Упражнение 3:
Номер 1
 What optimization is inverse for loop fusion?

Ответ:

 (1) loop unswitching 

 (2) loop unfolding 

 (3) loop interchange 

 (4) loop unrolling 

 (5) loop distribution 


Номер 2
 Why performance could be increased after 
	the loop distribution?

Ответ:

 (1) because of memory reference improving 

 (2) because of loop iteration count decrease 

 (3) because of working with big arrays in parallel 


Номер 3
 What could be the reason for loosing performance
	while processing a big loop?

Ответ:

 (1) big amount of operations 

 (2) if the loop works with big amount of arrays it may cause cache splitting 

 (3) register splitting by big amount of iteration variables  


Упражнение 4:
Номер 1
 What is loop peeling?

Ответ:

 (1) optimization transforming a loop into two or more loops 

 (2) optimization tries to simplify loop by detaching useless iterations 

 (3) optimization tries to simplify loop by detaching extreme iterations 


Номер 2
 Choose the code resulting to the loop peeling for:
p = 10; 
for (i=0; i<10; ++i) { 
    y[i] = x[i] + x[p];
   p = i;
} 


Ответ:

 (1) p = 10; for (i=1; i<9; ++i) { y[i] = x[i] + x[p]; p = i; }  

 (2) y[0] = x[0] + x[10]; for (i=1; i<10; ++i) { y[i] = x[i] + x[i-1]; } 

 (3) y[0] = x[0] + x[10]; for (i=1; i<9; ++i) { y[i] = x[i] + x[i-1]; } 


Номер 3
 What is loop unrolling for?

Ответ:

 (1) to decrease conditional branches during the loop execution 

 (2) to divide a big loop into sequential small loops 

 (3) to decrease loop nesting 

 (4) to remove procedure calls 


Упражнение 5:
Номер 1
 How loop unrolling is provided?

Ответ:

 (1) big loop is divided into big number of small sequential loops 

 (2) by grouping small iterations into one big 

 (3) by substitution functions to the call sites 


Номер 2
 When full loop unrolling is applicable?

Ответ:

 (1) there's no such optimization 

 (2) to unroll small loops 

 (3) to unroll big loops 


Номер 3
 Choose the correct statements for this code: 
S1 PI = 3.14
S2 R  = 5
S3 AREA = PI*R **2

Ответ:

 (1) <S1,S2,S3> is equivalent to <S1,S3,S2>  

 (2) <S1,S2,S3> is equivalent to <S2,S1,S3> 

 (3) there is the dependency - <S1,S3>  

 (4) there is the dependency - <S1,S2> 

 (5) there is the dependency - <S2,S3> 


Упражнение 6:
Номер 1
 Choose the correct statements for the code: 
DO I=1,N
  S1 A(I) = B(I) + 1 
  S2 B(I+1) = A(I) – 5
END DO

Ответ:

 (1) there is the dependency - <S1,S2>  

 (2) there is loop dependency - <S2,S1> 

 (3) there is data dependency inside the loop 

 (4) there is control dependency inside the loop 

 (5) there is no dependencies inside the loop 


Номер 2
 Required condition for dependency between S1 and S2 are the following:

Ответ:

 (1) both of them use the same memory cell and modify it 

 (2) both of them use the same memory cell and at least one writes 

 (3) there is a path during the execution from S1 to S2 

 (4) there is no path during the execution from S1 to S2 


Номер 3
 What are normalized loops?

Ответ:

 (1) loop from 0 to N with step 1 

 (2) loop from 1 to N with any step 

 (3) loop from 1 to N with step 1 


Упражнение 7:
Номер 1
 When the dependency <S1,S2> is anti-dependence?

Ответ:

 (1) S1 X=… S2 …=X 

 (2) S1 …=X S2 X=… 

 (3) S1 X=… S2 X=… 


Номер 2
 When the dependence <S1,S2> is output-dependence

Ответ:

 (1) S1 X=… S2 …=X 

 (2) S1 …=X S2 X=… 

 (3) S1 X=… S2 X=… 


Номер 3
 When the dependence <S1,S2> is true dependence

Ответ:

 (1) S1 X=… S2 …=X 

 (2) S1 …=X S2 X=… 

 (3) S1 X=… S2 X=… 


Упражнение 8:
Номер 1
 What is iteration vector?

Ответ:

 (1) integer vector, each of the components represents an iteration variable value in order of loop nesting 

 (2) integer vector, each of the components represents an iteration variable value in order of increase 

 (3) integer vector, each of the components represents an iteration variable value after the iterations 


Номер 2
 
	What is required for loop dependency between S1 и S2 in a nested set?

Ответ:

 (1) statement S1 on iteration i, statement S2 on iteration j access the same memory cell 

 (2) one of them writes to this cell 

 (3) both of them writes to this cell 


Номер 3
 Normalized loops are used to?

Ответ:

 (1) simplify equations 

 (2) improve code readability 

 (3) to unify loops 


Упражнение 9:
Номер 1
 What is constant folding?

Ответ:

 (1) vector replace by scalar 

 (2) one of the scalar optimizations 

 (3) operation is inverse for vectorizing unfolding 

 (4) iteration dimension decrease 


Номер 2
 Loop optimizations are:

Ответ:

 (1) permutation transformations 

 (2) data transformation 

 (3) variable transformation 


Номер 3
 Is there any dependence in this code?
DO I=1,N
  S1 A(I+1) =F(I)
  S2 F(I+1) = A(I)
END DO

Ответ:

 (1) no dependence 

 (2) loop-carried dependence 

 (3) loop-independent dependence 


Номер 4
 Is there any dependence in this code?
DO I=1,N
  S1 A(I)=…
  S2 …=A(I)
END DO

Ответ:

 (1) no dependence 

 (2) loop-carried dependence 

 (3) loop-independent dependence 


Упражнение 10:
Номер 1
 What is FLOW dependency?

Ответ:

 (1) READ after WRITE 

 (2) WRITE after WRITE 

 (3) READ after READ 

 (4) WRITE after READ 


Номер 2
 What is OUTPUT dependency?

Ответ:

 (1) READ after WRITE 

 (2) WRITE after WRITE 

 (3) READ after READ 

 (4) WRITE after READ 


Номер 3
 What is ANTI dependency?

Ответ:

 (1) READ after WRITE 

 (2) WRITE after WRITE 

 (3) READ after READ 

 (4) WRITE after READ 




Главная / Программирование / Introduction to performance optimization using Intel SW tools / Тест 4