build: upgrade PTOAS to LLVM 21.1.8#796
Conversation
There was a problem hiding this comment.
Code Review
This pull request upgrades the project's LLVM/MLIR dependency from version 19.1.7 to 21.1.8, updating the build configurations, Dockerfiles, documentation, and Python bindings (including adding nanobind) accordingly. It also adapts the C++ codebase to LLVM 21 API changes, such as using getStridesAndOffset as a member function of MemRefType and replacing applyPatternsAndFoldGreedily with applyPatternsGreedily. The review feedback correctly points out that PointerUnion::dyn_cast is deprecated and removed in LLVM 21, suggesting the use of ofr.get<Value>() instead of ofr.dyn_cast<Value>() in InferPTOLayout.cpp and PTOToEmitC.cpp where the underlying type has already been verified.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| return std::nullopt; | ||
| } | ||
| return getConstInt(ofr.get<Value>()); | ||
| return getConstInt(ofr.dyn_cast<Value>()); |
There was a problem hiding this comment.
In LLVM 21, the PointerUnion::dyn_cast member function is deprecated and removed. Since we have already verified that ofr is not an Attribute using ofr.is<Attribute>(), we can safely use ofr.get<Value>() directly. This avoids deprecation warnings and is more efficient.
| return getConstInt(ofr.dyn_cast<Value>()); | |
| return getConstInt(ofr.get<Value>()); |
| return intAttr.getInt(); | ||
| } else { | ||
| Value v = ofr.get<Value>(); | ||
| Value v = ofr.dyn_cast<Value>(); |
There was a problem hiding this comment.
In LLVM 21, the PointerUnion::dyn_cast member function is deprecated and removed. Since we have already verified that ofr is not an Attribute using ofr.is<Attribute>(), we can safely use ofr.get<Value>() directly. This avoids deprecation warnings and is more efficient.
| Value v = ofr.dyn_cast<Value>(); | |
| Value v = ofr.get<Value>(); |
Codex Review该评论由 review 机器人自动更新。
SummaryReview failed at stage Findings未生成结构化 findings,因为 review 过程提前失败。 Log Tail |
|
LLVM21 follow-up pushed in 413a0cf.\n\nWhat changed:\n- Replaced remaining removed LLVM21 float8 member predicates with PTO low-precision type helpers.\n- Removed obsolete LLVM dialect low-precision/fixed-vector type names from VPTO emitters.\n- Lowered low-precision VPTO vreg payloads through the i8 carrier ABI to avoid LLVM21-invalid f8/i8 vector bitcasts.\n\nLocal validation:\n- cmake --build build-llvm21 --target ptoas ptobc _pto\n- cmake --build build-llvm21 --target install\n- ctest --test-dir build-llvm21 --output-on-failure: 27/27 passed\n- Python smoke: import mlir.ir; from mlir.dialects import pto\n- llvm-lit build-llvm21/test/lit/vpto: 241/241 passed\n- bash test/samples/runop.sh --enablebc all: OK=265 FAIL=0 SKIP=16\n\nA3/A5 simulator and wheel checks are left to CI/self-hosted runners because this local machine does not have the required Ascend simulator/toolchain environment. |
06afb3d to
1a4e222
Compare
6d7fd3f to
80ac38f
Compare
1ddd67e to
6318ad7
Compare
Summary
Motivation
Design
Testing
Risk / Rollback
Review Focus