메뉴
HN
Hacker News • 57일 전

크라이드(Kraid), 실제 컴파일러로 거듭나다

IMP
8/10
핵심 요약

오픈소스 그래픽 드라이버 스택인 Panfrost를 위해 개발 중인 새로운 컴파일러 'Kraid'가 모든 Vulkan CTS 테스트를 통과하며 실질적인 컴파일러로 기능하기 시작했습니다. 64비트 연산 등 여러 핵심 기능 지원과 테스트 검증을 마쳤으나, 최적화 및 나머지 셰이더 스테이지 구현 등은 아직 작업 중입니다.

번역된 본문

Collabora 블로그에서 전해지는 소식입니다.

제가 Panfrost 드라이버 스택을 위해 새로 작성 중인 컴파일러인 Kraid에 대해 글을 썼던 마지막 즈음에, 가장 큰 뉴스는 드디어 단 하나의 Vulkan CTS(적합성 테스트)를 통과했다는 것이었습니다. 오늘의 가장 큰 뉴스는 이제 기존 컴파일러가 실패하던 몇 가지 테스트를 포함하여 80만 개의 테스트 전체를 통과했다는 것입니다. 드디어 Kraid가 진정한 의미의 컴파일러가 되었습니다.

하지만 너무 일찍 기뻐하기 전에, 아직 갈 길이 멀다는 점을 알아야 합니다. 100%의 통과율은 컴퓨트 셰이더(Compute shader)만 Kraid를 거쳤을 때의 결과입니다. 정점(Vertex) 및 프래그먼트(Fragment) 셰이딩 작업은 여전히 진행 중입니다. 다음 몇 주 안에 이 부분들이 작동하도록 만들 수 있기를 희망하지만, 아직 구현되지는 않았습니다. 또한 생성된 코드의 품질은 여전히 상당히 낮습니다. 이는 Kraid의 설계 결함이 아니라 전략적인 선택에 따른 것입니다. 레지스터 할당기가 잘못된 할당을 내리도록 방치하면, 레지스터 압박이 심해지고 할당기가 올바른 결정을 내리지 못할 때 컴파일러의 나머지 부분에서 발생할 수 있는 버그를 쉽게 찾아낼 수 있습니다.

하지만 중요한 것은, 이제 코드 품질을 높이기 위한 모든 도구를 갖추게 되었다는 점입니다. 새 컴파일러에 대한 요구 사항 체크리스트의 거의 모든 항목을 달성했습니다. 이제 Kraid는 다음 기능들을 갖추었습니다:

  • 임의의 고정된 예산 내에서 할당할 수 있는 SSA 기반 레지스터 할당기
  • 선형에 가까운 시간 내에 실행되며 항상 프로그램을 원하는 레지스터 수에 맞게 성공적으로 적재하는(Spill) SSA 기반 스플러(Spiller)
  • 64비트 연산에 대한 적절한 처리
  • 소스에 대한 정수 및 부동소수점 확장(Widen) 연산의 적절한 처리
  • 모든 곳에서의 완전하고 정확한 스위즐(Swizzle) 지원
  • 스위즐 및 벡터 수집 연산을 꿰뚫어 보면서 워드(Word) 및 바이트(Byte) 단위의 세분화된 전파가 모두 가능한 복사 전달(Copy-propagation) 패스
  • 16비트 대상(Destination)에 대한 완전한 지원 및 8비트 대상에 대한 완벽하게 에뮬레이션된 지원. (대부분의 명령어는 실제 8비트 대상을 지원하지 않으므로 16비트를 제공하여 이를 가짜로 구현해야 합니다.)
  • 명령어에 대한 인코딩 및 메타데이터는 Arm에서 제공한 XML에서 직접 추출됨
  • 우리가 파악한 명령어의 정확한 의미가 하드웨어와 일치하는지 검증하는 대부분의 명령어에 대한 하드웨어 단위 테스트(Unit test)

이제 앞으로 나아갈 방향은 어디일까요? 컴파일러를 구축했으니, 이제 성능을 최고로 끌어올릴 차례입니다. 핵심적인 부분은 모두 갖춰졌습니다. 이제 기어를 바꿔 생성되는 코드를 살펴보고, 더 나은 성능을 낼 수 있도록 구축한 도구들을 활용하는 데 집중할 것입니다. 아직 작성해야 할 최적화 패스가 몇 가지 남아 있으며, 레지스터 할당기에는 미세 조정이 많이 필요하고, 부울(Boolean) 및 8비트 데이터와 관련된 전략을 다듬어야 합니다. 또한 나머지 두 개의 셰이더 단계(스테이지)를 완성해야 합니다.

정점 셰이더(Vertex shader)는 비교적 간단하지만 프래그먼트 셰이더(Fragment shader)는 조금 더 까다롭습니다. BLEND 및 ATEST 명령어는 레지스터 할당과 관련된 영향을 미치며, BLEND가 때때로 함수 포인터 호출의 형태를 띠기 때문에 블렌드 셰이더 자체가 메인 프래그먼트 셰이더와 블렌드 셰이더 간의 ABI(응용 프로그램 이진 인터페이스)를 정의할 것을 요구합니다. 이로 인해 우리가 아직 해결하지 못한 여러 미묘한 모서리 부분이 IR(중간 표현)에 추가되었습니다. 근본적으로 불가능한 일은 아니지만, 남아있는 설계 작업이 조금 있습니다.

