Bài giảng môn Kiến trúc máy tính

Cluster n Nhiều máy tính được kết nối với nhau bằng mạng liên kết tốc độ cao (~ Gbps) n Mỗi máy tính có thể làm việc độc lập (PC hoặc SMP) n Mỗi máy tính được gọi là một node n Các máy tính có thể được quản lý làm việc song song theo nhóm (cluster) n Toàn bộ hệ thống có thể coi như là một máy tính song song n Tính sẵn sàng cao n Khả năng chịu lỗi lớn Bộ xử lý đồ họa đa dụng n Kiến trúc SIMD n Xuất phát từ bộ xử lý đồ họa GPU (Graphic Processing Unit) hỗ trợ xử lý đồ họa 2D và 3D: xử lý dữ liệu song song n GPGPU – General purpose Graphic Processing Unit n Hệ thống lai CPU/GPGPU n CPU là host: thực hiện theo tuần tự n GPGPU: tính toán song song

pdf521 trang | Chia sẻ: hachi492 | Ngày: 06/01/2022 | Lượt xem: 331 | Lượt tải: 0download
Bạn đang xem trước 20 trang tài liệu Bài giảng môn Kiến trúc máy tính, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
s in chains that are typically short—between one and two entries. The page table’s structure is called inverted because it indexes page table entries by frame number rather than by virtual page number. Translation Lookaside Buffer In principle, then, every virtual memory reference can cause two physical mem- ory accesses: one to fetch the appropriate page table entry, and one to fetch the desired data. Thus, a straightforward virtual memory scheme would have the effect of doubling the memory access time. To overcome this problem, most virtual memory schemes make use of a special cache for page table entries, usually called a translation lookaside buffer (TLB). This cache functions in the same way as a memory cache and contains those page table entries that have been most recently used. Figure 8.18 is a flowchart that shows the use of the TLB. By the principle of locality, most virtual memory references will be to locations in recently used pages. Therefore, most references will involve page table entries in the cache. Studies of the VAX TLB have shown that this scheme can significantly improve performance [CLAR85, SATY81]. Page # Offset Frame # m bits m bits n bits n bits Virtual address Hash function Page # Process ID Control bits Chain Inverted page table (one entry for each physical memory frame) Real address Offset i 0 j 2m ! 1 Figure 8.17 Inverted Page Table Structure CA2020 Kiến trúc máy tính 435 NKK-HUST Bộ nhớ trên máy tính PC n Bộ nhớ cache: tích hợp trên chip vi xử lý: n L1: cache lệnh và cache dữ liệu n L2, L3 n Bộ nhớ chính: Tồn tại dưới dạng các mô-đun nhớ RAM CA2020 Kiến trúc máy tính 436 NKK-HUST Bộ nhớ trên PC (tiếp) n ROM BIOS chứa các chương trình sau: n Chương trình POST (Power On Self Test) n Chương trình CMOS Setup n Chương trình Bootstrap loader n Các trình điều khiển vào-ra cơ bản (BIOS) n CMOS RAM: n Chứa thông tin cấu hình hệ thống n Đồng hồ hệ thống n Có pin nuôi riêng n Video RAM: quản lý thông tin của màn hình n Các loại bộ nhớ ngoài CA2020 Kiến trúc máy tính 437 NKK-HUST Hết chương 7 CA2020 Kiến trúc máy tính 438 NKK-HUST Kiến trúc máy tính Chương 8 HỆ THỐNG VÀO-RA Nguyễn Kim Khánh Trường Đại học Bách khoa Hà Nội CA2020 Kiến trúc máy tính 439 NKK-HUST Nội dung học phần Chương 1. Giới thiệu chung Chương 2. Cơ bản về logic số Chương 3. Hệ thống máy tính Chương 4. Số học máy tính Chương 5. Kiến trúc tập lệnh Chương 6. Bộ xử lý Chương 7. Bộ nhớ máy tính Chương 8. Hệ thống vào-ra Chương 9. Các kiến trúc song song CA2020 Kiến trúc máy tính 440 NKK-HUST 8.1. Tổng quan về hệ thống vào-ra 8.2. Các phương pháp điều khiển vào-ra 8.3. Nối ghép thiết bị vào-ra Nội dung của chương 8 CA2020 Kiến trúc máy tính 441 NKK-HUST 8.1. Tổng quan về hệ thống vào-ra n Chức năng: Trao đổi thông tin giữa máy tính với bên ngoài n Các thao tác cơ bản: n Vào dữ liệu (Input) n Ra dữ liệu (Output) n Các thành phần chính: n Các thiết bị vào-ra n Các mô-đun vào-ra CA2020 Kiến trúc máy tính 442 Mô-đun vào-ra Thiết bị vào-ra Thiết bị vào-ra Bus hệ thống Thiết bị vào-ra Mô-đun vào-ra NKK-HUST Đặc điểm của hệ thống vào-ra n Tồn tại đa dạng các thiết bị vào-ra khác nhau về: n Nguyên tắc hoạt động n Tốc độ n Khuôn dạng dữ liệu n Tất cả các thiết bị vào-ra đều chậm hơn CPU và RAM à Cần có các mô-đun vào-ra để nối ghép các thiết bị với CPU và bộ nhớ chính CA2020 Kiến trúc máy tính 443 NKK-HUST Thiết bị vào-ra n Còn gọi là thiết bị ngoại vi (Peripherals) n Chức năng: chuyển đổi dữ liệu giữa bên trong và bên ngoài máy tính n Phân loại: n Thiết bị vào (Input Devices) n Thiết bị ra (Output Devices) n Thiết bị lưu trữ (Storage Devices) n Thiết bị truyền thông (Communication Devices) n Giao tiếp: n Người - máy n Máy - máy CA2020 Kiến trúc máy tính 444 NKK-HUST Cấu trúc chung của thiết bị vào-ra CA2020 Kiến trúc máy tính 445 Bộ đệm dữ liệu Khối logic điều khiển Bộ chuyển đổi tín hiệu Dữ liệu từ/đến mô-đun vào-ra Tín hiệu điều khiển Tín hiệu trạng thái Dữ liệu đến/từ bên ngoài NKK-HUST Mô-đun vào-ra n Chức năng: n Điều khiển và định thời n Trao đổi thông tin với CPU hoặc bộ nhớ chính n Trao đổi thông tin với thiết bị vào-ra n Đệm giữa bên trong máy tính với thiết bị vào-ra n Phát hiện lỗi của thiết bị vào-ra CA2020 Kiến trúc máy tính 446 NKK-HUST Cấu trúc của mô-đun vào-ra CA2020 Kiến trúc máy tính 447 Bộ đệm dữ liệu Khối logic điều khiển Cổng vào ra dữ liệu Cổng vào ra dữ liệu Bus Tín hiệu điều khiển Tín hiệu trạng thái Tín hiệu điều khiển Tín hiệu trạng thái Các đường địa chỉ Các đường điều khiển Các đường dữ liệu NKK-HUST 4. Địa chỉ hóa cổng vào-ra (IO addressing) CA2020 Kiến trúc máy tính 448 n Hầu hết các bộ xử lý chỉ có một không gian địa chỉ chung cho cả các ngăn nhớ và các cổng vào-ra n Các bộ xử lý 680x0 của Motorola n Các bộ xử lý theo kiến trúc RISC: MIPS, ARM, ... n Một số bộ xử lý có hai không gian địa chỉ tách biệt: n Không gian địa chỉ bộ nhớ n Không gian địa chỉ vào-ra n Ví dụ: Intel x86 NKK-HUST Không gian địa chỉ tách biệt CA2020 Kiến trúc máy tính 449 Không gian địa chỉ bộ nhớ Không gian địa chỉ vào-ra N bit N1 bit . . . 000...101 000...100 000...011 000...010 000...001 000...000 . . . 111...111 . . . 00...11 00...10 00...01 00...00 . . . 11...11 NKK-HUST Các phương pháp địa chỉ hoá cổng vào-ra n Vào-ra theo bản đồ bộ nhớ (Memory mapped IO) n Vào-ra riêng biệt (Isolated IO hay IO mapped IO) CA2020 Kiến trúc máy tính 450 NKK-HUST Vào-ra theo bản đồ bộ nhớ n Cổng vào-ra được đánh địa chỉ theo không gian địa chỉ bộ nhớ n CPU coi cổng vào-ra như ngăn nhớ n Lập trình trao đổi dữ liệu với cổng vào-ra bằng các lệnh truy nhập dữ liệu bộ nhớ n Có thể thực hiện trên mọi hệ thống n Ví dụ: Bộ xử lý MIPS n 32-bit địa chỉ cho một không gian địa chỉ chung cho cả các ngăn nhớ và các cổng vào-ra n Các cổng vào-ra được gắn các địa chỉ thuộc vùng địa chỉ dự trữ n Vào/ra dữ liệu: sử dụng lệnh load/store CA2020 Kiến trúc máy tính 451 NKK-HUST Ví dụ lập trình vào-ra cho MIPS n Ví dụ: Có hai cổng vào-ra được gán địa chỉ: n Cổng 1: 0xFFFFFFF4 n Cổng 2: 0xFFFFFFF8 n Ghi giá trị 0x41 ra cổng 1 addi $t0, $0, 0x41 # đưa giá trị 0x41 sw $t0, 0xFFF4($0) # ra cổng 1 Chú ý: giá trị 16-bit 0xFFF4 được sign-extended thành 32-bit 0xFFFFFFF4 n Đọc dữ liệu từ cổng 2 đưa vào $t3 lw $t3, 0xFFF8($0) # đọc dữ liệu cổng 2 đưa vào $t3 CA2020 Kiến trúc máy tính 452 NKK-HUST Vào-ra riêng biệt (Isolated IO) n Cổng vào-ra được đánh địa chỉ theo không gian địa chỉ vào-ra riêng n Lập trình trao đổi dữ liệu với cổng vào-ra bằng các lệnh vào-ra chuyên dụng n Ví dụ: Intel x86 n Dùng 8-bit hoặc 16-bit địa chỉ cho không gian địa chỉ vào-ra riêng n Có hai lệnh vào-ra chuyên dụng n Lệnh IN: nhận dữ liệu từ cổng vào n Lệnh OUT: đưa dữ liệu đến cổng ra CA2020 Kiến trúc máy tính 453 NKK-HUST 8.2. Các phương pháp điều khiển vào-ra n Vào-ra bằng chương trình (Programmed IO) n Vào-ra điều khiển bằng ngắt (Interrupt Driven IO) n Truy nhập bộ nhớ trực tiếp - DMA (Direct Memory Access) CA2020 Kiến trúc máy tính 454 NKK-HUST Ba kỹ thuật thực hiện vào một khối dữ liệu230 CHAPTER 7 / INPUT/OUTPUT Figure 7.4a gives an example of the use of programmed I/O to read in a block of data from a peripheral device (e.g., a record from tape) into memory. Data are read in one word (e.g., 16 bits) at a time. For each word that is read in, the processor must remain in a status-checking cycle until it determines that the word is available in the I/O module’s data register. This flowchart highlights the main disadvantage of this technique: it is a time-consuming process that keeps the processor busy needlessly. I/O Instructions With programmed I/O, there is a close correspondence between the I/O-related instructions that the processor fetches from memory and the I/O commands that the processor issues to an I/O module to execute the instructions. That is, the instruc- tions are easily mapped into I/O commands, and there is often a simple one-to-one relationship. The form of the instruction depends on the way in which external devices are addressed. Typically, there will be many I/O devices connected through I/O modules to the system. Each device is given a unique identifier or address. When the processor issues an I/O command, the command contains the address of the desired device. Thus, each I/O module must interpret the address lines to determine if the com- mand is for itself. Issue read command to I/O module Read status of I/O module Check Status Read word from I/O module Write word into memory Done? Next instruction (a) Programmed I/O Error condition Ready Ready Yes Yes No Not ready Issue read command to I/O module Do something else InterruptRead status of I/O module Check status Read word from I/O module Write word into memory Done? Next instruction (b) Interrupt-Driven I/O Do something else Interrupt Error condition No Issue read block command to I/O module Read status of DMA module Next instruction (c) Direct Memory Access CPU DMA DMA CPU CPU I/O CPU I/O I/O CPU I/O CPU I/O CPU CPU Memory I/O CPU CPU Memory Figure 7.4 Three Techniques for Input of a Block of Data CA2020 Kiến trúc máy tính 455 NKK-HUST 1. Vào-ra bằng chương trình n Nguyên tắc chung: n CPU điều khiển trực tiếp vào-ra bằng chương trình à cần phải lập trình vào-ra để trao đổi dữ liệu giữa CPU với mô-đun vào-ra n CPU nhanh hơn thiết bị vào-ra rất nhiều lần, vì vậy trước khi thực hiện lệnh vào-ra, chương trình cần đọc và kiểm tra trạng thái sẵn sàng của mô-đun vào-ra CA2020 Kiến trúc máy tính 456 Đọc trạng thái mô-đun vào-ra Trao đổi dữ liệu Sẵn sàng ? Y N NKK-HUST Các tín hiệu điều khiển vào-ra n Tín hiệu điều khiển (Control): kích hoạt thiết bị vào-ra n Tín hiệu kiểm tra (Test): kiểm tra trạng thái của mô-đun vào-ra và thiết bị vào-ra n Tín hiệu điều khiển đọc (Read): yêu cầu mô- đun vào-ra nhận dữ liệu từ thiết bị vào-ra và đưa vào bộ đệm dữ liệu, rồi CPU nhận dữ liệu đó n Tín hiệu điều khiển ghi (Write): yêu cầu mô- đun vào-ra lấy dữ liệu trên bus dữ liệu đưa đến bộ đệm dữ liệu rồi chuyển ra thiết bị vào-ra CA2020 Kiến trúc máy tính 457 NKK-HUST Các lệnh vào-ra n Với vào-ra theo bản đồ bộ nhớ: sử dụng các lệnh trao đổi dữ liệu với bộ nhớ để trao đổi dữ liệu với cổng vào-ra n Với vào-ra riêng biệt: sử dụng các lệnh vào-ra chuyên dụng (IN, OUT) CA2020 Kiến trúc máy tính 458 NKK-HUST Đặc điểm n Vào-ra do ý muốn của người lập trình n CPU trực tiếp điều khiển trao đổi dữ liệu giữa CPU với mô-đun vào-ra n CPU đợi trạng thái sẵn sàng của mô-đun vào-ra (thông qua vòng lặp)à tiêu tốn nhiều thời gian của CPU CA2020 Kiến trúc máy tính 459 NKK-HUST 2. Vào-ra điều khiển bằng ngắt n Nguyên tắc chung: n CPU không phải đợi trạng thái sẵn sàng của mô-đun vào-ra, CPU thực hiện một chương trình nào đó n Khi mô-đun vào-ra sẵn sàng thì nó phát tín hiệu ngắt CPU n CPU thực hiện chương trình con xử lý ngắt vào-ra tương ứng để trao đổi dữ liệu n CPU trở lại tiếp tục thực hiện chương trình đang bị ngắt CA2020 Kiến trúc máy tính 460 NKK-HUST Chuyển điều khiển đến chương trình con ngắt CA2020 Kiến trúc máy tính 461 lệnh i+1 lệnh i lệnh lệnh lệnh Ngắt ở đây . . . lệnh lệnh lệnh RETURN . . . lệnh lệnh Chương trình đang thực hiện Chương trình con xử lý ngắt lệnh NKK-HUST Hoạt động vào dữ liệu: nhìn từ mô-đun vào-ra n Mô-đun vào-ra nhận tín hiệu điều khiển đọc từ CPU n Mô-đun vào-ra nhận dữ liệu từ thiết bị vào-ra, trong khi đó CPU làm việc khác n Khi đã có dữ liệu à mô-đun vào-ra phát tín hiệu ngắt CPU n CPU yêu cầu dữ liệu n Mô-đun vào-ra chuyển dữ liệu đến CPU CA2020 Kiến trúc máy tính 462 NKK-HUST Hoạt động vào dữ liệu: nhìn từ CPU n Phát tín hiệu điều khiển đọc n Làm việc khác n Cuối mỗi chu trình lệnh, kiểm tra tín hiệu yêu cầu ngắt n Nếu bị ngắt: n Cất ngữ cảnh (nội dung các thanh ghi liên quan) n Thực hiện chương trình con xử lý ngắt để vào dữ liệu n Khôi phục ngữ cảnh của chương trình đang thực hiện CA2020 Kiến trúc máy tính 463 NKK-HUST Các vấn đề nảy sinh khi thiết kế n Làm thế nào để xác định được mô-đun vào-ra nào phát tín hiệu ngắt ? n CPU làm như thế nào khi có nhiều yêu cầu ngắt cùng xẩy ra ? CA2020 Kiến trúc máy tính 464 NKK-HUST Các phương pháp nối ghép ngắt n Sử dụng nhiều đường yêu cầu ngắt n Hỏi vòng bằng phần mềm (Software Poll) n Hỏi vòng bằng phần cứng (Daisy Chain or Hardware Poll) n Sử dụng bộ điều khiển ngắt (PIC) CA2020 Kiến trúc máy tính 465 NKK-HUST Nhiều đường yêu cầu ngắt n Mỗi mô-đun vào-ra được nối với một đường yêu cầu ngắt n CPU phải có nhiều đường tín hiệu yêu cầu ngắt n Hạn chế số lượng mô-đun vào-ra n Các đường ngắt được qui định mức ưu tiên CPU Mô-đun vào-ra INTR3 INTR2 INTR1 INTR0 Thanh ghi yêu cầu ngắt Mô-đun vào-ra Mô-đun vào-ra Mô-đun vào-ra CA2020 Kiến trúc máy tính 466 NKK-HUST Hỏi vòng bằng phần mềm n CPU thực hiện phần mềm hỏi lần lượt từng mô-đun vào-ra n Chậm n Thứ tự các mô-đun được hỏi vòng chính là thứ tự ưu tiên CPU Mô-đun vào-ra INTRCờ ngắt Mô-đun vào-ra Mô-đun vào-ra Mô-đun vào-ra CA2020 Kiến trúc máy tính 467 NKK-HUST Hỏi vòng bằng phần cứng CPU Mô-đun vào-ra INTRCờ ngắt Bus dữ liệu Mô-đun vào-ra Mô-đun vào-ra Mô-đun vào-ra INTA CA2020 Kiến trúc máy tính 468 NKK-HUST Hỏi vòng bằng phần cứng (tiếp) n CPU phát tín hiệu chấp nhận ngắt (INTA) đến mô-đun vào-ra đầu tiên n Nếu mô-đun vào-ra đó không gây ra ngắt thì nó gửi tín hiệu đến mô-đun kế tiếp cho đến khi xác định được mô-đun gây ngắt n Thứ tự các mô-đun vào-ra kết nối trong chuỗi xác định thứ tự ưu tiên CA2020 Kiến trúc máy tính 469 NKK-HUST Bộ điều khiển ngắt lập trình được n PIC – Programmable Interrupt Controller n PIC có nhiều đường vào yêu cầu ngắt có qui định mức ưu tiên n PIC chọn một yêu cầu ngắt không bị cấm có mức ưu tiên cao nhất gửi tới CPU CPU Mô-đun vào-ra INTR n INTRn-1 INTR1 INTR0 Mô-đun vào-ra Mô-đun vào-ra Mô-đun vào-ra PIC . . .INTR INTA Bus dữ liệu CA2020 Kiến trúc máy tính 470 NKK-HUST Đặc điểm của vào-ra điều khiển bằng ngắt n Có sự kết hợp giữa phần cứng và phần mềm n Phần cứng: gây ngắt CPU n Phần mềm: trao đổi dữ liệu giữa CPU với mô-đun vào-ra n CPU trực tiếp điều khiển vào-ra n CPU không phải đợi mô-đun vào-ra, do đó hiệu quả sử dụng CPU tốt hơn CA2020 Kiến trúc máy tính 471 NKK-HUST 3. DMA (Direct Memory Access) n Vào-ra bằng chương trình và bằng ngắt do CPU trực tiếp điều khiển: n Chiếm thời gian của CPU n Để khắc phục dùng kỹ thuật DMA n Sử dụng mô-đun điều khiển vào-ra chuyên dụng, gọi là DMAC (Controller), điều khiển trao đổi dữ liệu giữa mô-đun vào-ra với bộ nhớ chính CA2020 Kiến trúc máy tính 472 NKK-HUST Sơ đồ cấu trúc của DMAC Bộ đếm dữ liệu Logic điều khiển Thanh ghi địa chỉ Thanh ghi dữ liệu Các đường dữ liệu Các đường địa chỉ Yêu cầu bus Chuyển nhượng bus Ngắt Đọc Ghi Điều khiển đọc Điều khiển ghi Yêu cầu DMA Chấp nhận DMA CA2020 Kiến trúc máy tính 473 NKK-HUST Các thành phần của DMAC n Thanh ghi dữ liệu: chứa dữ liệu trao đổi n Thanh ghi địa chỉ: chứa địa chỉ ngăn nhớ dữ liệu n Bộ đếm dữ liệu: chứa số từ dữ liệu cần trao đổi n Logic điều khiển: điều khiển hoạt động của DMAC CA2020 Kiến trúc máy tính 474 NKK-HUST Hoạt động DMA n CPU “nói” cho DMAC n Vào hay Ra dữ liệu n Địa chỉ thiết bị vào-ra (cổng vào-ra tương ứng) n Địa chỉ đầu của mảng nhớ chứa dữ liệu à nạp vào thanh ghi địa chỉ n Số từ dữ liệu cần truyền à nạp vào bộ đếm dữ liệu n CPU làm việc khác n DMAC điều khiển trao đổi dữ liệu n Sau khi truyền được một từ dữ liệu thì: n nội dung thanh ghi địa chỉ tăng n nội dung bộ đếm dữ liệu giảm n Khi bộ đếm dữ liệu = 0, DMAC gửi tín hiệu ngắt CPU để báo kết thúc DMA CA2020 Kiến trúc máy tính 475 NKK-HUST Các kiểu thực hiện DMA n DMA truyền theo khối (Block-transfer DMA): DMAC sử dụng bus để truyền xong cả khối dữ liệu n DMA lấy chu kỳ (Cycle Stealing DMA): DMAC cưỡng bức CPU treo tạm thời từng chu kỳ bus, DMAC chiếm bus thực hiện truyền một từ dữ liệu. n DMA trong suốt (Transparent DMA): DMAC nhận biết những chu kỳ nào CPU không sử dụng bus thì chiếm bus để trao đổi một từ dữ liệu. CA2020 Kiến trúc máy tính 476 NKK-HUST Cấu hình DMA (1) n Mỗi lần trao đổi một dữ liệu, DMAC sử dụng bus hai lần n Giữa mô-đun vào-ra với DMAC n Giữa DMAC với bộ nhớ CPU . . . DMAC MemoryI/OModule I/O Module System Bus CA2020 Kiến trúc máy tính 477 NKK-HUST Cấu hình DMA (2) n DMAC điều khiển một hoặc vài mô-đun vào-ra n Mỗi lần trao đổi một dữ liệu, DMAC sử dụng bus một lần n Giữa DMAC với bộ nhớ CPU . . . DMAC Memory I/O Module I/O Module I/O Module DMAC System Bus CA2020 Kiến trúc máy tính 478 NKK-HUST Cấu hình DMA (3) n Bus vào-ra tách rời hỗ trợ tất cả các thiết bị cho phép DMA n Mỗi lần trao đổi một dữ liệu, DMAC sử dụng bus một lần n Giữa DMAC với bộ nhớ CPU . . . Memory I/O Module I/O Module I/O Module DMAC System Bus IO Bus CA2020 Kiến trúc máy tính 479 NKK-HUST Đặc điểm của DMA n CPU không tham gia trong quá trình trao đổi dữ liệu n DMAC điều khiển trao đổi dữ liệu giữa bộ nhớ chính với mô-đun vào-ra (hoàn toàn bằng phần cứng)à tốc độ nhanh n Phù hợp với các yêu cầu trao đổi mảng dữ liệu có kích thước lớn CA2020 Kiến trúc máy tính 480 NKK-HUST 4. Bộ xử lý vào-ra n Việc điều khiển vào-ra được thực hiện bởi một bộ xử lý vào-ra chuyên dụng n Bộ xử lý vào-ra hoạt động theo chương trình của riêng nó n Chương trình của bộ xử lý vào-ra có thể nằm trong bộ nhớ chính hoặc nằm trong một bộ nhớ riêng CA2020 Kiến trúc máy tính 481 NKK-HUST 8.3. Nối ghép thiết bị vào-ra 1. Các kiểu nối ghép vào-ra n Nối ghép song song n Nối ghép nối tiếp CA2020 Kiến trúc máy tính 482 NKK-HUST Nối ghép song song n Truyền nhiều bit song song n Tốc độ nhanh n Cần nhiều đường truyền dữ liệu Mô-đun vào-ra song song Đến thiết bị vào-ra Đến bus hệ thống CA2020 Kiến trúc máy tính 483 NKK-HUST Nối ghép nối tiếp n Truyền lần lượt từng bit n Cần có bộ chuyển đổi từ dữ liệu song song sang nối tiếp hoặc/và ngược lại n Tốc độ chậm hơn n Cần ít đường truyền dữ liệu Mô-đun vào-ra nối tiếp Đến thiết bị vào-ra Đến bus hệ thống CA2020 Kiến trúc máy tính 484 NKK-HUST 2. Các cấu hình nối ghép n Điểm tới điểm (Point to Point) n Thông qua một cổng vào-ra nối ghép với một thiết bị n Điểm tới đa điểm (Point to Multipoint) n Thông qua một cổng vào-ra cho phép nối ghép được với nhiều thiết bị n Ví dụ: n USB (Universal Serial Bus): 127 thiết bị n IEEE 1394 (FireWire): 63 thiết bị n Thunderbolt CA2020 Kiến trúc máy tính 485 NKK-HUST Thunderbolt 7.7 / THE EXTERNAL INTERFACE: THUNDERBOLT AND INFINIBAND 251 THUNDERBOLT PROTOCOL ARCHITECTURE Figure 7.18 illustrates the Thunderbolt protocol architecture. The cable and connector layer provides transmission medium access. This layer specifies the physical and electrical attributes of the connector port. The Thunderbolt protocol physical layer is responsible for link maintenance including hot-plug3 detection and data encoding to provide highly efficient data transfer. The physical layer has been designed to introduce very minimal overhead and provides full-duplex 10 Gbps of usable capacity to the upper layers. The common transport layer is the key to the operation of Thunderbolt and what makes it attractive as a high-speed peripheral I/O technology. Some of the features include: • A high-performance, low-power, switching architecture. • A highly efficient, low-overhead packet format with flexible quality of service (QoS) support that allows multiplexing of bursty PCI Express transactions Processor COMPUTER Platform controller hub (PCH) Thunderbolt controller Memory TC TC TC Daisy chain Thunderbolt connector Thunderbolt 20 Gbps (max) PCIe x4 DisplayPort Graphics Sub- system DisplayPort Figure 7.17 Example Computer Configuration with Thunderbolt 3The term hot plug is defined as pulling out a component from a system and plugging in a new one while the main power is still on. It allows an external drive, network adapter, or other peripheral to be plugged in without having to power down the computer. CA2020 Kiến trúc máy tính 486 NKK-HUST Hết chương 8 CA2020 Kiến trúc máy tính 487 NKK-HUST Kiến trúc máy tính Chương 9 CÁC KIẾN TRÚC SONG SONG Nguyễn Kim Khánh Trường Đại học Bách khoa Hà Nội CA2020 Kiến trúc máy tính 488 NKK-HUST Nội dung học phần Chương 1. Giới thiệu chung Chương 2. Cơ bản về logic số Chương 3. Hệ thống máy tính Chương 4. Số học máy tính Chương 5. Kiến trúc tập lệnh Chương 6. Bộ xử lý Chương 7. Bộ nhớ máy tính Chương 8. Hệ thống vào-ra Chương 9. Các kiến trúc song song CA2020 Kiến trúc máy tính 489 NKK-HUST 9.1. Phân loại kiến trúc máy tính 9.2. Đa xử lý bộ nhớ dùng chung 9.3. Đa xử lý bộ nhớ phân tán 9.4. Bộ xử lý đồ họa đa dụng Nội dung của chương 9 CA2020 Kiến trúc máy tính 490 NKK-HUST 9.1. Phân loại kiến trúc máy tính Phân loại kiến trúc máy tính (Michael Flynn -1966) n SISD - Single Instruction Stream, Single Data Stream n SIMD - Single Instruction Stream, Multiple Data Stream n MISD - Multiple Instruction Stream, Single Data Stream n MIMD - Multiple Instruction Stream, Multiple Data Stream CA2020 Kiến trúc máy tính 491 NKK-HUST SISD n CU: Control Unit n PU: Processing Unit n MU: Memory Unit n Một bộ xử lý n Đơn dòng lệnh n Dữ liệu được lưu trữ trong một bộ nhớ n Chính là Kiến trúc von Neumann (tuần tự) CU PU MU IS DS CA2020 Kiến trúc máy tính 492 NKK-HUST SIMD . . . CU PU2 LM2IS DS PU1 LM1 DS PUn LMn DS CA2020 Kiến trúc máy tính 493 NKK-HUST SIMD (tiếp) n Đơn dòng lệnh điều khiển đồng thời các đơn vị xử lý PUs n Mỗi đơn vị xử lý có một bộ nhớ dữ liệu riêng LM (local memory) n Mỗi lệnh được thực hiện trên một tập các dữ liệu khác nhau n Các mô hình SIMD n Vector Computer n Array processor CA2020 Kiến trúc máy tính 494 NKK-HUST MISD n Một luồng dữ liệu cùng được truyền đến một tập các bộ xử lý n Mỗi bộ xử lý thực hiện một dãy lệnh khác nhau. n Chưa tồn tại máy tính thực tế n Có thể có trong tương lai CA2020 Kiến trúc máy tính 495 NKK-HUST MIMD n Tập các bộ xử lý n Các bộ xử lý đồng thời thực hiện các dãy lệnh khác nhau trên các dữ liệu khác nhau n Các mô hình MIMD n Multiprocessors (Shared Memory) n Multicomputers (Distributed Memory) CA2020 Kiến trúc máy tính 496 NKK-HUST MIMD - Shared Memory Đa xử lý bộ nhớ dùng chung (shared memory mutiprocessors) CA2020 Kiến trúc máy tính 497 . . . CU1 PU2 IS DS PU1 Bộ nhớ dùng chung DS PUn DS CUn CU2 . . . IS IS NKK-HUST MIMD - Distributed Memory Đa xử lý bộ nhớ phân tán (distributed memory mutiprocessors or multicomputers) CA2020 Kiến trúc máy tính 498 . . . CU1 PU2 LM2 IS DS PU1 LM1 DS PUn LMn DS CUn CU2 . . . . . . Mạng liên kết hiệu năng cao IS IS NKK-HUST Phân loại các kỹ thuật song song n Song song mức lệnh n pipeline n superscalar n Song song mức dữ liệu n SIMD n Song song mức luồng n MIMD n Song song mức yêu cầu n Cloud computing CA2020 Kiến trúc máy tính 499 NKK-HUST 9.2. Đa xử lý bộ nhớ dùng chung n Hệ thống đa xử lý đối xứng (SMP- Symmetric Multiprocessors) n Hệ thống đa xử lý không đối xứng (NUMA – Non-Uniform Memory Access) n Bộ xử lý đa lõi (Multicore Processors) CA2020 Kiến trúc máy tính 500 NKK-HUST SMP hay UMA (Uniform Memory Access) 598 PARALLEL COMPUTER ARCHITECTURES CHAP. 8 Memory consistency is not a done deal. Researchers are still proposing new models (Naeem et al., 2011, Sorin et al., 2011, and Tu et al., 2010). 8.3.3 UMA Symmetric Multiprocessor Architectures The simplest multiprocessors are based on a single bus, as illustrated in Fig. 8-26(a). Two or more CPUs and one or more memory modules all use the same bus for communication. When a CPU wants to read a memory word, it first checks to see whether the bus is busy. If the bus is idle, the CPU puts the address of the word it wants on the bus, asserts a few control signals, and waits until the memory puts the desired word on the bus. Shared memory CPU M Bus (a) (b) (c) Cache Private memory Shared memory CPU CPU MCPU CPU MCPU Figure 8-26. Three bus-based multiprocessors. (a) Without caching. (b) With caching. (c) With caching and private memories. If the bus is busy when a CPU wants to read or write memory, the CPU just waits until the bus becomes idle. Herein lies the problem with this design. With two or three CPUs, contention for the bus will be manageable; with 32 or 64 it will be unbearable. The system will be totally limited by the bandwidth of the bus, and most of the CPUs will be idle most of the time. The solution is to add a cache to each CPU, as depicted in Fig. 8-26(b). The cache can be inside the CPU chip, next to the CPU chip, on the processor board, or some combination of all three. Since many reads can now be satisfied out of the local cache, there will be much less bus traffic, and the system can support more CPUs. Thus caching is a big win here. However, as we shall see in a moment, keeping the caches consistent with one another is not trivial. Yet another possibility is the design of Fig. 8-26(c), in which each CPU has not only a cache but also a local, private memory which it accesses over a dedicated (private) bus. To use this configuration optimally, the compiler should place all the program text, strings, constants and other read-only data, stacks, and local vari- ables in the private memories. The shared memory is then used only for writable shared variables. In most cases, this careful placement will greatly reduce bus traf- fic, but it does require active cooperation from the compiler. CA2020 Kiến trúc máy tính 501 NKK-HUST CA2020 Kiến trúc máy tính 502 SMP hay UMA (Uniform Memory Access) NKK-HUST SMP (tiếp) n Một máy tính có n >= 2 bộ xử lý giống nhau n Các bộ xử lý dùng chung bộ nhớ và hệ thống vào-ra n Thời gian truy cập bộ nhớ là bằng nhau với các bộ xử lý n Các bộ xử lý có thể thực hiện chức năng giống nhau n Hệ thống được điều khiển bởi một hệ điều hành phân tán n Hiệu năng: Các công việc có thể thực hiện song song n Khả năng chịu lỗi CA2020 Kiến trúc máy tính 503 NKK-HUST NUMA (Non-Uniform Memory Access) SEC. 8.3 SHARED-MEMORY MULTIPROCESSORS 607 system is called CC-NUMA (at least by the hardware people). The software peo- ple often call it hardware DSM because it is basically the same as software dis- tributed shared memory but implemented by the hardware using a small page size. One of the first NC-NUMA machines (although the name had not yet been coined) was the Carnegie-Mellon Cm*, illustrated in simplified form in Fig. 8-32 (Swan et al., 1977). It consisted of a collection of LSI-11 CPUs, each with some memory addressed over a local bus. (The LSI-11 was a single-chip version of the DEC PDP-11, a minicomputer popular in the 1970s.) In addition, the LSI-11 sys- tems were connected by a system bus. When a memory request came into the (specially modified) MMU, a check was made to see if the word needed was in the local memory. If so, a request was sent over the local bus to get the word. If not, the request was routed over the system bus to the system containing the word, which then responded. Of course, the latter took much longer than the former. While a program could run happily out of remote memory, it took 10 times longer to execute than the same program running out of local memory. System bus CPU MMU Memory Local bus CPU Memory Local bus CPU Memory Local bus CPU Memory Local bus Figure 8-32. A NUMA machine based on two levels of buses. The Cm* was the first multiprocessor to use this design. Memory coherence is guaranteed in an NC-NUMA machine because no cach- ing is present. Each word of memory lives in exactly one location, so there is no danger of one copy having stale data: there are no copies. Of course, it now mat- ters a great deal which page is in which memory because the performance penalty for being in the wrong place is so high. Consequently, NC-NUMA machines use elaborate software to move pages around to maximize performance. Typically, a daemon process called a page scanner runs every few seconds. Its job is to examine the usage statistics and move pages around in an attempt to improve performance. If a page appears to be in the wrong place, the page scanner unmaps it so that the next reference to it will cause a page fault. When the fault occurs, a decision is made about where to place the page, possibly in a different memory. To prevent thrashing, usually there is some rule saying that once a page is placed, it is frozen in place for a time ∆T . Various algorithms have been studied, but the conclusion is that no one algorithm performs best under all circumstances (LaRowe and Ellis, 1991). Best performance depends on the application. n Có một không gian địa chỉ chung cho tất cả CPU n Mỗi CPU có thể truy cập từ xa sang bộ nhớ của CPU khác n Truy nhập bộ nhớ từ xa chậm hơn truy nhập bộ nhớ cục bộ CA2020 Kiến trúc máy tính 504 NKK-HUST Bộ xử lý đa lõi (multicores) n Thay đổi của bộ xử lý: n Tuần tự n Pipeline n Siêu vô hướng n Đa luồng n Đa lõi: nhiều CPU trên một chip 666 CHAPTER 18 / MULTICORE COMPUTERS For each of these innovations, designers have over the years attempted to increase the performance of the system by adding complexity. In the case of pipelin- ing, simple three-stage pipelines were replaced by pipelines with five stages, and then many more stages, with some implementations having over a dozen stages. There is a practical limit to how far this trend can be taken, because with more stages, there is the need for more logic, more interconnections, and more control signals. With superscalar organization, increased performance can be achieved by increasing the number of parallel pipelines. Again, there are diminishing returns as the number of pipelines increases. More logic is required to manage hazards and to stage instruction resources. Eventually, a single thread of execution reaches the point where hazards and resource dependencies prevent the full use of the multiple Instruction fetch unit Issue logic Program counter Execution units and queues L1 instruction cache L2 cache (a) Superscalar L1 data cache Single-thread register file Instruction fetch unit Issue logic Execution units and queues L1 instruction cache L2 cache (b) Simultaneous multithreading L1 data cache PC 1 PC n R eg ist er 1 R eg ist er s n L1 -I L1 -D L2 cache Pr o ce ss o r 1 (su pe rsc ala r o r S M T) (c) Multicore L1 -I L1 -D Pr o ce ss o r 2 (su pe rsc ala r o r S M T) L1 -I L1 -D Pr o ce ss o r 3 (su pe rsc ala r o r S M T) L1 -I L1 -D Pr o ce ss o r n (su pe rsc ala r o r S M T) Figure 18.1 Alternative Chip Organizations CA2020 Kiến trúc máy tính 505 NKK-HUST Các dạng tổ chức bộ xử lý đa lõi 18.3 / MULTICORE ORGANIZATION 675 4. Interprocessor communication is easy to implement, via shared memory locations. 5. The use of a shared L2 cache confines the cache coherency problem to the L1 cache level, which may provide some additional performance advantage. A potential advantage to having only dedicated L2 caches on the chip is that each core enjoys more rapid access to its private L2 cache. This is advantageous for threads that exhibit strong locality. As both the amount of memory available and the number of cores grow, the use of a shared L3 cache combined with either a shared L2 cache or dedicated per- core L2 caches seems likely to provide better performance than simply a massive shared L2 cache. Another organizational design decision in a multicore system is whether the individual cores will be superscalar or will implement simultaneous multithreading (SMT). For example, the Intel Core Duo uses superscalar cores, whereas the Intel Core i7 uses SMT cores. SMT has the effect of scaling up the number of hardware- level threads that the multicore system supports. Thus, a multicore system with four cores and SMT that supports four simultaneous threads in each core appears the same to the application level as a multicore system with 16 cores. As software is developed to more fully exploit parallel resources, an SMT approach appears to be more attractive than a superscalar approach. CPU Core 1 L1-D L2 cache L2 cache L1-I CPU Core n L1-D L1-I Main memory (b) Dedicated L2 cache I/O CPU Core 1 L1-D L2 cache L3 cache L2 cache L1-I CPU Core n L1-D L1-I Main memory (d ) Shared L3 cache I/O CPU Core 1 L1-D L2 cache L1-I CPU Core n L1-D L1-I Main memory (c) Shared L2 cache I/O CPU Core 1 L1-D L1-I CPU Core n L1-D L1-I L2 cache Main memory (a) Dedicated L1 cache I/O Figure 18.8 Multicore Organization Alternatives CA2020 Kiến trúc máy tính 506 NKK-HUST Intel - Core Duo n 2006 n Two x86 superscalar, shared L2 cache n Dedicated L1 cache per core n 32KiB instruction and 32KiB data n 2MiB shared L2 cache 676 CHAPTER 18 / MULTICORE COMPUTERS 18.4 INTEL x86 MULTICORE ORGANIZATION Intel has introduced a number of multicore products in recent years. In this section, we look at two examples: the Intel Core Duo and the Intel Core i7-990X. Intel Core Duo The Intel Core Duo, introduced in 2006, implements two x86 superscalar processors with a shared L2 cache (Figure 18.8c). The general structure of the Intel Core Duo is shown in Figure 18.9. Let us consider the key elements starting from the top of the figure. As is common in mul- ticore systems, each core has its own dedicated L1 cache. In this case, each core has a 32-kB instruction cache and a 32-kB data cache. Each core has an independent thermal control unit. With the high transistor density of today’s chips, thermal management is a fundamental capability, espe- cially for laptop and mobile systems. The Core Duo thermal control unit is designed to manage chip heat dissipation to maximize processor performance within thermal constraints. Thermal management also improves ergonomics with a cooler system and lower fan acoustic noise. In essence, the thermal management unit monitors digital sensors for high-accuracy die temperature measurements. Each core can be defined as an independent thermal zone. The maximum temperature for each Thermal control Thermal control APIC APIC 32 -k B L1 C ac he s 32 -k B L1 C ac he s Ex ec ut io n re so u rc es Ex ec ut io n re so u rc es A rc h. st at e A rc h. st at e Power management logic 2 MB L2 shared cache Bus interface Front-side bus Figure 18.9 Intel Core Duo Block Diagram CA2020 Kiến trúc máy tính 507 NKK-HUST Intel Core i7-990X 678 CHAPTER 18 / MULTICORE COMPUTERS The general structure of the Intel Core i7-990X is shown in Figure 18.10. Each core has its own dedicated L2 cache and the four cores share a 12-MB L3 cache. One mechanism Intel uses to make its caches more effective is prefetching, in which the hardware examines memory access patterns and attempts to fill the caches spec- ulatively with data that’s likely to be requested soon. It is interesting to compare the performance of this three-level on chip cache organization with a comparable two- level organization from Intel. Table 18.1 shows the cache access latency, in terms of clock cycles for two Intel multicore systems running at the same clock frequency. The Core 2 Quad has a shared L2 cache, similar to the Core Duo. The Core i7 improves on L2 cache performance with the use of the dedicated L2 caches, and provides a relatively high-speed access to the L3 cache. The Core i7-990X chip supports two forms of external communications to other chips. The DDR3 memory controller brings the memory controller for the DDR main memory2 onto the chip. The interface supports three channels that are 8 bytes wide for a total bus width of 192 bits, for an aggregate data rate of up to 32 GB/s. With the memory controller on the chip, the Front Side Bus is eliminated. Core 0 32 kB L1-I 32 kB L1-D 32 kB L1-I 32 kB L1-D 32 kB L1-I 32 kB L1-D 32 kB L1-I 32 kB L1-D 32 kB L1-I 32 kB L1-D 32 kB L1-I 32 kB L1-D 256 kB L2 Cache Core 1 256 kB L2 Cache Core 2 256 kB L2 Cache Core 3 256 kB L2 Cache Core 4 256 kB L2 Cache Core 5 256 kB L2 Cache 12 MB L3 Cache DDR3 Memory Controllers QuickPath Interconnect 3 ! 8B @ 1.33 GT/s 4 ! 20B @ 6.4 GT/s Figure 18.10 Intel Core i7-990X Block Diagram Table 18.1 Cache Latency (in clock cycles) CPU Clock Frequency L1 Cache L2 Cache L3 Cache Core 2 Quad 2.66 GHz 3 cycles 15 cycles — Core i7 2.66 GHz 4 cycles 11 cycles 39 cycles 2The DDR synchronous RAM memory is discussed in Chapter 5. CA2020 Kiến trúc máy tính 508 NKK-HUST 9.3. Đa xử lý bộ nhớ phân tán n Máy tính qui mô lớn (Warehouse Scale Computers or Massively Parallel Processors – MPP) n Máy tính cụm (clusters) SEC. 8.4 MESSAGE-PASSING MULTICOMPUTERS 617 As a consequence of these and other factors, there is a great deal of interest in building and using parallel computers in which each CPU has its own private mem- ory, not directly accessible to any other CPU. These are the multicomputers. Pro- grams on multicomputer CPUs interact using primitives like send and receive to explicitly pass messages because they cannot get at each other’s memory with LOAD and STORE instructions. This difference completely changes the pro- gramming model. Each node in a multicomputer consists of one or a few CPUs, some RAM (conceivably shared among the CPUs at that node only), a disk and/or other I/O de- vices, and a communication processor. The communication processors are con- nected by a high-speed interconnection network of the types we discussed in Sec. 8.3.3. Many different topologies, switching schemes, and routing algorithms are used. What all multicomputers have in common is that when an application pro- gram executes the send primitive, the communication processor is notified and transmits a block of user data to the destination machine (possibly after first asking for and getting permission). A generic multicomputer is shown in Fig. 8-36. CPU Memory Node Communication processor Local interconnect Disk and I/O Local interconnect Disk and I/O High-performance interconnection network Figure 8-36. A generic multicomputer. 8.4.1 Interconnection Networks In Fig. 8-36 we see that multicomputers are held together by interconnection networks. Now it is time to look more closely at these interconnection networks. Interestingly enough, multiprocessors and multicomputers are surprisingly similar in this respect because multiprocessors often have multiple memory modules that must also be interconnected with one another and with the CPUs. Thus the mater- ial in this section frequently applies to both kinds of systems. The fundamental reason why multiprocessor and multicomputer intercon- nection networks are similar is that at the very bottom both of them use message CA2020 Kiến trúc máy tính 509 NKK-HUST Đa xử lý bộ nhớ phân tán CA2020 Kiến trúc máy tính 510 NKK-HUST Mạng liên kếtSEC. 8.4 MESSAGE-PASSING MULTICOMPUTERS 619 (a) (c) (e) (g) (b) (d) (f) (h) Figure 8-37. Various topologies. The heavy dots represent switches. The CPUs and memories are not shown. (a) A star. (b) A complete interconnect. (c) A tree. (d) A ring. (e) A grid. (f) A double torus. (g) A cube. (h) A 4D hypercube. Interconnection networks can be characterized by their dimensionality. For our purposes, the dimensionality is determined by the number of choices there are to get from the source to the destination. If there is never any choice (i.e., there is only one path from each source to each destination), the network is zero dimen- sional. If there is one dimension in which a choice can be made, for example, go CA2020 Kiến trúc máy tính 511 NKK-HUST Massively Parallel Processors n Hệ thống qui mô lớn n Đắt tiền: nhiều triệu USD n Dùng cho tính toán khoa học và các bài toán có số phép toán và dữ liệu rất lớn n Siêu máy tính CA2020 Kiến trúc máy tính 512 NKK-HUST IBM Blue Gene/P 624 PARALLEL COMPUTER ARCHITECTURES CHAP. 8 coherency between the L1 caches on the four CPUs. Thus when a shared piece of memory resides in more than one cache, accesses to that storage by one processor will be immediately visible to the other three processors. A memory reference that misses on the L1 cache but hits on the L2 cache takes about 11 clock cycles. A miss on L2 that hits on L3 takes about 28 cycles. Finally, a miss on L3 that has to go to the main DRAM takes about 75 cycles. The four CPUs are connected via a high-bandwidth bus to a 3D torus network, which requires six connections: up, down, north, south, east, and west. In addition, each processor has a port to the collective network, used for broadcasting data to all processors. The barrier port is used to speed up synchronization operations, giv- ing each processor fast access to a specialized synchronization network. At the next level up, IBM designed a custom card that holds one of the chips shown in Fig. 8-38 along with 2 GB of DDR2 DRAM. The chip and the card are shown in Fig. 8-39(a)–(b) respectively. 1 Chip 4 CPUs 2 GB 4 processors 8-MB L3 cache 2-GB DDR2 DRAM 32 Cards 32 Chips 128 CPUs 64 GB 32 Boards 1024 Cards 1024 Chips 4096 CPUs 2 TB 72 Cabinets 73728 Cards 73728 Chips 294912 CPUs 144 TB SystemCabinetBoardCardChip: (b) (c) (d) (e)(a) Figure 8-39. The BlueGene/P: (a) chip. (b) card. (c) board. (d) cabinet. (e) system. The cards are mounted on plug-in boards, with 32 cards per board for a total of 32 chips (and thus 128 CPUs) per board. Since each card contains 2 GB of DRAM, the boards contain 64 GB apiece. One board is illustrated in Fig. 8-39(c). At the next level, 32 of these boards are plugged into a cabinet, packing 4096 CPUs into a single cabinet. A cabinet is illustrated in Fig. 8-39(d). Finally, a full system, consisting of up to 72 cabinets with 294,912 CPUs, is depicted in Fig. 8-39(e). A PowerPC 450 can issue up to 6 instructions/cycle, thus CA2020 Kiến trúc máy tính 513 NKK-HUST Cluster n Nhiều máy tính được kết nối với nhau bằng mạng liên kết tốc độ cao (~ Gbps) n Mỗi máy tính có thể làm việc độc lập (PC hoặc SMP) n Mỗi máy tính được gọi là một node n Các máy tính có thể được quản lý làm việc song song theo nhóm (cluster) n Toàn bộ hệ thống có thể coi như là một máy tính song song n Tính sẵn sàng cao n Khả năng chịu lỗi lớn CA2020 Kiến trúc máy tính 514 NKK-HUST PC Cluster của Google SEC. 8.4 MESSAGE-PASSING MULTICOMPUTERS 635 hold exactly 80 PCs and switches can be larger or smaller than 128 ports; these are just typical values for a Google cluster. 128-port Gigabit Ethernet switch 128-port Gigabit Ethernet switch Two gigabit Ethernet links 80-PC rack OC-48 FiberOC-12 Fiber Figure 8-44. A typical Google cluster. Power density is also a key issue. A typical PC burns about 120 watts or about 10 kW per rack. A rack needs about 3 m2 so that maintenance personnel can in- stall and remove PCs and for the air conditioning to function. These parameters give a power density of over 3000 watts/m2. Most data centers are designed for 600–1200 watts/m2, so special measures are required to cool the racks. Google has learned three key things about running massive Web servers that bear repeating. 1. Components will fail so plan for it. 2. Replicate everything for throughput and availability. 3. Optimize price/performance. CA2020 Kiến trúc máy tính 515 NKK-HUST 9.4. Bộ xử lý đồ họa đa dụng n Kiến trúc SIMD n Xuất phát từ bộ xử lý đồ họa GPU (Graphic Processing Unit) hỗ trợ xử lý đồ họa 2D và 3D: xử lý dữ liệu song song n GPGPU – General purpose Graphic Processing Unit n Hệ thống lai CPU/GPGPU n CPU là host: thực hiện theo tuần tự n GPGPU: tính toán song song CA2020 Kiến trúc máy tính 516 NKK-HUST Bộ xử lý đồ họa trong máy tính CA2020 Kiến trúc máy tính 517 NKK-HUST GPGPU: NVIDIA Tesla nStreaming multiprocessor n8 × Streaming processors CA2020 Kiến trúc máy tính 518 NKK-HUST GPGPU: NVIDIA Fermi 7 Hardware Execution CUDA’s hierarchy of threads maps to a hierarchy of processors on the GPU; a GPU executes one or more kernel grids; a streaming multiprocessor (SM) executes one or more thread blocks; and CUDA cores and other execution units in the SM execute threads. The SM executes threads in groups of 32 threads called a warp. While programmers can generally ignore warp execution for functional correctness and think of programming one thread, they can greatly improve performance by having threads in a warp execute the same code path and access memory in nearby addresses. An Overview of the Fermi Architecture The first Fermi based GPU, implemented with 3.0 billion transistors, features up to 512 CUDA cores. A CUDA core executes a floating point or integer instruction per clock for a thread. The 512 CUDA cores are organized in 16 SMs of 32 cores each. The GPU has six 64-bit memory partitions, for a 384-bit memory interface, supporting up to a total of 6 GB of GDDR5 DRAM memory. A host interface connects the GPU to the CPU via PCI-Express. The GigaThread global scheduler distributes thread blocks to SM thread schedulers. Fermi’s 16 SM are positioned around a common L2 cache. Each SM is a vertical rectangular strip that contain an orange portion (scheduler and dispatch), a green portion (execution units), and light blue portions (register file and L1 cache). CA2020 Kiến trúc máy tính 519 NKK-HUST NVIDIA Fermi 8 Third Generation Streaming Multiprocessor The third generation SM introduces several architectural innovations that make it not only the most powerful SM yet built, but also the most programmable and efficient. 512 High Performance CUDA cores Each SM features 32 CUDA processors—a fourfold increase over prior SM designs. Each CUDA processor has a fully pipelined integer arithmetic logic unit (ALU) and floating point unit (FPU). Prior GPUs used IEEE 754-1985 floating point arithmetic. The Fermi architecture implements the new IEEE 754-2008 floating-point standard, providing the fused multiply-add (FMA) instruction for both single and double precision arithmetic. FMA improves over a multiply-add (MAD) instruction by doing the multiplication and addition with a single final rounding step, with no loss of precision in the addition. FMA is more accurate than performing the operations separately. GT200 implemented double precision FMA. In GT200, the integer ALU was limited to 24-bit precision for multiply operations; as a result, multi-instruction emulation sequences were required for integer arithmetic. In Fermi, the newly designed integer ALU supports full 32-bit precision for all instructions, consistent with standard programming language requirements. The integer ALU is also optimized to efficiently support 64-bit and extended precision operations. Various instructions are supported, including Boolean, shift, move, compare, convert, bit-field extract, bit-reverse insert, and population count. 16 Load/Store Units Each SM has 16 load/store units, allowing source and destination addresses to be calculated for sixteen threads per clock. Supporting units load and store the data at each address to cache or DRAM. Dispatch Unit Warp Scheduler Instruction Cache Dispatch Unit Warp Scheduler Core Core Core Core Core Core Core Core Core Core Core Core Core Core Core Core Core Core Core Core Core Core Core Core Core Core Core Core Core Core Core SFU SFU SFU SFU LD/ST LD/ST LD/ST LD/ST LD/ST LD/ST LD/ST LD/ST LD/ST LD/ST LD/ST LD/ST LD/ST LD/ST LD/ST LD/ST Interconnect Network 64 KB Shared Memory / L1 Cache Uniform Cache Core Register File (32,768 x 32-bit) CUDA Core Operand Collector Dispatch Port Result Queue FP Unit INT Unit Fermi Streaming Multiprocessor (SM) 8 l i i i i i i i l l i i i i l i l ( ) i i i l l i i i i . i l i l ( ) i i i l i li i iti it i l fi l i t , it l f r i i i t iti . i r r t t rf r i t r ti r t l . i l t l r i i . I , t i t r li it t - it r i i f r lti l r ti ; r lt, lti-i tr ti l ti r r ir f r i t r rit ti . I r i, t l i i t r rt f ll - it r i i f r ll i tr ti , i t t it t r r r i l r ir t . i t r i l ti i t ffi i tl rt - it t r i i r ti . ri i tr ti r rt , i l i l , ift, , r , rt, it-fi l tr t, it-r r i rt, l ti t. / t r it ach has 16 l a /st re units, all in s urce an estinati n a resses t e calculate for sixteen threa s er clock. u orting units loa an store the ata at each a ress to cache or . r r r r / / / / / / / / / I t r t t r 64 are e ry / 1 ac e if r ac e lt i I i r i tr i lti r r ( ) n Có 16 Streaming Multiprocessors (SM) n Mỗi SM có 32 CUDA cores. n Mỗi CUDA core (Cumpute Unified Device Architecture) có 01 FPU và 01 IU CA2020 Kiến trúc máy tính 520 NKK-HUST Hết CA2020 Kiến trúc máy tính 521

Các file đính kèm theo tài liệu này:

  • pdfbai_giang_mon_kien_truc_may_tinh.pdf
  • pdfCA2020-Ch1-Giới thiệu.pdf
  • pdfCA2020-Thầy Khánh-Ch2-Cơ bản về logic số.pdf
  • pdfCA2020-Thầy Khánh-Ch3-Hệ thống máy tính.pdf
  • pdfCA2020-Thầy Khánh-Ch4-Số học máy tính.pdf
  • pdfCA2020-Thầy Khánh-Ch5-Kiến trúc tập lệnh.pdf