|
1 | 1 | # CacheLab |
2 | 2 |
|
| 3 | +## PartA Cache Simulator |
3 | 4 | 任务分解: |
4 | 5 | 1.程序参数的输入 |
5 | 6 | getopt function |
@@ -66,5 +67,48 @@ getopt用法 |
66 | 67 | } |
67 | 68 | } |
68 | 69 |
|
69 | | -test |
70 | | - |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | +## PartB Matrix Transpose |
| 74 | +目标是写出尽可能降低不命中率的倒置函数 |
| 75 | + |
| 76 | + char transpose_submit_desc[] = "Transpose submission"; |
| 77 | + void transpose_submit(int M, int N, int A[N][M], int B[M][N]); |
| 78 | + |
| 79 | +### 要求: |
| 80 | +- 编译没有警告 |
| 81 | +- 最多可以定义12个int 变量在每个倒置函数中 |
| 82 | +- 不能用迭代 |
| 83 | +- 如果用了helper functions ,helper functions 和 transpose func 加起来的变量不能超过12个 |
| 84 | +- 不能修改数组A |
| 85 | + |
| 86 | +### Evaluation For PartB |
| 87 | + |
| 88 | + • 32 × 32 (M = 32, N = 32) |
| 89 | + • 64 × 64 (M = 64, N = 64) |
| 90 | + • 61 × 67 (M = 61, N = 67) |
| 91 | + • 32 × 32: 8 points if m < 300, 0 points if m > 600 |
| 92 | + • 64 × 64: 8 points if m < 1, 300, 0 points if m > 2, 000 |
| 93 | + • 61 × 67: 10 points if m < 2, 000, 0 points if m > 3, 000 |
| 94 | + |
| 95 | +使用的cache规模是(s = 5, E = 1, b = 5). |
| 96 | + |
| 97 | + linux> make |
| 98 | + linux> ./test-trans -M 32 -N 32 |
| 99 | +### Working on PartB |
| 100 | + |
| 101 | +可以自己写多种版本的transfunctions,每个的格式如下: |
| 102 | + |
| 103 | + char trans_simple_desc[] = "A simple transpose"; |
| 104 | + void trans_simple(int M, int N, int A[N][M], int B[M][N]) |
| 105 | + { |
| 106 | + /* your transpose code here */ |
| 107 | + } |
| 108 | + -------------------------------------------------------------- |
| 109 | + registerTransFunction(trans_simple, trans_simple_desc); |
| 110 | + |
| 111 | +改进建议: |
| 112 | +1.因为是直接映射cache,所以冲突不命中是一个主要的问题 |
| 113 | +2.分块是一个好办法 |
| 114 | +3.可以使用./csim-ref -v -s 5 -E 1 -b 5 -t trace.f0 来查看具体的情况 |
0 commit comments