当前位置: 首页 > news >正文

MLIR 学习1

本文记录了MLIR 的学习过程。本文记录的是 MLIR Toy Tutorial 的学习过程。

感谢网上的一些博主的指引

知乎-入门MLIR(1)- Toy CH1 & CH2

0. MLIR compile

Refer to the official tutorial(s)

Refer to the official tutorial  参考官方安装教程。

git clone https://github.com/llvm/llvm-project.git
mkdir llvm-project/build
cd llvm-project/build
cmake -G Ninja ../llvm \-DLLVM_ENABLE_PROJECTS=mlir \-DLLVM_BUILD_EXAMPLES=ON \-DLLVM_TARGETS_TO_BUILD="Native;NVPTX;AMDGPU" \-DCMAKE_BUILD_TYPE=Release \-DLLVM_ENABLE_ASSERTIONS=ON
# Using clang and lld speeds up the build, we recommend adding:
#  -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_ENABLE_LLD=ON
# CCache can drastically speed up further rebuilds, try adding:
#  -DLLVM_CCACHE_BUILD=ON
# Optionally, using ASAN/UBSAN can find bugs early in development, enable with:
# -DLLVM_USE_SANITIZER="Address;Undefined" 
# Optionally, enabling integration tests as well
# -DMLIR_INCLUDE_INTEGRATION_TESTS=ON
cmake --build . --target check-mlir

完成编译后,可以采用如下命令确认,

./build/bin/toyc-ch1 mlir/test/Examples/Toy/Ch1/ast.toy -emit=ast

-emit=ast ,表示以ast 格式输出,执行以上命令之后,可以看到,ast.toy的ast格式输出结果,如下内容:

  Module:FunctionProto 'multiply_transpose' @mlir/test/Examples/Toy/Ch1/ast.toy:4:1Params: [a, b]Block {ReturnBinOp: * @mlir/test/Examples/Toy/Ch1/ast.toy:5:25Call 'transpose' [ @mlir/test/Examples/Toy/Ch1/ast.toy:5:10var: a @mlir/test/Examples/Toy/Ch1/ast.toy:5:20]Call 'transpose' [ @mlir/test/Examples/Toy/Ch1/ast.toy:5:25var: b @mlir/test/Examples/Toy/Ch1/ast.toy:5:35]} // BlockFunctionProto 'main' @mlir/test/Examples/Toy/Ch1/ast.toy:8:1Params: []Block {VarDecl a<> @mlir/test/Examples/Toy/Ch1/ast.toy:11:3Literal: <2, 3>[ <3>[ 1.000000e+00, 2.000000e+00, 3.000000e+00], <3>[ 4.000000e+00, 5.000000e+00, 6.000000e+00]] @mlir/test/Examples/Toy/Ch1/ast.toy:11:11VarDecl b<2, 3> @mlir/test/Examples/Toy/Ch1/ast.toy:15:3Literal: <6>[ 1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+00] @mlir/test/Examples/Toy/Ch1/ast.toy:15:17VarDecl c<> @mlir/test/Examples/Toy/Ch1/ast.toy:19:3Call 'multiply_transpose' [ @mlir/test/Examples/Toy/Ch1/ast.toy:19:11var: a @mlir/test/Examples/Toy/Ch1/ast.toy:19:30var: b @mlir/test/Examples/Toy/Ch1/ast.toy:19:33]VarDecl d<> @mlir/test/Examples/Toy/Ch1/ast.toy:22:3Call 'multiply_transpose' [ @mlir/test/Examples/Toy/Ch1/ast.toy:22:11var: b @mlir/test/Examples/Toy/Ch1/ast.toy:22:30var: a @mlir/test/Examples/Toy/Ch1/ast.toy:22:33]VarDecl e<> @mlir/test/Examples/Toy/Ch1/ast.toy:25:3Call 'multiply_transpose' [ @mlir/test/Examples/Toy/Ch1/ast.toy:25:11var: c @mlir/test/Examples/Toy/Ch1/ast.toy:25:30var: d @mlir/test/Examples/Toy/Ch1/ast.toy:25:33]VarDecl f<> @mlir/test/Examples/Toy/Ch1/ast.toy:28:3Call 'multiply_transpose' [ @mlir/test/Examples/Toy/Ch1/ast.toy:28:11var: a @mlir/test/Examples/Toy/Ch1/ast.toy:28:30var: c @mlir/test/Examples/Toy/Ch1/ast.toy:28:33]} // Block

http://www.dtcms.com/a/500060.html

相关文章:

  • Unity:UGUI笔记(一)——三大基础控件、组合控件
  • 栾城住房和城乡建设局网站百度推广运营公司
  • 下载了网站模板怎么用闸北微信网站建设
  • 就业信息|基于SprinBoot+vue的就业信息管理系统(源码+数据库+文档)
  • 黑龙江企业网站设计团队游戏网站建设多少钱
  • 分治:地毯填补问题
  • 北京南站附近的景点深圳工业设计培训班
  • 肤契:全域协议版 六 销量即救赎
  • 长治网站建设培训文件儿童7一8岁手工
  • php做购物网站详情页的代码点击链接即可进入
  • WebGL精简指南:核心概念、前端技术与效果实现
  • 怎么优化自己网站的关键词手机网站开发 html5
  • 前端基础--css(1)
  • 算法训练之多源BFS
  • 网站开发用什么语言比较流行网站建设未验收会计账务处理
  • openKylin 2.0版本学习入门
  • 如何用php数据库做网站搜狗收录提交
  • 人工智能三要素→ 数据 算力 算法
  • 做教育视频网站用什么平台好wordpress内网
  • 域名做好了怎么做网站内容网站搭建百家号
  • Spyder下载安装图文教程(附安装包,适合新手)
  • 南宁手机平台网网站建设龙岗建设工程交易中心官网
  • 网站移动端开发需要哪些技术ai代码生成器
  • 静态网页建站装饰画
  • 电商运营如何提升自身技能素质
  • iptables 防火墙详解与实用配置指南
  • 湖南网站建设加盟代理企业微营销网站
  • 可以大量免费发帖的网站wordpress存档显示文章所有内容
  • BPMN.js与LogicFlow流程设计器核心技术解析
  • python程序打包成win的exe应用(以OCR应用为例)