| 1 | //===- AMDGPU.cpp - C Interface for AMDGPU dialect ------------------===// |
|---|---|
| 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-c/Dialect/AMDGPU.h" |
| 10 | #include "mlir/CAPI/Registration.h" |
| 11 | #include "mlir/Dialect/AMDGPU/IR/AMDGPUDialect.h" |
| 12 | |
| 13 | MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(AMDGPU, amdgpu, |
| 14 | mlir::amdgpu::AMDGPUDialect) |
| 15 | |
| 16 | using namespace mlir; |
| 17 | using namespace mlir::amdgpu; |
| 18 | |
| 19 | //===---------------------------------------------------------------------===// |
| 20 | // TDMBaseType |
| 21 | //===---------------------------------------------------------------------===// |
| 22 | |
| 23 | bool mlirTypeIsAAMDGPUTDMBaseType(MlirType type) { |
| 24 | return isa<amdgpu::TDMBaseType>(Val: unwrap(c: type)); |
| 25 | } |
| 26 | |
| 27 | MlirTypeID mlirAMDGPUTDMBaseTypeGetTypeID() { |
| 28 | return wrap(cpp: amdgpu::TDMBaseType::getTypeID()); |
| 29 | } |
| 30 | |
| 31 | MlirType mlirAMDGPUTDMBaseTypeGet(MlirContext ctx, MlirType elementType) { |
| 32 | return wrap(cpp: amdgpu::TDMBaseType::get(context: unwrap(c: ctx), elementType: unwrap(c: elementType))); |
| 33 | } |
| 34 | |
| 35 | MlirStringRef mlirAMDGPUTDMBaseTypeGetName(void) { |
| 36 | return wrap(ref: amdgpu::TDMBaseType::name); |
| 37 | } |
| 38 | |
| 39 | //===---------------------------------------------------------------------===// |
| 40 | // TDMDescriptorType |
| 41 | //===---------------------------------------------------------------------===// |
| 42 | |
| 43 | bool mlirTypeIsAAMDGPUTDMDescriptorType(MlirType type) { |
| 44 | return isa<amdgpu::TDMDescriptorType>(Val: unwrap(c: type)); |
| 45 | } |
| 46 | |
| 47 | MlirTypeID mlirAMDGPUTDMDescriptorTypeGetTypeID() { |
| 48 | return wrap(cpp: amdgpu::TDMDescriptorType::getTypeID()); |
| 49 | } |
| 50 | |
| 51 | MlirType mlirAMDGPUTDMDescriptorTypeGet(MlirContext ctx) { |
| 52 | return wrap(cpp: amdgpu::TDMDescriptorType::get(ctx: unwrap(c: ctx))); |
| 53 | } |
| 54 | |
| 55 | MlirStringRef mlirAMDGPUTDMDescriptorTypeGetName(void) { |
| 56 | return wrap(ref: amdgpu::TDMDescriptorType::name); |
| 57 | } |
| 58 | |
| 59 | //===---------------------------------------------------------------------===// |
| 60 | // TDMGatherBaseType |
| 61 | //===---------------------------------------------------------------------===// |
| 62 | |
| 63 | bool mlirTypeIsAAMDGPUTDMGatherBaseType(MlirType type) { |
| 64 | return isa<amdgpu::TDMGatherBaseType>(Val: unwrap(c: type)); |
| 65 | } |
| 66 | |
| 67 | MlirTypeID mlirAMDGPUTDMGatherBaseTypeGetTypeID() { |
| 68 | return wrap(cpp: amdgpu::TDMGatherBaseType::getTypeID()); |
| 69 | } |
| 70 | |
| 71 | MlirType mlirAMDGPUTDMGatherBaseTypeGet(MlirContext ctx, MlirType elementType, |
| 72 | MlirType indexType) { |
| 73 | return wrap(cpp: amdgpu::TDMGatherBaseType::get(context: unwrap(c: ctx), elementType: unwrap(c: elementType), |
| 74 | indexType: unwrap(c: indexType))); |
| 75 | } |
| 76 | |
| 77 | MlirStringRef mlirAMDGPUTDMGatherBaseTypeGetName(void) { |
| 78 | return wrap(ref: amdgpu::TDMGatherBaseType::name); |
| 79 | } |
| 80 |