MLIR  20.0.0git
NVGPU.cpp
Go to the documentation of this file.
1 //===- NVGPU.cpp - C Interface for NVGPU 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/NVGPU.h"
10 #include "mlir/CAPI/Registration.h"
12 #include "mlir/IR/BuiltinTypes.h"
13 
14 using namespace mlir;
15 using namespace mlir::nvgpu;
16 
17 MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(NVGPU, nvgpu, mlir::nvgpu::NVGPUDialect)
18 
20  return isa<nvgpu::TensorMapDescriptorType>(unwrap(type));
21 }
22 
23 MlirType mlirNVGPUTensorMapDescriptorTypeGet(MlirContext ctx,
24  MlirType tensorMemrefType,
25  int swizzle, int l2promo,
26  int oobFill, int interleave) {
28  unwrap(ctx), cast<MemRefType>(unwrap(tensorMemrefType)),
29  TensorMapSwizzleKind(swizzle), TensorMapL2PromoKind(l2promo),
30  TensorMapOOBKind(oobFill), TensorMapInterleaveKind(interleave)));
31 }
bool mlirTypeIsANVGPUTensorMapDescriptorType(MlirType type)
Definition: NVGPU.cpp:19
MlirType mlirNVGPUTensorMapDescriptorTypeGet(MlirContext ctx, MlirType tensorMemrefType, int swizzle, int l2promo, int oobFill, int interleave)
Definition: NVGPU.cpp:23
#define MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Name, Namespace, ClassName)
Definition: Registration.h:36
mlir::Diagnostic & unwrap(MlirDiagnostic diagnostic)
Definition: Diagnostics.h:19
MlirDiagnostic wrap(mlir::Diagnostic &diagnostic)
Definition: Diagnostics.h:24
Include the generated interface declarations.
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...