From the HSAIL Spec Editor
The HSA Foundation has just released version 0.95 of the Programmer’s Reference Manual, which we affectionately refer to as “the HSAIL spec”. This has been in development for more than a year, and I’m proud to finally be able to share our work with the external world. My role in the process was the working-group spec editor for the 0.95 version. The spec also benefitted significantly from the contributions of Norm Rubin (who wrote the original draft), and Tony Tye (who polished the final one), as well as the contributions from the many architects and experts from the companies in the working-group.
The spec describes HSAIL (HSA Intermediate Language, pronounced “H-Sale”). HSAIL is a low-level intermediate language for a wide variety of parallel processor architectures (including GPUs) supported by members of the HSA Foundation. HSAIL is a preferred target for library writers and back-end compiler developers who want to target HSA compute devices, and who want to deliver their own optimizations and control the compilation. HSAIL is architected such that register allocation and other complex compiler optimizations are done before HSAIL is generated, which leads to a robust and fast translation from HSAIL to the device instruction set. HSAIL also includes a well-defined relaxed memory model including load.acquire, store.release, barrier, and fine-grained barrier operations. HSAIL is designed to support a wide variety of high-level programming models such as OpenCL™, OpenMP™, C++, and Java. HSAIL also defines a binary format called “BRIG” that can be embedded in executable files alongside the code for the host CPU instruction-set.
Writing in HSAIL is similar to writing in assembly language for a RISC CPU : the language uses a load/store architecture, supports fundamental integer and floating point operations, branches, atomic operations, multi-media operations, and uses a fixed-size pool of registers. HSAIL also contains built in support for function pointers, exceptions and debugging information. Additionally, HSAIL defines group memory, hierarchical synchronization primitives, and wavefronts that should look familiar to programmers of GPU computing devices.
Today, many accelerator devices have separate address spaces that require cumbersome copy operations, and prevent complex pointer-containing data structures from being used on the accelerator and host. HSA platforms address this challenge by requiring that all HSA Components can access the same shared, coherent memory space with high performance. HSAIL helps to address the other major challenge with programming heterogeneous computing devices: today accelerator programmers typically have to use a dedicated “compute language” such as OpenCL™ or CUDA™ to access the power of the accelerator. A primary goal of HSA is to bring the power of these compute devices to the programming languages that developers are already using, in a natural and easy-to-use manner. We are seeing this already with the introduction of C++ AMP, Java Aparapi, and Bolt – programmers are able to access parallel compute resources using programming models that are no more complex than those used for multi-core CPUs. HSAIL adds the benefits of a portable IR, yet still low-level enough to give language and compiler vendors control over the code generation and associated optimizations. Additionally, HSAIL is a royalty-free open standard – and open standards spur innovation , eliminate reliance on a single vendor, and always win over time. The HSA Foundation will be providing publicly available assemblers and disassembler tools for HSAIL, and will additionally provide a code generator back-end for the popular LLVM compiler infrastructure. LLVM already contains front-end parsers for many popular programming models. Combined with language constructs to identify parallel regions (some of which already exist), these can be naturally extended to leverage HSAIL and the power efficiency and performance benefits of heterogeneous computing.
It has been a long journey and we are excited to share the next steps with the broader development community!
For more info, go to the HSA Foundation website
The spec is available for download.
AMD Fellow, architect for HSA & Main Spec Editor for the HSA Programer Reference Manual
This post is the opinion of the author and may not represent AMD’s positions, strategies or opinions. Links to third party sites and references to third party trademarks are provided for convenience and illustrative purposes only. Unless explicitly stated, AMD is not responsible for the contents of such links, and no third party endorsement of AMD or any of its products is implied.