Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mlir] enable python bindings for nvgpu transforms (#68088)
Expose the autogenerated bindings. Co-authored-by: Martin Lücke <mluecke@google.com>
- Loading branch information
Showing
5 changed files
with
81 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//===-- NVGPUTransformOps.td -------------------------------*- tablegen -*-===// | ||
// | ||
// Part of the LLVM Project, 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Entry point of the Python bindings generator for the transform ops provided | ||
// by the NVGPU dialect. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
|
||
#ifndef PYTHON_BINDINGS_NVGPU_TRANSFORM_OPS | ||
#define PYTHON_BINDINGS_NVGPU_TRANSFORM_OPS | ||
|
||
include "mlir/Dialect/NVGPU/TransformOps/NVGPUTransformOps.td" | ||
|
||
#endif // PYTHON_BINDINGS_NVGPU_TRANSFORM_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,5 @@ | ||
# Part of the LLVM Project, 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 .._nvgpu_transform_ops_gen 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# RUN: %PYTHON %s | FileCheck %s | ||
|
||
from mlir.ir import * | ||
from mlir.dialects import transform | ||
from mlir.dialects.transform import nvgpu | ||
|
||
|
||
def run(f): | ||
with Context(), Location.unknown(): | ||
module = Module.create() | ||
with InsertionPoint(module.body): | ||
print("\nTEST:", f.__name__) | ||
f() | ||
print(module) | ||
return f | ||
|
||
|
||
@run | ||
def testCreateAsyncGroups(): | ||
sequence = transform.SequenceOp( | ||
transform.FailurePropagationMode.Propagate, [], transform.AnyOpType.get() | ||
) | ||
with InsertionPoint(sequence.body): | ||
nvgpu.CreateAsyncGroupsOp(transform.AnyOpType.get(), sequence.bodyTarget) | ||
transform.YieldOp() | ||
# CHECK-LABEL: TEST: testCreateAsyncGroups | ||
# CHECK: transform.nvgpu.create_async_groups |
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