- عنوان کتاب: LLVM Compiler for RISC-V Architecture A Unique Approach to Vectorization
- نویسنده: Alexey Bataev
- حوزه: کامپایلر
- سال انتشار: 2025
- تعداد صفحه: 257
- زبان اصلی: انگلیسی
- نوع فایل: pdf
- حجم فایل: 2.16 مگابایت
تکامل سریع معماریهای کامپیوتر، فناوری کامپایلر را اساساً تغییر شکل داده است. پردازندههای مدرن دیگر صرفاً بر اساس اجرای اسکالر طراحی نمیشوند – آنها برای ارائه عملکرد در بارهای کاری مختلف به موازیسازی، برداریسازی و افزونههای تخصصی متکی هستند. در میان معماریهای مجموعه دستورالعملهای باز، RISC-V به دلیل طراحی تمیز و قابلیت توسعه ماژولار خود برجسته است و به پیادهسازیکنندگان اجازه میدهد تا یک پایه پایدار را با افزونههای استاندارد و خاص فروشنده ترکیب کنند. این باز بودن، RISC-V را قادر ساخته است تا از یک پروژه تحقیقاتی به یک معماری جریان اصلی تبدیل شود و مستقیماً با ISA های اختصاصی تثبیتشده رقابت کند. چارچوب کامپایلر LLVM به ستون فقرات این تحول تبدیل شده است. ساختار ماژولار، زیرساخت بهینهسازی قدرتمند و backend چندهدفه آن، آن را به انتخاب بالفعل برای پشتیبانی از معماریهای نوظهور تبدیل میکند. نمایش میانی LLVM و توانایی آن در میزبانی هر دو کامپایل استاتیک و just-intime، اکوسیستمی ایجاد کرده است که در آن صنعت، دانشگاه و جوامع متنباز برای پیشبرد تحقیقات کامپایلر و زنجیره ابزارهای با کیفیت تولید همگرا میشوند. برداریسازی، بحرانیترین مرز در این چشمانداز را نشان میدهد. افزونه برداری RISC-V (RVV) یک مدل برنامهنویسی برداری مقیاسپذیر را معرفی میکند که قادر به سازگاری با سختافزار با طولهای برداری مختلف است و در عین حال رابط نرمافزاری ثابتی را حفظ میکند. این انعطافپذیری نیازمند یک استراتژی کامپایلر پیچیده است. LLVM این موضوع را با انواع برداری مقیاسپذیر، ویژگیهای ذاتی تخصصی و گذرگاههای پیشرفته که شکاف بین IR انتزاعی و کد کارآمد مختص سختافزار را پر میکنند، برطرف میکند. این کتاب ادغام پشتیبانی برداری RISC-V را در LLVM و Clang بررسی میکند. این کتاب با توضیح طبقهبندی RISC-V و افزونههای آن، زنجیره ابزار LLVM و پشتیبانی backend RISC-V آغاز میشود، سپس چالشهای نگاشت معانی RVV به IR LLVM را تجزیه و تحلیل میکند و پس از آن به بررسی دقیق بهینهسازیهای مختص بردار میپردازد. فصلهای بعدی به بررسی طراحی و پیادهسازی بردارسازهای Loop و SLP LLVM میپردازد. این متن با ترکیب نظریه ساخت کامپایلر با جزئیات عملی از پیادهسازیهای دنیای واقعی، دیدگاهی جامع از چگونگی تبدیل کد سطح بالا توسط برداریسازی به فایلهای اجرایی کارآمد RISC-V ارائه میدهد. این کتاب برای مهندسان کامپایلر، محققان و متخصصانی که در حوزه تلاقی زبانهای برنامهنویسی و طراحی سختافزار فعالیت میکنند، در نظر گرفته شده است، جایی که توانایی تبدیل انتزاعات مقیاسپذیر به عملکرد خام، آینده محاسبات را تعریف میکند. این کتاب بر اساس Clang/LLVM نسخه 21.1.0 متنباز نوشته شده است و برخی از ویژگیهای clang را که بخشی از ابزارهای آزادی SiFive است، در نظر میگیرد.
The rapid evolution of computer architectures has fundamentally reshaped compiler technology. Modern processors are no longer designed around scalar execution alone—they rely on parallelism, vectorization, and specialized extensions to deliver performance across workloads. Among the open instruction set architectures, RISC-V stands out for its clean design and modular extensibility, allowing implementers to combine a stable base with standardized and vendor-specific extensions. This openness has enabled RISC-V to grow from a research project into a mainstream architecture, competing directly with entrenched proprietary ISAs. The LLVM compiler framework has become the backbone of this transformation. Its modular structure, powerful optimization infrastructure, and multitarget backend make it the de facto choice for supporting emerging architectures. LLVM’s intermediate representation and its ability to host both static and just-intime compilation have created an ecosystem where industry, academia, and open source communities converge to push forward compiler research and production-quality toolchains. Vectorization represents the most critical frontier in this landscape. The RISC-V Vector Extension (RVV) introduces a scalable vector programming model, capable of adapting to hardware with different vector lengths while maintaining a consistent software interface. This flexibility demands a sophisticated compiler strategy. LLVM addresses this with scalable vector types, specialized intrinsics, and advanced passes that bridge the gap between abstract IR and efficient hardware-specific code. This book examines the integration of RISC-V vector support into LLVM and Clang. It begins by explaining the RISC-V and its extensions taxonomy, LLVM toolchain and RISC-V backend support, then analyzes the challenges of mapping RVV semantics onto LLVM’s IR, followed by a detailed exploration of vector-specific optimizations. The later chapters investigate the design and implementation of LLVM’s Loop and SLP vectorizers. By combining the theory of compiler construction with practical details from real-world implementations, this text provides a comprehensive view of how vectorization transforms high-level code into efficient RISC-V executables. It is intended for compiler engineers, researchers, and practitioners working at the intersection of programming languages and hardware design, where the ability to translate scalable abstractions into raw performance defines the future of computing. This book is based on open source Clang/LLVM version 21.1.0 and considers some features for clang, being part of SiFive Freedom Tools.
این کتاب را میتوانید از لینک زیر بصورت رایگان دانلود کنید:
Download: LLVM Compiler for RISC-V Architecture

نظرات کاربران