[all-commits] [llvm/llvm-project] 240f22: Add clang atomic control options and attribute (#1...
Yaxun (Sam) Liu via All-commits
all-commits at lists.llvm.org
Thu Feb 27 07:41:26 PST 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 240f2269ffdbd96e68b2159ae537d8486164c10c
https://github.com/llvm/llvm-project/commit/240f2269ffdbd96e68b2159ae537d8486164c10c
Author: Yaxun (Sam) Liu <yaxun.liu at amd.com>
Date: 2025-02-27 (Thu, 27 Feb 2025)
Changed paths:
M clang/docs/LanguageExtensions.rst
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Basic/Attr.td
M clang/include/clang/Basic/AttrDocs.td
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/include/clang/Basic/Features.def
M clang/include/clang/Basic/LangOptions.h
M clang/include/clang/Basic/TargetInfo.h
M clang/include/clang/Basic/TargetOptions.h
M clang/include/clang/Driver/Options.td
M clang/lib/Basic/Targets/AMDGPU.cpp
M clang/lib/CodeGen/CGStmt.cpp
M clang/lib/CodeGen/CodeGenFunction.h
M clang/lib/CodeGen/CodeGenModule.cpp
M clang/lib/CodeGen/CodeGenModule.h
M clang/lib/CodeGen/Targets/AMDGPU.cpp
M clang/lib/Driver/ToolChains/Clang.cpp
M clang/lib/Sema/SemaStmtAttr.cpp
A clang/test/AST/ast-dump-atomic-options.hip
M clang/test/CodeGen/AMDGPU/amdgpu-atomic-float.c
M clang/test/CodeGenCUDA/amdgpu-atomic-ops.cu
M clang/test/CodeGenCUDA/atomic-ops.cu
A clang/test/CodeGenCUDA/atomic-options.hip
M clang/test/CodeGenOpenCL/atomic-ops.cl
A clang/test/Driver/atomic-options.hip
M clang/test/Driver/hip-options.hip
M clang/test/OpenMP/amdgpu-unsafe-fp-atomics.cpp
A clang/test/Parser/Inputs/cuda.h
A clang/test/Parser/atomic-options.hip
Log Message:
-----------
Add clang atomic control options and attribute (#114841)
Add option and statement attribute for controlling emitting of
target-specific
metadata to atomicrmw instructions in IR.
The RFC for this attribute and option is
https://discourse.llvm.org/t/rfc-add-clang-atomic-control-options-and-pragmas/80641,
Originally a pragma was proposed, then it was changed to clang
attribute.
This attribute allows users to specify one, two, or all three options
and must be applied
to a compound statement. The attribute can also be nested, with inner
attributes
overriding the options specified by outer attributes or the target's
default
options. These options will then determine the target-specific metadata
added to atomic
instructions in the IR.
In addition to the attribute, three new compiler options are introduced:
`-f[no-]atomic-remote-memory`, `-f[no-]atomic-fine-grained-memory`,
`-f[no-]atomic-ignore-denormal-mode`.
These compiler options allow users to override the default options
through the
Clang driver and front end. `-m[no-]unsafe-fp-atomics` is aliased to
`-f[no-]ignore-denormal-mode`.
In terms of implementation, the atomic attribute is represented in the
AST by the
existing AttributedStmt, with minimal changes to AST and Sema.
During code generation in Clang, the CodeGenModule maintains the current
atomic options,
which are used to emit the relevant metadata for atomic instructions.
RAII is used
to manage the saving and restoring of atomic options when entering
and exiting nested AttributedStmt.
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