Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
https://www.apache.org/licenses/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LICENSE update isn’t related to this PR. I’d suggest we avoid changing it here and handle it in a separate PR if needed.


TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

Expand Down Expand Up @@ -192,7 +192,7 @@
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<!--- "License"); you may not use this file except in compliance -->
<!--- with the License. You may obtain a copy of the License at -->

<!--- http://www.apache.org/licenses/LICENSE-2.0 -->
<!--- https://www.apache.org/licenses/LICENSE-2.0 -->

<!--- Unless required by applicable law or agreed to in writing, -->
<!--- software distributed under the License is distributed on an -->
Expand Down
25 changes: 21 additions & 4 deletions docs/how_to/tutorials/customize_opt.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Licensed to the Apache Software Foundation (ASF) under one
# Licensed to the Apache Software Foundation (ASF) under one
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This line contains a Unicode Byte Order Mark (BOM) \ufeff, which is unnecessary for UTF-8 encoded files and can cause issues with some tools. It should be removed.

Suggested change
# Licensed to the Apache Software Foundation (ASF) under one
# Licensed to the Apache Software Foundation (ASF) under one

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls take a look

# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
Expand Down Expand Up @@ -55,6 +55,12 @@
from tvm import IRModule, relax
from tvm.relax.frontend import nn

# Note: This tutorial requires TVM to be built with CUDA support.
# If you encounter 'No module named ''tvm_ffi''' error,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tvm_ffi can be installed with cd 3rdparty/tvm-ffi; pip install .

# you need to build TVM from source with CUDA enabled.
# Build instructions: https://tvm.apache.org/docs/install/from_source.html


######################################################################
# Composable IRModule Optimization
# --------------------------------
Expand Down Expand Up @@ -103,9 +109,17 @@ def forward(self, x):


# Import cublas pattern
import tvm.relax.backend.cuda.cublas as _cublas


try:
import tvm.relax.backend.cuda.cublas as _cublas
except ImportError as e:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably we don't have to handle the tvm_ffi specifically here

if "tvm_ffi" in str(e):
import sys
print("Error: TVM needs to be built with CUDA support.", file=sys.stderr)
print("Please build TVM from source with CUDA enabled.", file=sys.stderr)
print("See: https://tvm.apache.org/docs/install/from_source.html", file=sys.stderr)
sys.exit(1)
else:
raise
# Define a new pass for CUBLAS dispatch
@tvm.transform.module_pass(opt_level=0, name="CublasDispatch")
class CublasDispatch:
Expand Down Expand Up @@ -223,3 +237,6 @@ def transform_module(self, mod: IRModule, _ctx: tvm.transform.PassContext) -> IR
# of the computation graph. The flexibility of the optimization pipeline enables us to quickly
# iterate the optimization and improve the performance of the model.
#


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There are multiple empty lines at the end of the file. It's a common convention to have only a single newline at the end of a file. Please remove the extra ones.