llvm-aie

llvm-aie

Fork of LLVM to support AMD AIEngine processors

Stars: 100

Visit
 screenshot

This repository extends the LLVM framework to generate code for use with AMD/Xilinx AI Engine processors. AI Engine processors are in-order, exposed-pipeline VLIW processors focused on application acceleration for AI, Machine Learning, and DSP applications. The repository adds LLVM support for specific features like non-power of 2 pointers, operand latencies, resource conflicts, negative operand latencies, slot assignment, relocations, code alignment restrictions, and register allocation. It includes support for Clang, LLD, binutils, Compiler-RT, and LLVM-LIBC.

README:

AIEngine Fork of LLVM

This repository extends the LLVM framework to generate code for use with AMD/Xilinx AI Engine processors.

Architecture clang/LLVM target Low-level Intrinsic API High-Level Intrinsic API (AIE_API) Architecture Manual
XDNA (Phoenix, Hawk Point) --target=aie2-none-unknown-elf Link Link Link
XDNA2 (Strix Point) coming soon coming soon coming soon coming soon

Architecture Overview

Generally speaking, AI Engine processors are in-order, exposed-pipeline VLIW processors. These processors are implemented as part of an array of processors focused on application acceleration targetting AI, Machine Learning, and DSP applications. They have been integrated in a number of commercial devices including the Versal AI Core Series and Ryzen-AI SOCs.

Each VLIW instruction bundle specifies the behavior of one or more functional units, which begin executing a new instruction at the same time. The processor pipeline does not include stall logic, and instructions will continue executing in order regardless of other instructions in the pipeline. As a result, the compiler is able to schedule machine instructions which access the same register in ways that potentially overlap. e.g.

1:   lda r12, [p0]     // writes r12 after cycle 8.
2:   nop
3:   nop
4:   mul r12, r12, r12 // reads r12 initial value and writes r12 after cycle 6.
5:   mov r14, r12      // reads r12 initial value
6:   nop
7:   add r13, r12, r6  // reads r12 from instruction 4.
8:   nop
9:   mul r14, r12, r7  // reads r12 from instruction 1.

Other key architectural characteristics include varying width instruction slots between different instruction encodings and relatively small address spaces (20-bit pointer registers). The presence of varying-width instruction slots implies some code alignment restrictions for instructions which are branch or return targets.

Implementation

In order to support the unusual architecture features of AI Engine, this repository adds LLVM support for several specific features:

  • support for non-power of 2 pointers;
  • improved TableGen support for specifying operand latencies and resource conflicts of exposed pipeline instructions;
  • scheduler support for negative operand latencies (i.e. an instruction writing to a register may be scheduled after a corresponding use);
  • scheduler support for slot assignment for instructions that can be issued in multiple VLIW slots;
  • support for selecting relocations for instructions with multiple encodings;
  • support for architectures with code alignment restrictions;
  • improved register allocation support for complex register hierarchies, specifically related to spills of sub-registers of large compound-registers;

Support for Clang, LLD, binutils (e.g. 'llvm-objdump'), Compiler-RT, and LLVM-LIBC is also included.

Disclaimer

Note that this repository does not implement a generic compiler and may not completely support other technologies. If you require a generic compiler or need to compile code for use with different technologies, you will need to select a different compiler. The implementation maturity is generally similar to other 'Experimental' LLVM architectures. For critical designs, please use the production compiler.

Modifications (c) Copyright 2022-2024 Advanced Micro Devices, Inc. or its affiliates

The LLVM Compiler Infrastructure

OpenSSF Scorecard OpenSSF Best Practices libc++

Welcome to the LLVM project!

This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.

The LLVM project has multiple components. The core of the project is itself called "LLVM". This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.

C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.

Other components include: the libc++ C++ standard library, the LLD linker, and more.

Getting the Source Code and Building LLVM

Consult the Getting Started with LLVM page for information on building and running LLVM.

For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.

Getting in touch

Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.

The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.

For Tasks:

Click tags to check more tools for each tasks

For Jobs:

Alternative AI tools for llvm-aie

Similar Open Source Tools

For similar tasks

For similar jobs