[Mlir-commits] [mlir] [MLIR][NVVM] Add `inline_ptx` op (PR #139923)
Guray Ozen
llvmlistbot at llvm.org
Wed May 14 23:32:18 PDT 2025
grypp wrote:
> So how does it knows about "Read-only Parameters" and "Read-only and Write-only Parameters" ?
Input arguments are read-only, and results are write-only — it's pure SSA. For read-only arguments, no special marker is used, but for write-only ones, we automatically prepend `=`.
Other compilers support read-write arguments using `+`, but this isn't supported by LLVM, I guess because it doesn't align with SSA semantics.
In LLVM, we handle read-write symbols differently. We mark them as `=`, indicating write access, and then explicitly map the same symbol as a read operand in the input list.
For example here result is readwrite, and valid asm. But llvm doesn't support that.
```
asm ("OPCODE %0, %1, %2" : "+f" (result));
```
Instead, we generate the equivalent as:
```
asm ("OPCODE %0, %1, %2" : "=f" (result) : "0" (result));
```
This marks `result` as both written (`=f`) and read (`"0"`).
https://github.com/llvm/llvm-project/pull/139923
More information about the Mlir-commits
mailing list