Skip to content

Instantly share code, notes, and snippets.

@angelz913
Last active June 18, 2024 15:11
Show Gist options
  • Save angelz913/ce6cb9152e14bbaffe2316145139f863 to your computer and use it in GitHub Desktop.
Save angelz913/ce6cb9152e14bbaffe2316145139f863 to your computer and use it in GitHub Desktop.

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.
  • Add a conversion for scf.parallel.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment