1 | //===- AttrToSPIRVConverter.cpp - GPU attributes conversion to SPIR-V - C++===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #include <mlir/Conversion/GPUCommon/AttrToSPIRVConverter.h> |
10 | |
11 | namespace mlir { |
12 | spirv::StorageClass addressSpaceToStorageClass(gpu::AddressSpace addressSpace) { |
13 | switch (addressSpace) { |
14 | case gpu::AddressSpace::Global: |
15 | return spirv::StorageClass::CrossWorkgroup; |
16 | case gpu::AddressSpace::Workgroup: |
17 | return spirv::StorageClass::Workgroup; |
18 | case gpu::AddressSpace::Private: |
19 | return spirv::StorageClass::Private; |
20 | } |
21 | llvm_unreachable("Unhandled storage class" ); |
22 | } |
23 | } // namespace mlir |
24 | |