论文笔记(9.PET-to-MLIR.DSD.2020)

Information

  • Paper:PET-to-MLIR: A polyhedral front-end for MLIR
  • Author: Konrad Komisarczyk,Eindhoven University of Technology
  • Key words: MLIR C++ Front-end ,polyhedral

Abstract

This paper presents a tool to enter the MLIR compiler framework from C source.The tool is mainly based on two libraries,PET and ISL,and a declarative compiler, Loop Tactics.
Here is a brief introduction of them:

  • PET : PET is a library used to extract the polyhedral model starting from a C code fragment.PET utilizes Clang to obtain a high level AST and generates a compact, ISL-based, polyhedral representation.Clang reports useful diagnosis messages about which part of the input code does not satisfy the requirements of the polyhedral model.( S. Verdoolaege and T. Grosser, “Polyhedral extraction tool,” in Second International Workshop on Polyhedral Compilation Techniques (IMPACT’12), Paris, France, 2012, pp. 1–16.)
  • ISL : ISL allows easy manipulation of the polyhedral representation and efficient code generation.(S. Verdoolaege, “isl: An integer set library for the polyhedral model,”in International Congress on Mathematical Software. Springer, 2010,pp. 299–302.)
  • Loop Tactics : Loop Tactics is an optimizer based on the ISL library supporting the declarative specification of affine transformations.It introduces three main concepts: 1) Schedule tree matchers which allow recognizing patterns in the schedule tree. 2) Access relation matchers that allow inspecting access pattern properties, and 3) builders that allow reconstructing a matched subtree, thus applying a given transformation.

Overview

在这里插入图片描述

在这里插入图片描述

  1. For inputs,users are required to use pragma scop and pargma endscop to dlimit a code fragment.
  2. Then PET models a construct in the scop.
  3. Once the scop has been extracted, and before code generation,optionally, the user can invoke Loop Tactics to detect computational motifs automatically and lift the entry point in MLIR. Lifting the entry point will enable some domain specific optimizations that are not available at the affine level.
  4. Mark nodes are allowed to be inserted by Loop Tactics only and carry the information on what BLAS pattern
    has been detected (i.e., GEMM or BATCHED GEMM).Whenever the PET-to-MLIR code generator hits a mark node,
    the subtree is replaced with a function call to a BLAS library.
  5. To emit control flow operations, PET-to-MLIR walks the ISL AST. For each node, PET-to-MLIR emits the corresponding operation in the affine dialect. In more details, for each isl_ast_node_for PET-to-MLIR emits an Affine::ForOp.

To-do:

  1. If and else construct are not yet handled in the code generation.
  2. Symbolic bounds are not yet handled, and for now, they require all the loop bounds to be statically known.
  3. External function calls in the code fragment are not allowed, and the tool bails-out if a call is detected.
  4. Other operations such as division, as well as, constant accesses to arrays are not handled yet.
  5. Line locations are not tracked.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值