---
# System prepended metadata

title: Q1

---

# Q1
![](https://i.imgur.com/6w3q6Pb.png)

![](https://i.imgur.com/b95ewVg.png)

![](https://i.imgur.com/ecSKzeg.png)

![](https://i.imgur.com/veabPc4.png)
* **Q1-1**
As the vector width increase, the vector utilization rate decrease. Since that the ratio of vectorized process count plummet as the vector size growth and the data size remains the same so that the vectorized instruction count decreases, which results in the reduction of vector utilization.
# Q2
* **Q2-1**

**change**

    a = (float *)__builtin_assume_aligned(a, 16);
    b = (float *)__builtin_assume_aligned(b, 16);
    c = (float *)__builtin_assume_aligned(c, 16);
    
**to**

    a = (float *)__builtin_assume_aligned(a, 32);
    b = (float *)__builtin_assume_aligned(b, 32);
    c = (float *)__builtin_assume_aligned(c, 32);
* **Q2-2**
```
Running test1()...
Elapsed execution time of the loop in test1():
2.62589sec (N: 1024, I: 20000000)
109550043@ec037-072:~/part2$ cat normal.txt
Running test1()...
Elapsed execution time of the loop in test1():
8.28759sec (N: 1024, I: 20000000)
```
average Tserial = 8.3127266
average Tparallel = 1.4087599
S(speedup) = 8.3127266 / 1.4087599 = 5.9007405 (about 6)
float size: 4 byte
guess register width: 6*4*8 = 192 bit

* **Q2-3**
These two version are both mean to find the max between two vectors. Although there exists an operation to get max float value between two vectors, however, since compiler doesn't know what you do with c before if statement, it only translate the explicit if else pattern to vectorize instruction to ensure correctness.