From Liquid Metal Wiki


General information about Liquid Metal[edit]

What is Liquid Metal ?[edit]
  • The Liquid Metal system provides a high-level language and toolchain targeting heterogeneous systems which mix CPUs, GPUs, and FPGAs.
What is the purpose of Liquid Metal ?[edit]
  • Liquid Metal is primarily a research vehicle for studying high-level language support for heterogeneous systems with hardware accelerators.
What is Lime ?[edit]
  • Lime is the Liquid Metal programming language; it extends Java with constructs to express parallelism, isolation, bounded types, and stream dataflow.
What other languages is Lime related to?[edit]
  • Lime is based primarily on Java. To a first approximation, Lime is a superset of Java.
  • OpenCL also supports heterogeneous systems.
What is the origin of Liquid Metal ?[edit]
  • Liquid Metal has been under developed as a research project at the IBM T. J. Watson Research Center since the spring of 2007.
What is the origin of the name Liquid Metal?[edit]
  • The name came about during a middle of the night instant messaging discussion between two of the founding members of the project. They believed the name was playful and intriguing while also capturing the essence and vision for the project, then in its infancy.
Don't you know that Liquid Metal really means a metal in a liquid state, a Sirius XM radio channel, a fictional substance from the Terminator series, or a type of metallic glass?[edit]
  • Yes.
What is Liquid Metal especially good for?[edit]
  • Liquid Metal is particularly useful for prototyping hardware designs, and enabling rapid iteration for algorithms as typical in software.
  • Liquid Metal provides a much higher level of abstraction for designing hardware than conventional alternatives.
  • Liquid Metal can serve as a rich testbench facility for testing existing hardware designs.
  • Blokus.
What is Liquid Metal not so good at?[edit]
  • Liquid Metal is in active development, so coding to Liquid Metal is still a bit of a moving target. Notable current gaps include library support, various IDE features, runtime performance of certain Lime idioms, and the size of the language subset that the compiler can compile to HDL. We are actively working on all these issues.
What is planned to be added to Liquid Metal in the near future?[edit]
  • The main current efforts concern language stability, robustness, and performance.

Using Liquid Metal[edit]

What license is Liquid Metal released under?[edit]
  • We use a version of the alphaWorks license (follow the link to read it). When you install Liquid Metal into Eclipse as described in the Quick Start you will be presented with that license and asked to agree to its terms.
What systems is it available on?[edit]
  • The Liquid Metal IDE runs on Eclipse and should run anywhere Eclipse does. We routinely test the tools on Mac OSX, Windows 7, and various Linux flavors.
Who should use the language?[edit]
  • For the moment, Liquid Metal is suitable as a research prototype, for researchers wishing to experiment with a bleeding-edge language.
Is IBM using Liquid Metal?[edit]
  • IBM is currently evaluating Liquid Metal as a research prototype. Liquid Metal does not yet ship in any products.
How does Liquid Metal relate to Eclipse?[edit]
  • The Liquid Metal IDE (the Liquid Metal Development Toolkit) runs in Eclipse and is provided as a set of Eclipse plugins. Parts of the Lime compiler are implemented as adaptations of code from the Eclipse Java Development Toolkit (JDT).
How do I report a bug in Liquid Metal?[edit]
  • We do not currently have a public bug tracker. To report a bug, please e-mail lime@us.ibm.com.
How can I contribute code to the Liquid Metal project?[edit]
  • Liquid Metal is not an open-source project and we are not accepting code contributions at this time.
Is there an IDE for Lime?[edit]
  • Yes, there is an Eclipse-based IDE for Lime called LDT.
Is there a debugger for Lime?[edit]
  • The Lime IDE contains some flakey debug support using Eclipse debugging facilities; however the Lime Debug feature is untested, unstable, and unsupported.

Lime Language Overview[edit]

Is Lime an object-oriented language?[edit]
  • Yes. Lime extends Java, including all object-oriented features of Java.
Caveat emptor: The compiler will currently exclude Lime code from FPGA compilation unless it can statically resolve all types and dispatch targets. At this time, you should not plan to use "real" runtime polymorphism in code intended for relocation to an FPGA. The compiler provides exclusion warnings to help identify such issues.
Is Lime a functional language?[edit]
  • The full Lime language is not a functional language; like Java, Lime programs may contain imperative code with mutable state.
However, unlike Java, certain constructs in the Lime type system can constrain expressions to a functional subset of the language. Notably, the type system ensures that a static local method whose formal parameters are all values is a pure function.
How does Lime compare with Verilog or VHDL ?[edit]
  • Lime is a higher level programming model than Verilog or VHDL. In general, Lime code should be much more concise than the equivalent Verilog or VHDL. The Lime compiler generates Verilog.
How does Lime compare with Bluespec SystemVerilog?[edit]
  • Bluespec SystemVerilog is aimed at hardware designers accustomed to writing designs in HDL. Lime is aimed at software developers who may know little to nothing about designing FPGAs or ASICs.
