加勒比久久综合,国产精品伦一区二区,66精品视频在线观看,一区二区电影

合肥生活安徽新聞合肥交通合肥房產生活服務合肥教育合肥招聘合肥旅游文化藝術合肥美食合肥地圖合肥社保合肥醫院企業服務合肥法律

代做Computer Architecture、代寫Gem5 編程

時間:2024-06-08  來源:合肥網hfw.cc  作者:hfw.cc 我要糾錯



Computer Architecture
2024 Spring
Final Project Part 2Overview
Tutorial
● Gem5 Introduction
● Environment Setup
Projects
● Part 1 (5%)
○ Write C++ program to analyze the specification of L1 data cache.
● Part 2 (5%)
○ Given the hardware specifications, try to get the best performance for more 
complicated program.
2Project 2
3In this project, we will use a two-level cache 
computer system. Your task is to write a 
ViT(Vision Transformer) in C++ and optimize it. 
You can see more details of the system 
specification on the next page.
Description
4System Specifications
● ISA: X86
● CPU: TimingSimpleCPU (no pipeline, CPU stalls on every memory request)
● Caches
* L1 I cache and L1 D cache connect to the same L2 cache
● Memory size: 8192MB
5
I cache 
size
I cache 
associativity
 D cache 
size
D cache 
associativity
Policy Block size
L1 cache 16KB 8 16KB 4 LRU **B
L2 cache – – 1MB 16 LRU **BViT(Vision Transformer) – Transformer Overview
6
● A basic transformer block consists of 
○ Layer Normalization
○ MultiHead Self-Attention (MHSA) 
○ Feed Forward Network (FFN)
○ Residual connection (Add)
● You only need to focus on how to 
implement the function in the red box
● If you only want to complete the project 
instead of understanding the full 
algorithm about ViT, you can skip the 
section masked as redViT(Vision Transformer) – Image Pre-processing
7
● Normalize, resize to (300,300,3) and center crop to (224,224,3)ViT(Vision Transformer) – Patch Encoder
8
● In this project, we use Conv2D as Patch 
Encoder with kernel_size = (16,16), stride = 
(16,16) and output_channel = 768
● (224,224,3) -> (14,14, 16*16*3) -> (196, 768)ViT(Vision Transformer) – Class Token
9
● Now we have 196 tokens and each 
token has 768 features
● In order to record global information, we 
need concatenate one learnable class 
token with 196 tokens
● (196,768) -> (197,768)ViT(Vision Transformer) – Position Embedding
10
● Add the learnable position information 
on the patch embedding
● (197,768) + 
position_embedding(197,768) -> 
(197,768)ViT(Vision Transformer) – Layer Normalization
11
T
# of tokens
C
embedded dimension
● Normalize each token
● You need to normalize with the formulaAttention
ViT(Vision Transformer) – MultiHead Self Attention (1)
12
● Wk
, Wq
, Wv 
∈ RC✕C
● b
q
 , bk
, bv
∈ RC
● W

∈ RC✕C
 
● b
o
 ∈ RC
Input
Linear
Projection
X Attention
split 
into 
heads
merge 
heads
Output
Linear
Projection
Y
Wk
, Wq
, Wv W

b
q
 , bk
, bv b
o
 ViT(Vision Transformer) – MultiHead Self Attention (2)
13
T
# of tokens
C
embedded dimension
● Get Q, K, V ∈ RT✕(NH*H) after input linear projection
● Split Q, K, V into Q1
, Q2
, Q3
,..., QNH K1
, K2
, K3
,..., KNH V1
, V2
, V3
,..., VNH 
∈ RT✕H
H
hidden dimension
Linear Projection and split into heads
Linear Projection
Q = XWq
T
 + b
q
K = XWk
T
 + bk
V = XW
v
T
 + b
v
NH
# of head C = H * NHViT(Vision Transformer) – MultiHead Self Attention (2)
14
● For each head i, compute Si
 = QiKi
T
/square_root(H) ∈ RT✕T
● Pi = Softmax(Si
 ) ∈ RT✕T
, Softmax is a row-wise function
● Oi = Pi Vi ∈ RT✕H
Matrix
Multiplication
and scale
Qi
Ki
Softmax
Matrix
Multiplication Vi
Oi
SoftmaxViT(Vision Transformer) – MultiHead Self Attention (3)
15
T
# of tokens
C
embedded dimension
● Oi ∈ RT✕H
, O = [O1
, O2
,...,O2
 ]
H
hidden dimension
merge heads and Linear Projection
Linear Projection
output = OWo
T
 + b
o
NH
# of headViT(Vision Transformer) – Feed Forward Network
16
● Get Q, K, V ∈ RT✕(h*H) after input linear projection
● Split Q, K, V into Q1
, Q2
, Q3
,..., Qh
 K1
