-
Notifications
You must be signed in to change notification settings - Fork 598
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c7213de
commit c0d99c9
Showing
12 changed files
with
182 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// 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 | ||
|
||
#ifndef IREE_COMPILER_DIALECTS_IREE_GPU_H | ||
#define IREE_COMPILER_DIALECTS_IREE_GPU_H | ||
|
||
#include "mlir-c/IR.h" | ||
#include "mlir-c/Support.h" | ||
#include "mlir/CAPI/Wrap.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
MLIR_CAPI_EXPORTED bool | ||
ireeAttributeIsAGPUPipelineOptionsAttr(MlirAttribute attr); | ||
|
||
MLIR_CAPI_EXPORTED MlirAttribute | ||
ireeGPUObjectAttrGet(MlirContext mlirCtx, bool prefetchSharedMemory, | ||
bool noReduceSharedMemoryBankConflicts); | ||
|
||
MLIR_CAPI_EXPORTED bool | ||
ireeGPUObjectAttrGetPrefetchSharedMemory(MlirAttribute attr); | ||
|
||
MLIR_CAPI_EXPORTED bool | ||
ireeGPUObjectAttrGetNoReduceSharedMemoryBankConflicts(MlirAttribute attr); | ||
|
||
MLIR_CAPI_EXPORTED MlirTypeID ireeGPUObjectAttrGetTypeID(void); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif // IREE_COMPILER_DIALECTS_IREE_GPU_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// 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/dialects/iree_gpu.h" | ||
#include "mlir-c/IR.h" | ||
#include "mlir/Bindings/Python/PybindAdaptors.h" | ||
|
||
namespace py = pybind11; | ||
using namespace mlir::python::adaptors; | ||
|
||
PYBIND11_MODULE(_ireeCompilerDialects, m) { | ||
m.doc() = "iree-compiler dialects python extension"; | ||
|
||
//===-------------------------------------------------------------------===// | ||
// GPUPipelineOptionsAttr | ||
//===-------------------------------------------------------------------===// | ||
|
||
mlir_attribute_subclass(m, "GPUPipelineOptionsAttr", | ||
ireeAttributeIsAGPUPipelineOptionsAttr, | ||
ireeGPUObjectAttrGetTypeID) | ||
.def_classmethod( | ||
"get", | ||
[](const py::object &, bool prefetchSharedMemory, | ||
bool noReduceSharedMemoryBankConflicts, MlirContext ctx) { | ||
return ireeGPUObjectAttrGet(ctx, prefetchSharedMemory, | ||
noReduceSharedMemoryBankConflicts); | ||
}, | ||
"cls"_a, "prefetch_shared_memory"_a, | ||
"no_reduce_shared_memory_bank_conflicts"_a, "ctx"_a = py::none(), | ||
"Gets a gpu.pipeline_options from parameters.") | ||
.def_property_readonly("prefetch_shared_memory", | ||
[](MlirAttribute self) { | ||
return ireeGPUObjectAttrGetPrefetchSharedMemory( | ||
self); | ||
}) | ||
.def_property_readonly( | ||
"no_reduce_shared_memory_bank_conflicts", [](MlirAttribute self) { | ||
return ireeGPUObjectAttrGetNoReduceSharedMemoryBankConflicts(self); | ||
}); | ||
} |
12 changes: 12 additions & 0 deletions
12
compiler/bindings/python/iree/compiler/dialects/IREEGPUBinding.td
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// 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 | ||
|
||
#ifndef PYTHON_BINDINGS_IREEGPU_OPS | ||
#define PYTHON_BINDINGS_IREEGPU_OPS | ||
|
||
include "iree/compiler/Codegen/Dialect/GPU/IR/IREEGPUOps.td" | ||
|
||
#endif // PYTHON_BINDINGS_IREEGPU_OPS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# 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 | ||
|
||
from ._iree_gpu_ops_gen import * | ||
from ._iree_gpu_enum_gen import * | ||
from .._mlir_libs._ireeCompilerDialects import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters