From a60fd6c50c94f45bc57fe2b0f8399de3b2ddeb1a Mon Sep 17 00:00:00 2001 From: Maksim Levental Date: Fri, 18 Oct 2024 21:16:38 -0400 Subject: [PATCH] fix symbol problem on windows Signed-off-by: Maksim Levental --- compiler/src/iree/compiler/API/CMakeLists.txt | 1 + .../iree/compiler/API/Internal/BUILD.bazel | 13 ++ .../iree/compiler/API/Internal/CMakeLists.txt | 13 ++ .../API/Internal/IREEGPUDialectCAPI.cpp | 120 ++++++++++++++++++ compiler/src/iree/compiler/API/api_exports.c | 24 ++++ .../src/iree/compiler/API/api_exports.def | 10 ++ compiler/src/iree/compiler/API/api_exports.ld | 10 ++ .../iree/compiler/API/api_exports.macos.lst | 10 ++ .../src/iree/compiler/API/generate_exports.py | 16 +++ .../Codegen/Dialect/GPU/IR/IREEGPUAttrs.cpp | 110 ---------------- 10 files changed, 217 insertions(+), 110 deletions(-) create mode 100644 compiler/src/iree/compiler/API/Internal/IREEGPUDialectCAPI.cpp diff --git a/compiler/src/iree/compiler/API/CMakeLists.txt b/compiler/src/iree/compiler/API/CMakeLists.txt index beada0dc6385..00a7e395593a 100644 --- a/compiler/src/iree/compiler/API/CMakeLists.txt +++ b/compiler/src/iree/compiler/API/CMakeLists.txt @@ -78,6 +78,7 @@ set(_EXPORT_OBJECT_LIBS obj.MLIRCAPITransformDialectTransforms iree_compiler_API_Internal_CompilerDriver.objects iree_compiler_API_Internal_IREECompileToolEntryPoint.objects + iree_compiler_API_Internal_IREEGPUDialectCAPI.objects iree_compiler_API_Internal_IREEMLIRLSPServerToolEntryPoint.objects iree_compiler_API_Internal_IREEOptToolEntryPoint.objects iree_compiler_API_Internal_IREEReduceToolEntryPoint.objects diff --git a/compiler/src/iree/compiler/API/Internal/BUILD.bazel b/compiler/src/iree/compiler/API/Internal/BUILD.bazel index 4f98de9f45cb..c8ac4551dd1d 100644 --- a/compiler/src/iree/compiler/API/Internal/BUILD.bazel +++ b/compiler/src/iree/compiler/API/Internal/BUILD.bazel @@ -125,3 +125,16 @@ iree_compiler_cc_library( "@llvm-project//mlir:Support", ], ) + +iree_compiler_cc_library( + name = "IREEGPUDialectCAPI", + srcs = [ + "IREEGPUDialectCAPI.cpp", + ], + deps = [ + "//compiler/bindings/c:headers", + "//compiler/src/iree/compiler/Codegen/Dialect/GPU/IR:IREEGPUDialect", + "@llvm-project//mlir:CAPIIR", + "@llvm-project//mlir:CAPIIRHeaders", + ], +) diff --git a/compiler/src/iree/compiler/API/Internal/CMakeLists.txt b/compiler/src/iree/compiler/API/Internal/CMakeLists.txt index c25dcb310f42..61631e148162 100644 --- a/compiler/src/iree/compiler/API/Internal/CMakeLists.txt +++ b/compiler/src/iree/compiler/API/Internal/CMakeLists.txt @@ -103,6 +103,19 @@ iree_cc_library( PUBLIC ) +iree_cc_library( + NAME + IREEGPUDialectCAPI + SRCS + "IREEGPUDialectCAPI.cpp" + DEPS + IREELLVMIncludeSetup + MLIRCAPIIR + iree::compiler::Codegen::Dialect::GPU::IR::IREEGPUDialect + iree::compiler::bindings::c::headers + PUBLIC +) + ### BAZEL_TO_CMAKE_PRESERVES_ALL_CONTENT_BELOW_THIS_LINE ### set(_lld_copts) diff --git a/compiler/src/iree/compiler/API/Internal/IREEGPUDialectCAPI.cpp b/compiler/src/iree/compiler/API/Internal/IREEGPUDialectCAPI.cpp new file mode 100644 index 000000000000..9b4639bb0cc2 --- /dev/null +++ b/compiler/src/iree/compiler/API/Internal/IREEGPUDialectCAPI.cpp @@ -0,0 +1,120 @@ +// Copyright 2024 The IREE Authors +// +// Licensed 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 "iree/compiler/Codegen/Dialect/GPU/IR/IREEGPUAttrs.h" +#include "iree/compiler/dialects/iree_gpu.h" +#include "mlir-c/IR.h" +#include "mlir/CAPI/IR.h" +#include "mlir/CAPI/Support.h" + +bool ireeAttributeIsAGPUPipelineOptionsAttr(MlirAttribute attr) { + return llvm::isa( + unwrap(attr)); +} + +MlirAttribute +ireeGPUPipelineOptionsAttrGet(MlirContext mlirCtx, bool *prefetchSharedMemory, + bool *noReduceSharedMemoryBankConflicts, + MlirAttribute *reorderWorkgroupsStrategy) { + mlir::MLIRContext *ctx = unwrap(mlirCtx); + mlir::Builder b(ctx); + auto prefetchSharedMemoryAttr = mlir::BoolAttr(); + if (prefetchSharedMemory) { + prefetchSharedMemoryAttr = b.getBoolAttr(*prefetchSharedMemory); + } + auto noReduceSharedMemoryBankConflictsAttr = mlir::BoolAttr(); + if (noReduceSharedMemoryBankConflicts) { + noReduceSharedMemoryBankConflictsAttr = + b.getBoolAttr(*noReduceSharedMemoryBankConflicts); + } + auto strategyAttr = + mlir::iree_compiler::IREE::GPU::ReorderWorkgroupsStrategyAttr(); + if (reorderWorkgroupsStrategy) { + strategyAttr = llvm::dyn_cast< + mlir::iree_compiler::IREE::GPU::ReorderWorkgroupsStrategyAttr>( + unwrap(*reorderWorkgroupsStrategy)); + } + return wrap(mlir::iree_compiler::IREE::GPU::GPUPipelineOptionsAttr::get( + ctx, prefetchSharedMemoryAttr, noReduceSharedMemoryBankConflictsAttr, + strategyAttr)); +} + +MlirAttribute +ireeGPUPipelineOptionsAttrGetPrefetchSharedMemory(MlirAttribute attr) { + auto gpuAttr = + llvm::cast( + unwrap(attr)); + return wrap(gpuAttr.getPrefetchSharedMemory()); +} + +MlirAttribute ireeGPUPipelineOptionsAttrGetNoReduceSharedMemoryBankConflicts( + MlirAttribute attr) { + auto gpuAttr = + llvm::cast( + unwrap(attr)); + return wrap(gpuAttr.getNoReduceSharedMemoryBankConflicts()); +} + +MlirAttribute +ireeGPUPipelineOptionsAttrGetReorderWorkgroupsStrategy(MlirAttribute attr) { + auto gpuAttr = + llvm::cast( + unwrap(attr)); + return wrap(gpuAttr.getReorderWorkgroupsStrategy()); +} + +MlirTypeID ireeGPUPipelineOptionsAttrGetTypeID() { + return wrap( + mlir::iree_compiler::IREE::GPU::GPUPipelineOptionsAttr::getTypeID()); +} + +static_assert( + static_cast(ireeGPUReorderWorkgroupsStrategyEnumNone) == + static_cast(mlir::iree_compiler::IREE::GPU:: + ReorderWorkgroupsStrategy::None) && + static_cast(ireeGPUReorderWorkgroupsStrategyEnumSwizzle) == + static_cast(mlir::iree_compiler::IREE::GPU:: + ReorderWorkgroupsStrategy::Swizzle) && + static_cast(ireeGPUReorderWorkgroupsStrategyEnumTranspose) == + static_cast(mlir::iree_compiler::IREE::GPU:: + ReorderWorkgroupsStrategy::Transpose) && + static_cast(ireeGPUReorderWorkgroupsStrategyEnumTranspose) == + mlir::iree_compiler::IREE::GPU:: + getMaxEnumValForReorderWorkgroupsStrategy(), + "ireeGPUReorderWorkgroupsStrategyEnum and " + "mlir::iree_compiler::IREE::GPU::ReorderWorkgroupsStrategy definitions " + "have diverged"); + +bool ireeAttributeIsAGPUReorderWorkgroupsStrategyAttr(MlirAttribute attr) { + return llvm::isa< + mlir::iree_compiler::IREE::GPU::ReorderWorkgroupsStrategyAttr>( + unwrap(attr)); +} + +MlirTypeID ireeGPUReorderWorkgroupsStrategyAttrGetTypeID() { + return wrap(mlir::iree_compiler::IREE::GPU::ReorderWorkgroupsStrategyAttr:: + getTypeID()); +} + +MlirAttribute ireeGPUReorderWorkgroupsStrategyAttrGet( + MlirContext mlirCtx, ireeGPUReorderWorkgroupsStrategyEnum value) { + mlir::MLIRContext *ctx = unwrap(mlirCtx); + return wrap( + mlir::iree_compiler::IREE::GPU::ReorderWorkgroupsStrategyAttr::get( + ctx, static_cast< + mlir::iree_compiler::IREE::GPU::ReorderWorkgroupsStrategy>( + value))); +} + +ireeGPUReorderWorkgroupsStrategyEnum +ireeGPUReorderWorkgroupsStrategyAttrGetValue(MlirAttribute attr) { + assert(ireeAttributeIsAGPUReorderWorkgroupsStrategyAttr(attr) && + "attr is not a GPUReorderWorkgroupsStrategyAttr"); + return static_cast( + llvm::cast( + unwrap(attr)) + .getValue()); +} diff --git a/compiler/src/iree/compiler/API/api_exports.c b/compiler/src/iree/compiler/API/api_exports.c index 7f08a293f680..b39373fda64b 100644 --- a/compiler/src/iree/compiler/API/api_exports.c +++ b/compiler/src/iree/compiler/API/api_exports.c @@ -6,8 +6,12 @@ // Generated by generate_exports.py: Do not edit. +// clang-format off + #include +extern void ireeAttributeIsAGPUPipelineOptionsAttr(); +extern void ireeAttributeIsAGPUReorderWorkgroupsStrategyAttr(); extern void ireeCompilerEnumeratePlugins(); extern void ireeCompilerEnumerateRegisteredHALTargetBackends(); extern void ireeCompilerErrorDestroy(); @@ -59,6 +63,14 @@ extern void ireeCompilerSourceDestroy(); extern void ireeCompilerSourceOpenFile(); extern void ireeCompilerSourceSplit(); extern void ireeCompilerSourceWrapBuffer(); +extern void ireeGPUPipelineOptionsAttrGet(); +extern void ireeGPUPipelineOptionsAttrGetNoReduceSharedMemoryBankConflicts(); +extern void ireeGPUPipelineOptionsAttrGetPrefetchSharedMemory(); +extern void ireeGPUPipelineOptionsAttrGetReorderWorkgroupsStrategy(); +extern void ireeGPUPipelineOptionsAttrGetTypeID(); +extern void ireeGPUReorderWorkgroupsStrategyAttrGet(); +extern void ireeGPUReorderWorkgroupsStrategyAttrGetTypeID(); +extern void ireeGPUReorderWorkgroupsStrategyAttrGetValue(); extern void ireeMlirLspServerRunMain(); extern void ireeOptRunMain(); extern void ireeReduceRunMain(); @@ -835,6 +847,8 @@ extern void mlirVectorTypeIsScalable(); uintptr_t __iree_compiler_hidden_force_extern() { uintptr_t x = 0; + x += (uintptr_t)&ireeAttributeIsAGPUPipelineOptionsAttr; + x += (uintptr_t)&ireeAttributeIsAGPUReorderWorkgroupsStrategyAttr; x += (uintptr_t)&ireeCompilerEnumeratePlugins; x += (uintptr_t)&ireeCompilerEnumerateRegisteredHALTargetBackends; x += (uintptr_t)&ireeCompilerErrorDestroy; @@ -886,6 +900,14 @@ uintptr_t __iree_compiler_hidden_force_extern() { x += (uintptr_t)&ireeCompilerSourceOpenFile; x += (uintptr_t)&ireeCompilerSourceSplit; x += (uintptr_t)&ireeCompilerSourceWrapBuffer; + x += (uintptr_t)&ireeGPUPipelineOptionsAttrGet; + x += (uintptr_t)&ireeGPUPipelineOptionsAttrGetNoReduceSharedMemoryBankConflicts; + x += (uintptr_t)&ireeGPUPipelineOptionsAttrGetPrefetchSharedMemory; + x += (uintptr_t)&ireeGPUPipelineOptionsAttrGetReorderWorkgroupsStrategy; + x += (uintptr_t)&ireeGPUPipelineOptionsAttrGetTypeID; + x += (uintptr_t)&ireeGPUReorderWorkgroupsStrategyAttrGet; + x += (uintptr_t)&ireeGPUReorderWorkgroupsStrategyAttrGetTypeID; + x += (uintptr_t)&ireeGPUReorderWorkgroupsStrategyAttrGetValue; x += (uintptr_t)&ireeMlirLspServerRunMain; x += (uintptr_t)&ireeOptRunMain; x += (uintptr_t)&ireeReduceRunMain; @@ -1661,3 +1683,5 @@ uintptr_t __iree_compiler_hidden_force_extern() { x += (uintptr_t)&mlirVectorTypeIsScalable; return x; } + +// clang-format off diff --git a/compiler/src/iree/compiler/API/api_exports.def b/compiler/src/iree/compiler/API/api_exports.def index dd40de2d9a9d..a6cc72ad2fcc 100644 --- a/compiler/src/iree/compiler/API/api_exports.def +++ b/compiler/src/iree/compiler/API/api_exports.def @@ -1,5 +1,7 @@ ; Generated by generate_exports.py: Do not edit. EXPORTS + ireeAttributeIsAGPUPipelineOptionsAttr + ireeAttributeIsAGPUReorderWorkgroupsStrategyAttr ireeCompilerEnumeratePlugins ireeCompilerEnumerateRegisteredHALTargetBackends ireeCompilerErrorDestroy @@ -51,6 +53,14 @@ EXPORTS ireeCompilerSourceOpenFile ireeCompilerSourceSplit ireeCompilerSourceWrapBuffer + ireeGPUPipelineOptionsAttrGet + ireeGPUPipelineOptionsAttrGetNoReduceSharedMemoryBankConflicts + ireeGPUPipelineOptionsAttrGetPrefetchSharedMemory + ireeGPUPipelineOptionsAttrGetReorderWorkgroupsStrategy + ireeGPUPipelineOptionsAttrGetTypeID + ireeGPUReorderWorkgroupsStrategyAttrGet + ireeGPUReorderWorkgroupsStrategyAttrGetTypeID + ireeGPUReorderWorkgroupsStrategyAttrGetValue ireeMlirLspServerRunMain ireeOptRunMain ireeReduceRunMain diff --git a/compiler/src/iree/compiler/API/api_exports.ld b/compiler/src/iree/compiler/API/api_exports.ld index 7589a8a8f3b1..ff43d9a01614 100644 --- a/compiler/src/iree/compiler/API/api_exports.ld +++ b/compiler/src/iree/compiler/API/api_exports.ld @@ -1,6 +1,8 @@ # Generated by generate_exports.py: Do not edit. VER_0 { global: + ireeAttributeIsAGPUPipelineOptionsAttr; + ireeAttributeIsAGPUReorderWorkgroupsStrategyAttr; ireeCompilerEnumeratePlugins; ireeCompilerEnumerateRegisteredHALTargetBackends; ireeCompilerErrorDestroy; @@ -52,6 +54,14 @@ VER_0 { ireeCompilerSourceOpenFile; ireeCompilerSourceSplit; ireeCompilerSourceWrapBuffer; + ireeGPUPipelineOptionsAttrGet; + ireeGPUPipelineOptionsAttrGetNoReduceSharedMemoryBankConflicts; + ireeGPUPipelineOptionsAttrGetPrefetchSharedMemory; + ireeGPUPipelineOptionsAttrGetReorderWorkgroupsStrategy; + ireeGPUPipelineOptionsAttrGetTypeID; + ireeGPUReorderWorkgroupsStrategyAttrGet; + ireeGPUReorderWorkgroupsStrategyAttrGetTypeID; + ireeGPUReorderWorkgroupsStrategyAttrGetValue; ireeMlirLspServerRunMain; ireeOptRunMain; ireeReduceRunMain; diff --git a/compiler/src/iree/compiler/API/api_exports.macos.lst b/compiler/src/iree/compiler/API/api_exports.macos.lst index 6e9c690f2d27..26289a36b864 100644 --- a/compiler/src/iree/compiler/API/api_exports.macos.lst +++ b/compiler/src/iree/compiler/API/api_exports.macos.lst @@ -1,4 +1,6 @@ # Generated by generate_exports.py: Do not edit. +_ireeAttributeIsAGPUPipelineOptionsAttr +_ireeAttributeIsAGPUReorderWorkgroupsStrategyAttr _ireeCompilerEnumeratePlugins _ireeCompilerEnumerateRegisteredHALTargetBackends _ireeCompilerErrorDestroy @@ -50,6 +52,14 @@ _ireeCompilerSourceDestroy _ireeCompilerSourceOpenFile _ireeCompilerSourceSplit _ireeCompilerSourceWrapBuffer +_ireeGPUPipelineOptionsAttrGet +_ireeGPUPipelineOptionsAttrGetNoReduceSharedMemoryBankConflicts +_ireeGPUPipelineOptionsAttrGetPrefetchSharedMemory +_ireeGPUPipelineOptionsAttrGetReorderWorkgroupsStrategy +_ireeGPUPipelineOptionsAttrGetTypeID +_ireeGPUReorderWorkgroupsStrategyAttrGet +_ireeGPUReorderWorkgroupsStrategyAttrGetTypeID +_ireeGPUReorderWorkgroupsStrategyAttrGetValue _ireeMlirLspServerRunMain _ireeOptRunMain _ireeReduceRunMain diff --git a/compiler/src/iree/compiler/API/generate_exports.py b/compiler/src/iree/compiler/API/generate_exports.py index d7d2cd55e004..9b2c767f1d06 100755 --- a/compiler/src/iree/compiler/API/generate_exports.py +++ b/compiler/src/iree/compiler/API/generate_exports.py @@ -71,6 +71,10 @@ "Dialects.h", ] +IREE_COMPILER_DIALECTS_HEADER_FILES = [ + "iree_gpu.h", +] + EXPLICIT_EXPORTS = [ # MLIR registration functions that are part of generated code. "mlirRegisterGPUPasses", @@ -107,6 +111,14 @@ def main(repo_root: Path, api_root: Path): ) ) + # Collect symbols from iree compiler dialect header files. + for local_name in IREE_COMPILER_DIALECTS_HEADER_FILES: + export_symbols.extend( + collect_header_exports( + repo_root / "compiler/bindings/c/iree/compiler/dialects" / local_name + ) + ) + # Collect symbols from mlir-c header files. mlir_c_dir = repo_root / "third_party/llvm-project/mlir/include/mlir-c" for local_name in MLIR_C_HEADER_FILES: @@ -179,6 +191,8 @@ def generate_force_extern(symbols: List[str], file: Path): f.write("\n") f.write("// Generated by generate_exports.py: Do not edit.\n") f.write("\n") + f.write("// clang-format off\n") + f.write("\n") f.write("#include \n") f.write("\n") for symbol in symbols: @@ -190,6 +204,8 @@ def generate_force_extern(symbols: List[str], file: Path): f.write(f" x += (uintptr_t)&{symbol};\n") f.write(" return x;\n") f.write("}\n") + f.write("\n") + f.write("// clang-format off\n") if __name__ == "__main__": diff --git a/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/IREEGPUAttrs.cpp b/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/IREEGPUAttrs.cpp index 843ae5292fa9..45b3f4baae64 100644 --- a/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/IREEGPUAttrs.cpp +++ b/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/IREEGPUAttrs.cpp @@ -14,7 +14,6 @@ #include "iree/compiler/Codegen/Dialect/GPU/IR/IREEGPUInterfaces.h" #include "iree/compiler/Codegen/Dialect/VectorExt/IR/VectorExtDialect.h" #include "iree/compiler/Codegen/Utils/VectorOpUtils.h" -#include "iree/compiler/dialects/iree_gpu.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLForwardCompat.h" #include "llvm/ADT/SmallVector.h" @@ -1690,112 +1689,3 @@ void IREEGPUDialect::registerAttributes() { } } // namespace mlir::iree_compiler::IREE::GPU - -bool ireeAttributeIsAGPUPipelineOptionsAttr(MlirAttribute attr) { - return llvm::isa( - unwrap(attr)); -} - -MlirAttribute -ireeGPUPipelineOptionsAttrGet(MlirContext mlirCtx, bool *prefetchSharedMemory, - bool *noReduceSharedMemoryBankConflicts, - MlirAttribute *reorderWorkgroupsStrategy) { - mlir::MLIRContext *ctx = unwrap(mlirCtx); - mlir::Builder b(ctx); - auto prefetchSharedMemoryAttr = mlir::BoolAttr(); - if (prefetchSharedMemory) { - prefetchSharedMemoryAttr = b.getBoolAttr(*prefetchSharedMemory); - } - auto noReduceSharedMemoryBankConflictsAttr = mlir::BoolAttr(); - if (noReduceSharedMemoryBankConflicts) { - noReduceSharedMemoryBankConflictsAttr = - b.getBoolAttr(*noReduceSharedMemoryBankConflicts); - } - auto strategyAttr = - mlir::iree_compiler::IREE::GPU::ReorderWorkgroupsStrategyAttr(); - if (reorderWorkgroupsStrategy) { - strategyAttr = llvm::dyn_cast< - mlir::iree_compiler::IREE::GPU::ReorderWorkgroupsStrategyAttr>( - unwrap(*reorderWorkgroupsStrategy)); - } - return wrap(mlir::iree_compiler::IREE::GPU::GPUPipelineOptionsAttr::get( - ctx, prefetchSharedMemoryAttr, noReduceSharedMemoryBankConflictsAttr, - strategyAttr)); -} - -MlirAttribute -ireeGPUPipelineOptionsAttrGetPrefetchSharedMemory(MlirAttribute attr) { - auto gpuAttr = - llvm::cast( - unwrap(attr)); - return wrap(gpuAttr.getPrefetchSharedMemory()); -} - -MlirAttribute ireeGPUPipelineOptionsAttrGetNoReduceSharedMemoryBankConflicts( - MlirAttribute attr) { - auto gpuAttr = - llvm::cast( - unwrap(attr)); - return wrap(gpuAttr.getNoReduceSharedMemoryBankConflicts()); -} - -MlirAttribute -ireeGPUPipelineOptionsAttrGetReorderWorkgroupsStrategy(MlirAttribute attr) { - auto gpuAttr = - llvm::cast( - unwrap(attr)); - return wrap(gpuAttr.getReorderWorkgroupsStrategy()); -} - -MlirTypeID ireeGPUPipelineOptionsAttrGetTypeID() { - return wrap( - mlir::iree_compiler::IREE::GPU::GPUPipelineOptionsAttr::getTypeID()); -} - -static_assert( - static_cast(ireeGPUReorderWorkgroupsStrategyEnumNone) == - static_cast(mlir::iree_compiler::IREE::GPU:: - ReorderWorkgroupsStrategy::None) && - static_cast(ireeGPUReorderWorkgroupsStrategyEnumSwizzle) == - static_cast(mlir::iree_compiler::IREE::GPU:: - ReorderWorkgroupsStrategy::Swizzle) && - static_cast(ireeGPUReorderWorkgroupsStrategyEnumTranspose) == - static_cast(mlir::iree_compiler::IREE::GPU:: - ReorderWorkgroupsStrategy::Transpose) && - static_cast(ireeGPUReorderWorkgroupsStrategyEnumTranspose) == - mlir::iree_compiler::IREE::GPU:: - getMaxEnumValForReorderWorkgroupsStrategy(), - "ireeGPUReorderWorkgroupsStrategyEnum and " - "mlir::iree_compiler::IREE::GPU::ReorderWorkgroupsStrategy definitions " - "have diverged"); - -bool ireeAttributeIsAGPUReorderWorkgroupsStrategyAttr(MlirAttribute attr) { - return llvm::isa< - mlir::iree_compiler::IREE::GPU::ReorderWorkgroupsStrategyAttr>( - unwrap(attr)); -} - -MlirTypeID ireeGPUReorderWorkgroupsStrategyAttrGetTypeID() { - return wrap(mlir::iree_compiler::IREE::GPU::ReorderWorkgroupsStrategyAttr:: - getTypeID()); -} - -MlirAttribute ireeGPUReorderWorkgroupsStrategyAttrGet( - MlirContext mlirCtx, ireeGPUReorderWorkgroupsStrategyEnum value) { - mlir::MLIRContext *ctx = unwrap(mlirCtx); - return wrap( - mlir::iree_compiler::IREE::GPU::ReorderWorkgroupsStrategyAttr::get( - ctx, static_cast< - mlir::iree_compiler::IREE::GPU::ReorderWorkgroupsStrategy>( - value))); -} - -ireeGPUReorderWorkgroupsStrategyEnum -ireeGPUReorderWorkgroupsStrategyAttrGetValue(MlirAttribute attr) { - assert(ireeAttributeIsAGPUReorderWorkgroupsStrategyAttr(attr) && - "attr is not a GPUReorderWorkgroupsStrategyAttr"); - return static_cast( - llvm::cast( - unwrap(attr)) - .getValue()); -}