惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
Netflix TechBlog - Medium
J
Java Code Geeks
爱范儿
爱范儿
雷峰网
雷峰网
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 三生石上(FineUI控件)
H
Hackread – Cybersecurity News, Data Breaches, AI and More
B
Blog RSS Feed
Google DeepMind News
Google DeepMind News
Jina AI
Jina AI
The GitHub Blog
The GitHub Blog
I
InfoQ
月光博客
月光博客
博客园 - 聂微东
博客园 - Franky
The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
博客园_首页
G
Google Developers Blog
Blog — PlanetScale
Blog — PlanetScale
L
LangChain Blog
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research

Mox的笔记库

2026PPoPP MLIR Tutorial学习 | Mox的笔记库 MacOS配置《明日方舟:终末地》 | Mox的笔记库 2025:向内生长 | Mox的笔记库 由mlir::ExecutionEngine引发的跨系统问题 | Mox的笔记库 WSL2配置Cuda-Tile环境记录(未完待续) | Mox的笔记库 Vibe Coding手搓项目记录 | Mox的笔记库 给Debian上包——以DuckDB为例 | Mox的笔记库 UCPD.sys事件存档 | Mox的笔记库 换新电脑之Mac mini M4从购买到配置 | Mox的笔记库 Mac配置MLX-C开发环境 | Mox的笔记库 RISC-V meets RDBMS——RISC-V架构上可运行数据库一览 | Mox的笔记库 DuckDB Sort实现调查 | Mox的笔记库 修复Redis在树莓派5上无法运行的问题 | Mox的笔记库 如何在MLIR中自定义类型并且输出运行 | Mox的笔记库 网站网络结构变更记录 | Mox的笔记库 EDBT25论文阅读:PhoebeDB——A Disk-Based RDBMS Kernel for High-Performance and Cost-Effective OLTP SIGMOD25论文阅读:BPF-DB:——A Kernel-Embedded Transactional Database Management System For eBPF Applications Apache Arrow Gandiva项目解析 | Mox的笔记库 VLDB24论文阅读:Cloud-Native Database Systems and Unikernels——Reimagining OS Abstractions for Modern Hardware NoisePage源码分析(未完待续) | Mox的笔记库 VLDB20论文阅读:Mainlining Databases——Supporting Fast Transactional Workloads on Universal Columnar Data File Formats VLDB17论文阅读:Relaxed Operator Fusion for In-Memory Databases:Making Compilation, Vectorization, and Prefetching Work Together At Last 论文阅读:How not to structure your database-backed web applications——a study of performance bugs in the wild SIGMOD24阅读:ROME——Robust Query Optimization via Parallel Multi-Plan Execution 文章阅读:First Past the Post-Evaluating Query Optimization in MongoDB SIGMOD文章阅读:Apache Calcite——A Foundational Framework for Optimized Query Processing Over Heterogeneous Data Sources VLDB23论文阅读:Analyzing the Impact of Cardinality Estimation on Execution Plans in Microsoft SQL Server SIGMOD22论文阅读:Efficient Massively Parallel Join Optimization for Large Queries VLDB论文阅读:Weaving Relations for Cache Performance VLDB22论文阅读:ConnectorX——Accelerating Data Loading From Databases to Dataframes
LLVM-Kaleidoscope实操踩坑记录 | Mox的笔记库
MocusEZ · 2024-07-21 · via Mox的笔记库

LLVM Kaleidoscope是LLVM Tutorial里提供的Toy语言,走完这个Tutorial可以对LLVM的机制有个大体上的了解

但Tutorial的一些说明并不清楚,为此踩了些坑,在这里记录下

环境配置

这次我用Code-Server完成的练习,操作系统为Debian,配置了Sid源

apt install llvm-18 lldb-18 clang-18 cmake ninja-build

借此机会重新回顾了下CMake,项目结构已上传Github,可供参考:

CMake_LLVM_Kaleidoscope

还需要另外安装CMake:

apt install cmake ninja-build

实操避坑

Chpater4 后JIT遇到头文件缺失

实测Debian的LLVM14和LLVM16缺失头文件ExecutorSymbolDef.h

解决方案:升级到LLVM18

建议如果要运行Kaleidoscope的话,使用当时最新的LLVM版本,从而避免大改动对Tutorial运行的影响

LLVM>14后使用CMake遇到的情况

参考[CMake] find_package(LLVM CONFIG) may fail when the project does not use C遇到的情况

项目配置必须加上:

project(Kaleidoscope VERSION 0.1.0 LANGUAGES CXX C)

如果不想看警告,还需要加上对应库(根据警告情况自行搜索,基本都能搜得到):

apt install libcurl4-openssl-dev libzstd-dev

谨慎安装:

Chapter5,6 的printd,putchard无法使用

从StackOverflow上看来的,Clang++加上相对应的编译参数:

-Xlinker --export-dynamic

对应CMake的效果:

target_link_options(Kaleidoscope PRIVATE -Xlinker --export-dynamic)

Kaleidoscope-Ch9 < fib.ks | & clang -x ir -为什么没反应?

这语句本身运行就有问题(bash: syntax error near unexpected token `&’)

试着用重定向解决问题,但学艺不精没成功,只能手动Ctrl CV到output.txt上,然后再用clang编译

使用LLVDB调试输出程序,会显示源代码

(lldb) list 1

1 def fib(x)

2 if x < 3 then

3 1

4 else

5 fib(x-1)+fib(x-2);

6

7 fib(10)

(Note:插个题外话,Chapter9介绍了有关Dwarf的部分,感兴趣的可以看这个作为补充资料:阎明铸 - DWARF入门及实现 mini objdump -WL - 20240717(内部报告,非公开演讲,仅限爱好者交流))


avatar

探索未曾设想的道路