fix(vpto): attach vscatter memory effects during lowering - #1188
Draft
mouliangyu wants to merge 2 commits into
Draft
fix(vpto): attach vscatter memory effects during lowering#1188mouliangyu wants to merge 2 commits into
mouliangyu wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
旧版 Bisheng 没有正确把
vscatter建模为通过 destination pointer 写内存,可能导致 EarlyCSE 将 scatter 之后的同址 load 错误消除。PTOAS 已为最终 LLVM intrinsic 补充 memory attributes,但原实现是在 LLVM IR 导出后遍历函数名追加属性,且没有覆盖实际 CSE 序列的回归测试。修改
PlannedDecl在 intrinsic 声明物化时直接附加memory_effects(argMem = write)和no_unwind。llvm.hivm.vscatter.*名字遍历并补属性的逻辑。memory(argmem: write)转换为 Bisheng LLVM 15 可解析的writeonly argmemonly。vlds -> vscatter -> mem_bar(VST_VLD) -> vlds,并检查最终 declaration 的nounwind writeonly argmemonly。验证
cmake --build .work/build --target PTOASPythonCore -j4:PASS。RUN:命令:PASS。vscatter_low_width_vpto_llvm.pto的 CANN 9.0.0 与 9.0.0-beta.1 两条RUN:命令:PASS。bisheng -target hiipu64-hisilicon-cce -O2 -S -emit-llvm ...,优化后仍保留 2 次同址vldsx1,vscatter为argmemonly nounwind writeonly。