이르면 곧 좋은 성능 향상을 보기 시작할 수 있을 것이라 기대합니다. Kraid는 이미 64비트 연산에서 기존 컴파일러보다 더 나은 성능을 보여주고 있습니다. 앞으로 계속해서 개선함에 따라, 대부분의 워크로드에서 기존 컴파일러와 동일하거나 더 나은 성능을 보여주기를 희망합니다.

원문 보기
원문 보기 (영어)
--> --> --> About Who we are Our expertise Our work Open Source Our ecosystem Services Guide Train Build Integrate Optimize Maintain Industries Automotive Digital TV Silicon OEM VR/AR News & Blog Careers Contact About Services Industries News & Blog Careers Contact --> +44 (0)1223 362967 +1 514 667 2499 contact@collabora.com --> Home » News & Blog » News & Events » --> Home News & Blog News Kraid is a now a real compiler --> Kraid is a now a real compiler --> 30/07/2026 --> Posted on 30/07/2026 by Faith Ekstrand --> Kraid is a now a real compiler Posted on 30/07/2026 by Faith Ekstrand --> Faith Ekstrand July 30, 2026 Share this post: --> Reading time: The last time I wrote about Kraid , the new compiler we're writing for the Panfrost driver stack, the big news was that it was finally passing a single Vulkan CTS test. Today, the big news is that it's now passing all 800,000 of them, including a few the old compiler fails. Kraid is now a real compiler. Before you get too excited, though, we're still far from done. The 100% pass rate is with only compute shaders going through Kraid. Vertex and fragment shading are still works in progress. We'll hopefully have those working in the next few weeks but they aren't implemented yet. Also, the quality of the generated code is still fairly poor. This isn't a problem with the design of Kraid, but rather it was a strategic choice. Having the register allocator make bad allocation decisions helps us ferret out bugs in the rest of the compiler that can occur when the register pressure gets tight and the allocator isn't able to make good decisions. Importantly, however, we now have all the tools in place to make it good. Nearly every single item on our checklist of requirements for the new compiler has been checked off. Kraid now has: An SSA-based register allocator that's capable of allocating within an arbitrary fixed budget An SSA-based spiller that runs in near-linear time and always succeeds at getting the program to fit in the desired number of registers Proper handling of 64-bit operations Proper handling of integer and float widen operations on sources Full and correct swizzle support everywhere A copy-propagation pass capable of propagating both at the word and byte granularity, including seeing through swizzles and vector collect operations Full support for 16-bit destinations and seamlessly emulated support for 8-bit destinations. (Most instructions don't support actual 8-bit destinations, so we have to fake it by giving them 16 bits.) The encoding and any metadata about instructions is extracted directly from XML provided by Arm Hardware unit tests for most instructions which validate our understanding of the instruction's precise semantics against hardware Where do we go from here? Now that we've built the compiler, it's time to make it sing. We have all the core pieces in place. It's now time to shift gears and start looking at the code it generates and using the tools we've built to try and do better. There are still a few optimization passes that need to be written, the register allocator needs a lot of fine-tuning, and we need to refine our strategies around booleans and 8-bit data. We also need to finish off the other two shader stages. Vertex shaders are pretty straightforward but fragment shaders are a bit trickier. The BLEND and ATEST instructions have register allocation implications, and the blend shaders themselves require us to define an ABI between the main fragment shader and the blend shader because BLEND sometimes ends up being a function pointer call. This ends up adding a bunch of subtle corners to the IR which we have yet to sort out. None of it is especially fundamental but there is some design work left to do. Hopefully, we'll start to see some good performance improvements soon. Kraid is already better than the old compiler at 64-bit arithmetic. As we continue to make improvements, it will hopefully match or beat the old compiler for most workloads but that has yet to be seen. Related Posts Kraid: A new compiler for Panfrost Re-thinking framebuffers in PanVK PanVK now uses AFBC by default Related Posts Kraid: A new compiler for Panfrost Re-thinking framebuffers in PanVK PanVK now uses AFBC by default Search the newsroom Search Latest News & Events Kraid is a now a real compiler 30/07/2026 Kraid, the new compiler for the Panfrost driver stack, now passes all Vulkan CTS compute shader tests. This marks a major milestone, with… Cracking Windows Open: Porting RADV to WIN32 28/07/2026 RADV’s experimental Windows port brings Mesa’s open source Vulkan driver for AMD GPUs closer to running real workloads, while highlighting… Building an Arch Linux aarch64 port for Holo Core 17/07/2026 The Holo Core aarch64 preview provides early binaries, sources, and containers for an Arch Linux-based aarch64 port, backed by tooling and… About Collabora Whether writing a line of code or shaping a longer-term strategic software development plan, we'll help you navigate the ever-evolving world of Open Source. View the Korean version of Collabora.com --> 한국어 버전의 Collabora.com 보기 Acesse Collabora.com em Português 한국어 버전의 Collabora.com 보기 Acesse Collabora.com em Português --> Learn more Who we are Services Our expertise Industries Our work Careers Open Source Collabora on LinkedIn Collabora on YouTube Collabora on Mastodon Collabora on Bluesky Collabora on Facebook Collabora RSS Feed Collabora on Twitter --> Collabora on Google+ --> +44 1223 362967 +1 514 667 2499 contact@collabora.com Our website only uses a strictly necessary session cookie provided by our CMS system. To find out more please follow this link . Collabora Limited © 2005-2026. All rights reserved. Privacy Notice . Sitemap . To ensure the Collabora website works as designed, please enable JavaScript. Thanks --> --> -->