Skip to Content
AI 시스템 성능 엔지니어링 (Korean Edition)
book

AI 시스템 성능 엔지니어링 (Korean Edition)

by Chris Fregly
November 2025
Beginner to intermediate
1060 pages
20h 15m
Korean
O'Reilly Media, Inc.
Content preview from AI 시스템 성능 엔지니어링 (Korean Edition)

제7장. GPU 메모리 액세스 패턴자질 및 튜닝

이 작품은 AI를 사용하여 번역되었습니다. 여러분의 피드백과 의견을 환영합니다: translation-feedback@oreilly.com

AI 모델의 규모와 복잡성이 증가함에 따라 GPU의 메모리 시스템은 종종 이론적 연산 능력과 실제 성능 사이의 병목 현상이 됩니다. 6장에서 살펴본 바와 같이, 현대 NVIDIA GPU는 수천 개의 단순하고 처리량 최적화된 코어와 특수화된 텐서 코어를 결합합니다. 또한 고대역폭 메모리(HBM), 일관된 CPU-GPU 통합 메모리 주소 공간(예: Grace Blackwell Superchip), 온칩 공유 메모리, 캐시, 텐서 메모리 가속기(TMA)와 같은 특수화된 직접 메모리 액세스(DMA) 엔진을 포함합니다.

이 장에서는 효율적인 메모리 접근을 위한 데이터 구조 정렬, 중복 데이터 로드 제거, 하드웨어를 활용한 데이터 전송과 연산 중첩을 실현하는 다양한 CUDA C++ 및 PyTorch 최적화 기법을 살펴봅니다.

행렬 곱셈, 텐서 연산 등의 구체적인 전후 비교 예시를 통해 메모리 접근 패턴, 타일링 전략, 비동기 데이터 전송의 작은 변화가 어떻게 낭비되는 대역폭을 줄이고 산술 효율을 높이며 커널을 메모리 제약에서 연산 제약으로 전환하는지 확인할 수 있습니다.

이 장을 마치면 GPU의 메모리 계층 구조와 하드웨어 최적화 데이터 전송 엔진을 더 잘 활용하는 CUDA 커널 작성법을 알게 될 것입니다.

통합된 글로벌 메모리 액세스 대 비통합된 글로벌 메모리 액세스

코드의 메모리 접근 패턴 은 성능에 큰 영향을 미칠 수 있습니다. 글로벌 메모리 액세스는 워프 내 스레드들이 연속된 메모리 주소에 접근할 때 가장 빠릅니다. 이때 하드웨어가 이를 더 적은 수의 더 큰 트랜잭션으로 결합할 수 있기 때문입니다. 스레드들이 흩어진 주소나 정렬되지 않은 주소에 접근하면, 장치는 요청을 최소 수의 캐시 라인 트랜잭션으로 결합할 수 없습니다. 현대 GPU에서 캐시 라인은 4개의 32바이트 섹터로 구성된 128바이트 라인입니다. 이로 인해 사용되지 않은 데이터를 가져오는 메모리 트랜잭션이 훨씬 더 많아져 메모리 대역폭을 빠르게 소모합니다.

Blackwell GPU에서 장치당 HBM3e 대역폭은 최대 8TB/s입니다. Grace Blackwell GB200 및 GB300(두 개의 GPU 슈퍼칩) 내에서 이 대역폭은 두 GPU에 걸쳐 16TB/s로 증가합니다. 병합되지 않은 메모리 액세스를 사용하면 과도한 메모리 트랜잭션과 스톨로 인해 이 대역폭의 대부분이 사용되지 않게 됩니다.

비합병 처리 시, 워프 내 각 스레드는 흩어진 주소에서 데이터를 로드합니다. 이로 인해 수많은 개별 메모리 트랜잭션이 발생합니다. 워프 내 스레드가 연속된 주소를 접근하더라도 첫 번째 주소가 128바이트 정렬되지 않으면 워프의 요청이 두 개의 128바이트 캐시 라인을 가로지르게 됩니다.

예를 들어, 워프의 첫 번째 스레드가 128바이트 정렬되지 않은 주소에서 시작하면, 워프의 메모리 요청이 캐시 라인 경계를 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

PostgreSQL로 데이터 및 AI 플랫폼 구축하기 (Korean Edition)

PostgreSQL로 데이터 및 AI 플랫폼 구축하기 (Korean Edition)

Tom Taulli, Benjamin Anderson, Jozef de Vries
도메인 중심 혁신 (Korean Edition)

도메인 중심 혁신 (Korean Edition)

Carola Lilienthal, Henning Schwentner
AI 에이전트를 위한 메모리 관리

AI 에이전트를 위한 메모리 관리

Benjamin Labaschin, Jim Allen Wallace, Andrew Brookins, Manvinder Singh

Publisher Resources

ISBN: 0642572281533