forked from buddy-compiler/buddy-mlir
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[frontend] Add verbose mode for torch dynamo compiler.
- Loading branch information
Showing
3 changed files
with
53 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 |
---|---|---|
|
@@ -7,3 +7,4 @@ accelerate | |
protobuf | ||
pybind11 == 2.11.1 | ||
torchvision | ||
tabulate |
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,39 @@ | ||
# RUN: %PYTHON %s 2>&1 | FileCheck %s | ||
import torch | ||
|
||
from buddy.compiler.frontend import DynamoCompiler | ||
|
||
|
||
# Define the target function or model. | ||
def foo(x, y): | ||
return x * y + x | ||
|
||
|
||
# Define the input data. | ||
float32_in1 = torch.randn(10).to(torch.float32) | ||
float32_in2 = torch.randn(10).to(torch.float32) | ||
|
||
# Test the default dynamo compiler importer mode. | ||
dynamo_compiler_default = DynamoCompiler() | ||
graphs = dynamo_compiler_default.importer(foo, *(float32_in1, float32_in2)) | ||
|
||
# Ensure no output is printed in the default mode. | ||
# CHECK-NOT: . | ||
|
||
# Test the dynamo compiler verbose mode. | ||
dynamo_compiler_verbose_on = DynamoCompiler(verbose=True) | ||
graphs = dynamo_compiler_verbose_on.importer(foo, *(float32_in1, float32_in2)) | ||
|
||
# Test output in the verbose mode. | ||
# CHECK: placeholder | ||
# CHECK: placeholder | ||
# CHECK: call_function | ||
# CHECK: call_function | ||
# CHECK: output | ||
|
||
# Test the dynamo compiler verbose mode off. | ||
dynamo_compiler_verbose_off = DynamoCompiler(verbose=False) | ||
graphs = dynamo_compiler_verbose_off.importer(foo, *(float32_in1, float32_in2)) | ||
|
||
# Ensure no output is printed when the verbose mode is off. | ||
# CHECK-NOT: . |