Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NVPTX] Add Volta Load/Store Atomics (.relaxed, .acquire, .release) and Volatile (.mmio/.volatile) support #98022

Merged
merged 7 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,33 @@ void NVPTXInstPrinter::printLdStCode(const MCInst *MI, int OpNum,
if (Modifier) {
const MCOperand &MO = MI->getOperand(OpNum);
int Imm = (int) MO.getImm();
if (!strcmp(Modifier, "volatile")) {
if (Imm)
if (!strcmp(Modifier, "sem")) {
switch (Imm) {
case NVPTX::PTXLdStInstCode::NotAtomic:
break;
case NVPTX::PTXLdStInstCode::Volatile:
O << ".volatile";
break;
case NVPTX::PTXLdStInstCode::Relaxed:
O << ".relaxed.sys";
break;
case NVPTX::PTXLdStInstCode::Acquire:
O << ".acquire.sys";
break;
case NVPTX::PTXLdStInstCode::Release:
O << ".release.sys";
break;
case NVPTX::PTXLdStInstCode::RelaxedMMIO:
O << ".mmio.relaxed.sys";
break;
default:
SmallString<256> Msg;
raw_svector_ostream OS(Msg);
OS << "NVPTX LdStCode Printer does not support \"" << Imm
<< "\" sem modifier.";
report_fatal_error(OS.str());
break;
}
} else if (!strcmp(Modifier, "addsp")) {
switch (Imm) {
case NVPTX::PTXLdStInstCode::GLOBAL:
Expand Down
8 changes: 8 additions & 0 deletions llvm/lib/Target/NVPTX/NVPTX.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ enum LoadStore {
};

namespace PTXLdStInstCode {
enum MemorySemantic {
NotAtomic = 0, // PTX calls these: "Weak"
Volatile = 1,
Relaxed = 2,
Acquire = 3,
Release = 4,
RelaxedMMIO = 5
};
enum AddressSpace {
GENERIC = 0,
GLOBAL = 1,
Expand Down
Loading
Loading