, K2
, K3
,..., Kh V1
, V2
, V3
,..., Vh ∈ RT✕H
T
# of tokens
C
embedded dimension
Input
Linear
Projection
T
# of tokens
OC
hidden dimension
GeLU
output
Linear
ProjectionViT(Vision Transformer) – GeLU
17ViT(Vision Transformer) – Classifier
18
● Contains a Linear layer to transform 768 features to 200 class
○ (197, 768) -> (197, 200)
● Only refer to the first token (class token)
○ (197, 200) -> (1, 200)ViT(Vision Transformer) – Work Flow
19
Pre-pocessing
Embedder
Transformer x12
Classifier
m5_dump_init
Load_weight
m5_dump_stat
Argmax
layernorm
MHSA
layernorm
FFN
matmul
attention
matmul
matmul
layernorm
matmul
Black footed Albatross
+
+
gelu
matmul
gelu
$ make gelu_tb
$ make matmul_tb
$ make layernorm_tb
$ make MHSA_tb
$ make feedforward_tb
 $ make transformer_tb
$ run_all.sh
layernorm
layernorm
MHSA
residualViT(Vision Transformer) – Shape of array
20
layernorm token 1 token 2 …… token T
C
input/output [T*C]
MHSA input/output/o [T*C]
MHSA qkv [T*3*C] q token 1
C
k token 1 v token 1 …… q token T k token T v token T
feedforward input/output [T*C]
feedforward gelu [T*OC] token 1
OC
token 2 …… token TCommon problem
21
● Segmentation fault
○ ensure that you are not accessing a nonexistent memory address
○ Enter the command $ulimit -s unlimited All you have to do is
22
● Download TA’s Gem5 image
○ docker pull yenzu/ca_final_part2:2024
● Write C++ with understanding the algorithm in ./layer folder
○ make clean
○ make <layer>_tb
○ ./<layer>_tbAll you have to do is
23
● Ensure the ViT will successfully classify the bird
○ python3 embedder.py --image_path images/Black_Footed_Albatross_0001_796111.jpg 
--embedder_path weights/embedder.pth --output_path embedded_image.bin
○ g++ -static main.cpp layer/*.cpp -o process
○ ./process
○ python3 run_model.py --input_path result.bin --output_path torch_pred.bin --model_path 
weights/model.pth
○ python3 classifier.py --prediction_path torch_pred.bin --classifier_path 
weights/classifier.pth
○ After running the above commands, you will get the following top5 prediction.
● Evaluate the performance of part of ViT, that is layernorm+MHSA+residual
○ Need about 3.5 hours to finish the simulation
○ Check stat.txtGrading Policy
24
● (50%) Verification
○ (10%) matmul_tb
○ (10%) layernorm_tb
○ (10%) gelu_tb
○ (10%) MHSA_tb
○ (10%) transformer_tb
● (50%) Performance
○ max(sigmoid((27.74 - student latency)/student latency))*70, 50)
● You will get 0 performance point if your design is not verified.Submission
● Please submit code on E3 before 23:59 on June 20, 2024.
● Late submission is not allowed.
● Plagiarism is forbidden, otherwise you will get 0 point!!!
25
● Format
○ Code: please put your code in a folder 
named FP2_team<ID>_code and compress 
it into a zip file.
2
2
2FP2_team<ID>_code folder 
26
● You should attach the following documents
○ matmul.cpp
○ layernorm.cpp
○ gelu.cpp
○ attention.cpp
○ residual.cpp

請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp



















 

掃一掃在手機打開當前頁
  • 上一篇:代做QBUS3600、代寫Python設計程序
  • 下一篇:哪些人可以辦理菲律賓團簽呢(跟團簽的材料)
  • 無相關信息
    合肥生活資訊

    合肥圖文信息
    2025年10月份更新拼多多改銷助手小象助手多多出評軟件
    2025年10月份更新拼多多改銷助手小象助手多
    有限元分析 CAE仿真分析服務-企業/產品研發/客戶要求/設計優化
    有限元分析 CAE仿真分析服務-企業/產品研發
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發動機性能
    挖掘機濾芯提升發動機性能
    海信羅馬假日洗衣機亮相AWE  復古美學與現代科技完美結合
    海信羅馬假日洗衣機亮相AWE 復古美學與現代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
  • 短信驗證碼 目錄網 排行網

    關于我們 | 打賞支持 | 廣告服務 | 聯系我們 | 網站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網 版權所有
    ICP備06013414號-3 公安備 42010502001045

    国产亚洲精品美女久久| 亚洲区欧美区| 欧美高清一区| 国产伦一区二区三区| 亚洲私拍视频| 国产农村妇女精品一区二区 | 一区二区影视| 天堂√8在线中文| 欧美网站在线| 荡女精品导航| 国产成人影院| 久久精品亚洲| 日韩伦理精品| 欧美bbbbb| 91成人免费| 欧美五码在线| 亚洲伊人春色| 中文字幕一区二区三三| 青青久久精品| av中文在线资源库| 夜夜精品视频| 欧美1区2区| 精品五月天堂| 欧美不卡在线观看| 国产一区二区三区日韩精品| 青青草成人在线观看| 日韩高清在线| 欧美7777| 亚洲日本天堂| cao在线视频| 蜜臀久久99精品久久久久久9 | 亚洲国产合集| 国产不卡精品在线| 欧美区亚洲区| 影音先锋中文字幕一区二区| 成人四虎影院| 78精品国产综合久久香蕉| 国产精品国产一区| 色呦哟—国产精品| 日韩精品一级二级 | 国产精品女主播一区二区三区| 久久亚洲影视| 欧美日韩精品在线一区| 麻豆国产欧美一区二区三区r| 永久免费精品视频| 亚洲视频国产| 1313精品午夜理伦电影| 日本亚洲欧美天堂免费| 亚洲宅男一区| 国产日韩在线观看视频| 日韩欧美久久| 国产成人夜色高潮福利影视| 99久久香蕉| 欧美a大片欧美片| 天天躁日日躁成人字幕aⅴ| 99精品视频精品精品视频| 亚洲91视频| 在线成人直播| 男人的天堂成人在线| 免费欧美日韩国产三级电影| 蜜桃视频一区二区| 91av亚洲| 国产亚洲欧美日韩精品一区二区三区| 亚洲18在线| 麻豆国产精品官网| 亚洲一区二区小说| 亚洲区小说区图片区qvod| 国产美女亚洲精品7777| 欧美久久精品| 亚洲成人三区| 日韩专区一卡二卡| 牛牛精品一区二区| 欧美在线高清| 99精品国产九九国产精品| 久久av免费| 国产精品网站在线看| 天天做夜夜做人人爱精品| 欧美日韩国产一区精品一区| 麻豆久久婷婷| 日韩网站中文字幕| 日本午夜精品一区二区三区电影| 国产精品一区二区精品| 亚洲精品v亚洲精品v日韩精品| 欧美成人专区| 亚洲欧美日本国产专区一区| 新版的欧美在线视频| 99精品国产99久久久久久福利| 成人免费91| 美女网站色精品尤物极品姐弟| 欧美在线网站| 国产资源在线观看入口av| 美女视频网站黄色亚洲| 国产一区日韩| 91精品国产成人观看| 亚洲专区一区| 人人精品久久| 国产欧美成人| 99re6这里只有精品| 免费成人av资源网| 美腿丝袜在线亚洲一区| 天海翼精品一区二区三区| 久久精品高清| 色婷婷亚洲mv天堂mv在影片| 日韩高清一区二区| 久久天堂久久| 亚洲激情精品| 国产精品66| 18国产精品| 亚洲在线日韩| 麻豆精品一区二区三区| 999精品视频在这里| 男人天堂欧美日韩| 美女网站视频久久| 国产精品网在线观看| 首页国产欧美日韩丝袜| 久久一区二区三区四区五区| 成人av地址| 人禽交欧美网站| 亚洲欧美在线人成swag| 久久久五月天| 日韩三区在线| 一区二区三区自拍视频| 免费的国产精品| 欧美精品国产一区二区| 国产99久久| 成人黄色免费网站| 国产丝袜一区| 中文字幕在线免费观看视频| 国产精品片aa在线观看| 欧美日韩四区| 亚洲另类视频| 激情五月色综合国产精品| 欧美亚洲综合视频| 成人在线视频你懂的| 国产免费拔擦拔擦8x高清在线人| 国产精品一站二站| 日韩亚洲国产欧美| 国产精品大片| 精品1区2区3区4区| 日本vs亚洲vs韩国一区三区二区 | 欧美不卡在线观看| 国产精品久久久久久影院8一贰佰 国产精品久久久久久麻豆一区软件 | 国产日韩另类视频一区| 国产图片一区| 精品成人免费一区二区在线播放| 色悠久久久久综合先锋影音下载| 91亚洲国产成人久久精品| 国产欧美一区二区三区精品观看 | 日韩精品久久| 国产精品丝袜在线播放| 午夜不卡影院| 欧美韩一区二区| 婷婷成人av| 波多野结衣在线观看一区二区三区| 日韩一级特黄| 亚洲成人三区| 国产精品**亚洲精品| 丝袜亚洲另类欧美综合| 日韩二区在线观看| 日韩夫妻性生活xx| 精品精品久久| 亚洲日本黄色| 一本不卡影院| 九九九九九九精品任你躁| 九色porny视频在线观看| 97久久综合区小说区图片区| 日韩欧美少妇| 欧美在线亚洲| 婷婷五月色综合香五月| 91麻豆精品国产91久久久平台 | 一本一本久久a久久综合精品 | 综合久久99| 色中色综合网| 精品网站aaa| 亚洲精品日本| 国产伦久视频在线观看| 精品国产一区探花在线观看 | 精品久久电影| 亚洲毛片在线| 色偷偷综合网| 国产精品网址| 久久亚洲黄色| 日韩大片在线播放| 天天超碰亚洲| 视频国产精品| 麻豆免费看一区二区三区| 免费高清在线一区| 久久精品国产亚洲夜色av网站| 疯狂欧洲av久久成人av电影| 日韩在线不卡| 夜久久久久久| 精品久久久久久久| 国产剧情一区二区在线观看| 日韩中文在线电影| 一本久道久久综合狠狠爱| 国产精品一区二区三区美女| 综合精品一区| 久久av日韩| 国产精品国产三级国产在线观看| 久久久噜噜噜|