NVIDIA / NVIDIA/cccl

Update codegen.cpp to use `std::format`.

Open
#1,912 0 comments 0 reactions 1 assignee Claimed by @wmaxey View on GitHub
Dominant language
C++
Stars
2.5k
Forks
486
Avg merge
2d 6h
Merged PRs (30d)
295

Description

codegen.cpp is difficult to modify due to multiple codepaths re-using the same formats in the same function body. We can split this up and generate code using {fmt} instead of stream injection.

Further we can reduce the amount of generated code by injecting some components of the inline PTX statements using the C++ type system.

```C++
{
asm volatile("atom.%3%4%5.{0}{1} %0,[%1],%2;"
: "={2}"(__dst)
: "l"(__ptr), "{2}"(__op), "C"(_Op::value), "C"(_Scope::value), "C"(_Memorder::value)
: "memory");
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.