Skip to content

Commit fcb8bcf

Browse files
committed
[AMDGPU] Make __GCC_DESTRUCTIVE_SIZE 128 on AMDGPU
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.
1 parent d727eec commit fcb8bcf

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

clang/lib/Basic/Targets/AMDGPU.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,10 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUTargetInfo final : public TargetInfo {
462462
}
463463

464464
bool hasHIPImageSupport() const override { return HasImage; }
465+
466+
std::pair<unsigned, unsigned> hardwareInterferenceSizes() const override {
467+
return std::make_pair(128, 128);
468+
}
465469
};
466470

467471
} // namespace targets

clang/test/Driver/amdgpu-macros.cl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@
153153
// ARCH-GCN-DAG: #define __[[FAMILY]]__ 1
154154
// ARCH-GCN-DAG: #define __amdgcn_processor__ "[[CPU]]"
155155
// ARCH-GCN-DAG: #define __AMDGCN_WAVEFRONT_SIZE [[WAVEFRONT_SIZE]]
156+
// ARCH-GCN-DAG: #define __GCC_DESTRUCTIVE_SIZE 128
157+
// ARCH-GCN-DAG: #define __GCC_CONSTRUCTIVE_SIZE 128
156158
// UNSAFEFPATOMIC-DAG: #define __AMDGCN_UNSAFE_FP_ATOMICS__ 1
157159

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

0 commit comments

Comments
 (0)