Skip to content

HeteroCL v0.5

Latest
Compare
Choose a tag to compare
@chhzh123 chhzh123 released this 20 Feb 08:09
· 19 commits to main since this release

Overview

We are thrilled to announce the latest version of HeteroCL, which has undergone a complete migration from Halide IR to the MLIR ecosystem. The first release of HeteroCL-MLIR features a brand new Python frontend with HeteroCL AST, an IR system built around the newly designed HeteroCL dialect, an LLVM CPU backend, a Vivado HLS backend, and an Intel HLS backend.

The integration with MLIR allows HeteroCL to take advantage of the general, modular and powerful infrastructure provided by the MLIR ecosystem, making it easier to maintain and extend the system. We have also made numerous improvements to the system, including a systematic and extensible frontend design, more customization primitives, and performance enhancements. The functionality of the previous HalideIR-based system is well preserved in this new version, and we have ensured backward compatibility by passing all the unit tests.

We believe that these improvements will make HeteroCL an even more versatile and efficient tool for developing high-performance hardware designs. We invite all users to try out the new version and provide feedback on their experiences.

New Features

Frontend

HeteroCL Python program -> HeteroCL AST (Python) -> MLIR IR

  • HeteroCL AST: an abstraction layer above MLIR IR, consisting of expressions and operations. AST simplifies the frontend design and IR building process and solves the MLIR operation scope issue.
  • AST passes: transformation and legality checking passes on AST before IR generation.
  • Extensible type system: including a type inference engine and an extensible set of type rules. Typing is performed on AST during tracing.
  • IRBuilder: traverse HeteroCL AST and build corresponding MLIR IR operations.

IR System

The HeteroCL dialect covers all customization primitives available in the Halide-based IR system. The newly added primitives and utilities include:

  • hcl.customization: defines a specification of parameterized customization
  • hcl.apply: apply a customization spec on given inputs
  • hcl.buffer_at: create a write buffer at given loop axis
  • hcl.reverse: reverse input integer bits
  • hcl.outline: outline operations to a function, supports unification
  • hcl.reform: transform data layout format of a memref
  • hcl.clone: clone functions
  • File IO: read memref data from file, write memref data to file

API Changes

Front end API changes include:

  • Scalar.v: the .v is now required to access the value of the scalar.
  • Bit slicing behavior: the bit slicing behavior now matches Python convention, for example, v[3:5] returns a 2-bit unsigned integer containing the third and forth bit of v.
  • Tag: hcl.Stage is no longer supported, we use tag to access imperative loop nests.

Deprecated APIs

  • hcl.Stage: hcl.Stage is removed, using it will cause an error.
  • @def: deprecated but still supported, using it will cause a warning.

Known Issues

  • Data Placement
    • Host-xcel data placement after schedule customization is not supported, because dataflow graph partition is applied in the front-end.
    • Intra-kernel data placement is not implemented yet.
  • Break and multiple return statements are not supported.
  • Fixed-point divisions larger than 32-bits are not supported.
  • Logical and, logical or does not support short-circuit evaluation.
  • Invert is not implemented yet.
  • Math operations including trigonometric, exponential, logarithmic functions are not implemented yet.
  • Customizing functions defined by @def decorator is not supported yet.
  • CSim, CSynth, HLS report are not yet supported in the HLS backend.
  • Print operation limitations
    • Currenly only integer and float format printing in LLVM backend is supported.
    • Hexadecimal, binary, unsigned integer formats are not yet supported.
    • Printing in HLS is not yet supported.
  • Limited support for simplifier: Only constant and binary op are supported for now.
  • Source code information (e.g., file name, line number) support is thoroughly tested.

How to Upgrade

For users, you can directly run pip install . in the heterocl frontend folder. For developers, please follow the README in hcl-dialect repository for a step-by-step guide to compile the IR system and set up the end-to-end flow.

Feedback and Support

We encourage users to submit any issues they encounter, along with a minimal reproducible example to help us identify and solve the problem as quickly as possible.