Skip to content

Commit

Permalink
[AMDGPU] Make __GCC_DESTRUCTIVE_SIZE 128 on AMDGPU
Browse files Browse the repository at this point in the history
Summary:
The cache line size on AMDGPU varies between 64 and 128 (The lowest L2
cache also goes to 256 on some architectures.) This macro is intended to
present a size that will not cause destructive interference, so we
choose the larger of those values.
  • Loading branch information
jhuber6 committed Nov 7, 2024
1 parent d727eec commit fcb8bcf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions clang/lib/Basic/Targets/AMDGPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,10 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUTargetInfo final : public TargetInfo {
}

bool hasHIPImageSupport() const override { return HasImage; }

std::pair<unsigned, unsigned> hardwareInterferenceSizes() const override {
return std::make_pair(128, 128);
}
};

} // namespace targets
Expand Down
2 changes: 2 additions & 0 deletions clang/test/Driver/amdgpu-macros.cl
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@
// ARCH-GCN-DAG: #define __[[FAMILY]]__ 1
// ARCH-GCN-DAG: #define __amdgcn_processor__ "[[CPU]]"
// ARCH-GCN-DAG: #define __AMDGCN_WAVEFRONT_SIZE [[WAVEFRONT_SIZE]]
// ARCH-GCN-DAG: #define __GCC_DESTRUCTIVE_SIZE 128
// ARCH-GCN-DAG: #define __GCC_CONSTRUCTIVE_SIZE 128
// UNSAFEFPATOMIC-DAG: #define __AMDGCN_UNSAFE_FP_ATOMICS__ 1

// RUN: %clang -E -dM -target amdgcn -mcpu=gfx906 -mwavefrontsize64 \
Expand Down

0 comments on commit fcb8bcf

Please sign in to comment.