繼續上文GPGPU體系結構優化方向 [上],介紹提高并行度和優化流水線的方向。
不同的workload因為存在不同的input size和對寄存器以及memory的需要,有時會導致只有少量的活躍thread block,這降低了執行單元的利用率。因此可以通過同時運行多個workload,增加并行度來提高利用率。另一種方法則是利用scalar opportunity以及運行的warp之間的value similarity。
具體的子方向:
減少資源碎片化增加并行度
Unifying Primary Cache, Scratch and Register File Memory in a Throughput processor提出不同的workload對資源的需求不同,因此可以動態的對不同workload的資源進行劃分。
Shared Memory Multiplexing: A Novel Way to ImproveGPGPU Throughput注意到在一個thread block內的warp會在不同的時間點結束,此時,即使是較早完成的warp占用的資源也不會釋放,這導致了資源的低效利用,此時應該可以launch新的warp。
他們將資源的低效利用劃分為temporal和spatial:
temporal低效是因為warp的不同時間結束導致的
spatial的低效則是因為沒有足夠的資源launch新的warp
他們提出了在資源不夠launch一個新的thread block時,只launch部分thread block的方法。GPU Multitaksing
多任務同時在GPU上執行
可以有效的提高GPU的利用率。
有助于操作系統調用GPU時,對GPU的虛擬化以及在云上deploy GPU
Improving GPGPU Concurrency with Elastic Kernels將task不能夠進行并行化的原因分成了幾類:
Serialization due to Lack of Resources
Serialization due to Inter-stream Scheduling
Serialization due to Memory Transfers
Serialization in the CUDA API
Serialization in the Implementation
他們觀察到如果bfs只占用了部分資源,但是fft和cutcp占用了全部資源,那么即使bfs較晚進入queue中,也可以不按照fifo的調度順序,將bfs優先調度,空置的資源同時執行cutcp,這樣提高了并行度。
此外,觀察到GPU的DMA只能在一個時間段內進行拷貝到GPU和拷出GPU中的一種。如果下圖中的bfs等到數據的拷貝,但是此時lbm正在將數據拷出,會導致bfs的等待,因此可以將DMA的任務切片,提高并行度。
此外,Increasing GPU throughput using kernel interleaved thread block scheduling等也發現可以將memory intensive和compute intensive的workloads混合調度,這樣提高資源的利用效率。
在調度workloads時,也需要注意到workload的優先級,如果優先級較高的workload等待時間較長,那么應當切換到優先級高的workload。Enabling preemptive multiprogramming on GPUs提出了兩種搶占的方式,context swtiching和draning。
Chimera: Collaborative Preemptionfor Multitasking on a Shared GPU提出了被搶占的workload可以不需要保存上下文,直接放棄,在獲得資源后重新從頭開始執行。
利用scalar and value similarity opprotunities
Characterizing Scalar Opportunities inGPGPU Applications提出了 scalar opportunity,即在各個threads中同時對相同的數據執行相同的計算,也就得到相同的結果,寫回相同的值。AMD將這類計算單獨放在GPU core中的標量單元中進行計算。
“We define a scalar opportunity as a SIMD instructionoperating on the same data in all of its active threads. Atypical example of scalar opportunities is loading a constantvalue when each active thread loads the same value frommemory and then stores it in the corresponding component ofthe destination vector register. Finally those components storethe same value.”
基于這個的工作主要有幾類:
檢測方法:硬件或者軟件編譯器
執行方法:單獨的標量單元或者單獨使用一個core計算
專門的寄存器或者和其他指令共用寄存器
取址譯碼執行和其他指令的資源共享或者單獨設計
支持的指令類型
Improving execution pipeling
現代 GPU為了有效地共享資源,在 GPU 管道中插入了buffering和collisionavoidance stage,從而增加指令的讀后寫 (RAW) 延遲。通常大家認為GPU通過warp的調度可以隱藏RAW延遲,因而GPU沒有設計data forward networking。但是Exploiting GPUPeak-power and Performance Tradeoffs through Reduced Effective Pipeline Latency觀察到許多 GPGPU 應用程序沒有足夠的活動線程來準備發出指令來隱藏這些 RAW 延遲。
因此他們使用most recent result forwarding(MORF)來實現data forwarding,同時相對于傳統的data forwarding,降低了功耗。
Warped-Preexecution: A GPU Pre-execution Approachfor Improving Latency Hiding文章提出在warp的線程進入長期等待的idle狀態時,可以進入P-mode。在P-mode模式下,識別出程序中后續的不存在依賴關系的指令,先執行后續的指令,也即實現了亂序執行。
-
寄存器
+關注
關注
31文章
5363瀏覽量
121155 -
gpu
+關注
關注
28文章
4774瀏覽量
129350 -
流水線
+關注
關注
0文章
121瀏覽量
25955 -
GPGPU
+關注
關注
0文章
29瀏覽量
4918
原文標題:GPGPU體系結構優化方向 [中]
文章出處:【微信號:處理器與AI芯片,微信公眾號:處理器與AI芯片】歡迎添加關注!文章轉載請注明出處。
發布評論請先 登錄
相關推薦
評論