llvm-project/mlir/lib/Conversion/GPUCommon/AttrToSPIRVConverter.cpp
Bangtian Liu 86b5f11ecc
[mlir][GPU] Add constant address space to GPU dialect (#190211)
This PR adds a `constant` address space to the` GPU dialect and
lowerings to all GPU backends.

Signed-off-by: Bangtian Liu <liubangtian@gmail.com>
2026-04-02 15:02:12 -04:00

26 lines
951 B
C++

//===- AttrToSPIRVConverter.cpp - GPU attributes conversion to SPIR-V - C++===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include <mlir/Conversion/GPUCommon/AttrToSPIRVConverter.h>
namespace mlir {
spirv::StorageClass addressSpaceToStorageClass(gpu::AddressSpace addressSpace) {
switch (addressSpace) {
case gpu::AddressSpace::Global:
return spirv::StorageClass::CrossWorkgroup;
case gpu::AddressSpace::Workgroup:
return spirv::StorageClass::Workgroup;
case gpu::AddressSpace::Private:
return spirv::StorageClass::Private;
case gpu::AddressSpace::Constant:
return spirv::StorageClass::UniformConstant;
}
llvm_unreachable("Unhandled storage class");
}
} // namespace mlir