How does Lime compare with SystemC ?[edit]
  • SystemC is a class library embedded in C++ designed to support HDL-style hardware design with C syntax. Lime is a full-fledged high-level language based on Java, enhanced with constructs to express certain forms of structured parallelism and isolation. Lime provides a much higher level of programming abstraction than SystemC. SystemC is much closer to the underlying hardware and can express a wider variety of hardware structures than is possible in Lime.
How does Lime compare with OpenCL ?[edit]
  • Like OpenCL, Lime targets heterogeneous systems, and aims to provide a higher level of abstraction for programming devices and managing communication between host and device.
  • Like OpenCL, only a subset of the full language can typically be implemented on a specialized device.
  • Lime is based on Java; OpenCL is based on C99 for kernels and has host bindings for many languages.
  • Lime provides a much higher level of abstraction for expressing coordination and communication as compared to OpenCL.
  • OpenCL is relatively mature, supported by many companies as a production-ready tool, and used by many thousands of programmers. Lime is a research prototype that is not generally available, and no one claims Lime is ready for prime time yet.
Why did you base Lime off Java instead of C or C++?[edit]
  • We like Java better than C or C++.
Why didn't you base Lime off some language which I like better than Java, like Scala, or Haskell, or ML, or Prolog, or Python, or Fortran, or X10, or Erlang, or Javascript, or APL, or Algol-60, or x86 assembly language, or French, or the Simply-Typed Lambda Calculus?[edit]
  • We wanted to start with a language with a large install base among our potential customers.

Writing Code in Lime[edit]

Why is Lime sometimes different from Java?[edit]
  • When compiling to hardware, the compiler often needs to determine certain properties about the program, such as bounds on data structure sizes, bit width information, and aliasing restrictions. Lime enhances the Java type system in order to express and check these properties.
Is there a Lime programming guide?[edit]
Is there a guide of design patterns for Lime?[edit]
  • No, there is no guide of Lime Design Patterns at this time.
Where can I find some example code?[edit]
  • The Lime IDE includes sample projects which you can easily generate into your Eclipse workspace. See the Programmers Guide for installation instructions and descriptions of some sample code.
How do I get good performance from my Lime code?[edit]
  • Good question.
    • When compiling to bytecode and running on a JVM, you should not expect good performance. The bytecode/JVM implementation is intended for prototyping only, and certain language features will cause significant slowdowns compared to pure Java.
    • When compiling to Verilog, are you feeling lucky?
      • We don't have a simple answer to this question. The Lime compiler is under active development, and performance will vary depending on how effective the compiler optimizations are for your program.
      • In the future we will try to publish some sort of peformance tips and support a verilog profiling tool, but they are not yet available. For now, we encourage you to share your code with us and let us help you understand your code's performance issues.


What compiler technologies are used to build the compilers?[edit]
  • The Lime compiler uses the LPG parser generator, the Eclipse Java Development Kit, and WALA. The LDT builds on the Eclipse framework.
How does the compiler translate Lime to Verilog?[edit]
  • The compiler performs many aggressive optimizations, including inlining, classical dataflow optimizations, aggressive scalar replacement, scheduling and resource allocation, range and bitwidth analysis, strength reduction, if-conversion, loop optimizations, and branch optimizations. The bulk of the user logic is generated into a single large finite state machine, which mirrors the (interprocedural) control-flow graph after optimizations, adjusted for resource and critical path constraints. The compiler maps arrays to BRAMs or distributed RAMs; the design does not utilize on-board SRAM or DRAM.
Will the quality of the compiler-generated Verilog match the quality of Verilog generated by an expert human ?[edit]
  • Probably not.
Will the quality of the compiler-generated Verilog match the quality of Verilog generated by a well-trained monkey ?[edit]
  • Probably.
So somewhere between a human and a monkey then?[edit]
  • Bingo.
What about a chimpanzee?[edit]
  • Haven't done that study yet.

Lime Language Details[edit]

What is a value?[edit]
  • The Lime value type qualifier indicates a class of immutable objects.
How does Lime deal with concurrency?[edit]
  • Lime provides two families of constructs to express concurrency:
  1. Lime taskgraphs provide constructs to express coarse-grain data flow graphs which potentially cross device boundaries, and
  2. Lime includes data parallel map (@) and reduce (!) constructs to express loop-level parallelism.
Caveat emptor: The current FPGA compiler will not necessarily generate parallel circuits from the data parallel Lime constructs. At this time, you probably shouldn't rely on the data parallel constructs to express parallelism for the FPGA.
How does Lime deal with pointers?[edit]
  • Like Java, Lime is a strongly-typed object-oriented language. Lime supports references to objects, but not pointer arithmetic nor unconstrained casting between types.
What are generic classes?[edit]
  • Like Java, Lime supports generic types, which are types that take other types as parameters.

Crashes, Bugs, and Other Issues[edit]

Where can I find out about known bugs?[edit]
  • We do not currently have a public bug tracker. If you think you're seeing a bug, feel free to post in the Liquid Metal Google Group for help.
Where can I report a new bug?[edit]
  • We do not currently have a public bug tracker. If you think you're seeing a bug, feel free to post in the Liquid Metal Google Group for help.