@@ -41,38 +41,6 @@ using namespace mlir::amdgpu;
4141
4242#include " mlir/Dialect/AMDGPU/IR/AMDGPUDialect.cpp.inc"
4343
44- namespace mlir ::amdgpu {
45- bool hasGlobalMemorySpace (Attribute memorySpace) {
46- if (!memorySpace)
47- return true ;
48- if (auto intMemorySpace = dyn_cast<IntegerAttr>(memorySpace))
49- return intMemorySpace.getInt () == 0 || intMemorySpace.getInt () == 1 ;
50- if (auto gpuMemorySpace = dyn_cast<gpu::AddressSpaceAttr>(memorySpace))
51- return gpuMemorySpace.getValue () == gpu::AddressSpace::Global;
52- return false ;
53- }
54-
55- bool hasWorkgroupMemorySpace (Attribute memorySpace) {
56- if (!memorySpace)
57- return false ;
58- if (auto intMemorySpace = dyn_cast<IntegerAttr>(memorySpace))
59- return intMemorySpace.getInt () == 3 ;
60- if (auto gpuMemorySpace = dyn_cast<gpu::AddressSpaceAttr>(memorySpace))
61- return gpuMemorySpace.getValue () == gpu::AddressSpace::Workgroup;
62- return false ;
63- }
64-
65- bool hasFatRawBufferMemorySpace (Attribute memorySpace) {
66- if (!memorySpace)
67- return false ;
68- if (auto intMemorySpace = dyn_cast<IntegerAttr>(memorySpace))
69- return intMemorySpace.getInt () == 7 ;
70- if (auto gpuMemorySpace = dyn_cast<amdgpu::AddressSpaceAttr>(memorySpace))
71- return gpuMemorySpace.getValue () == amdgpu::AddressSpace::FatRawBuffer;
72- return false ;
73- }
74- } // namespace mlir::amdgpu
75-
7644namespace {
7745struct AMDGPUInlinerInterface final : DialectInlinerInterface {
7846 using DialectInlinerInterface::DialectInlinerInterface;
@@ -190,6 +158,36 @@ LogicalResult FatRawBufferCastOp::verify() {
190158 return success ();
191159}
192160
161+ static bool hasGlobalMemorySpace (Attribute memorySpace) {
162+ if (!memorySpace)
163+ return true ;
164+ if (auto intMemorySpace = dyn_cast<IntegerAttr>(memorySpace))
165+ return intMemorySpace.getInt () == 0 || intMemorySpace.getInt () == 1 ;
166+ if (auto gpuMemorySpace = dyn_cast<gpu::AddressSpaceAttr>(memorySpace))
167+ return gpuMemorySpace.getValue () == gpu::AddressSpace::Global;
168+ return false ;
169+ }
170+
171+ static bool hasWorkgroupMemorySpace (Attribute memorySpace) {
172+ if (!memorySpace)
173+ return false ;
174+ if (auto intMemorySpace = dyn_cast<IntegerAttr>(memorySpace))
175+ return intMemorySpace.getInt () == 3 ;
176+ if (auto gpuMemorySpace = dyn_cast<gpu::AddressSpaceAttr>(memorySpace))
177+ return gpuMemorySpace.getValue () == gpu::AddressSpace::Workgroup;
178+ return false ;
179+ }
180+
181+ static bool hasFatRawBufferMemorySpace (Attribute memorySpace) {
182+ if (!memorySpace)
183+ return false ;
184+ if (auto intMemorySpace = dyn_cast<IntegerAttr>(memorySpace))
185+ return intMemorySpace.getInt () == 7 ;
186+ if (auto gpuMemorySpace = dyn_cast<amdgpu::AddressSpaceAttr>(memorySpace))
187+ return gpuMemorySpace.getValue () == amdgpu::AddressSpace::FatRawBuffer;
188+ return false ;
189+ }
190+
193191// ===----------------------------------------------------------------------===//
194192// RawBuffer*Op
195193// ===----------------------------------------------------------------------===//
0 commit comments