Skip to content

Instantly share code, notes, and snippets.

View angelz913's full-sized avatar

Angel Zhang angelz913

View GitHub Profile

This PR implements a MVP version of an MLIR lowering pipeline to SPIR-V. The goal is to have a better test coverage of SPIR-V compilation upstream and enable writing simple kernels by hand. The dialects supported in this version include arith, vector (only 1-D vectors with size 2,3,4,8 or 16), scf, ub, index, func and math.

Relevant links:

Future plans:

  • Add conversion patterns for other dialects, e.g. gpu, tensor, etc.
  • Include vector transformation to unroll vectors to 1-D, and handle those with illegal sizes.
  • Implement multiple-return. SPIR-V does not support multiple return values since a spirv.func can only return zero or one values. It might be possible to wrap the return values in a spirv.struct.

Table of Contents

  1. Linux
  2. LLVM
  3. MLIR

Linux

Search for a file in a specific directory

find $DIR -name ...

Table of Contents

  1. ConvertToLLVM
  2. ConvertToSPIRV(IREE)
  3. Comparison

ConvertToLLVM

ConvertToLLVMPass

  • A generic pass to convert to LLVM, using the ConvertToLLVMPatternInterface to delegate to dialects the injection of conversion patterns