[all-commits] [llvm/llvm-project] fd3a6b: [NVPTX] Improve modeling of inline PTX (#130675)
Alex MacLean via All-commits
all-commits at lists.llvm.org
Tue Mar 25 13:46:38 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: fd3a6b6005aa591a53fc01e4ed130af369e0c366
https://github.com/llvm/llvm-project/commit/fd3a6b6005aa591a53fc01e4ed130af369e0c366
Author: Alex MacLean <amaclean at nvidia.com>
Date: 2025-03-25 (Tue, 25 Mar 2025)
Changed paths:
M llvm/lib/Target/NVPTX/NVPTXAliasAnalysis.cpp
M llvm/lib/Target/NVPTX/NVPTXAliasAnalysis.h
M llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp
M llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.h
A llvm/test/Analysis/CostModel/NVPTX/inline-asm.ll
A llvm/test/Analysis/CostModel/NVPTX/lit.local.cfg
A llvm/test/CodeGen/NVPTX/nvptx-aa-inline-asm.ll
Log Message:
-----------
[NVPTX] Improve modeling of inline PTX (#130675)
Improve the modeling of the memory effects and instruction cost of
inline assembly.
- MemoryEffects: The CUDA spec states that inline assembly is not
assumed to have any side-effects or read or write to memory. An inline
assembly may be treated as NoModRef unless it is explictly marked as
having side effects or has an explicit memory clobber.
https://docs.nvidia.com/cuda/inline-ptx-assembly/index.html#incorrect-optimization
> Normally any memory that is written to will be specified as an out
operand, but if there is a hidden read or write on user memory (for
example, indirect access of a memory location via an operand), or if you
want to stop any memory optimizations around the asm() statement
performed during generation of PTX, you can add a “memory” clobbers
specification after a 3rd colon.
- InstructionCost: This change implements very rough string parsing
system to count the number of instructions in an inline-asm. There are
corner cases it will not handle well, but in general this is an
improvement over the current cost of the number of arguments plus one.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list