Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourcery refactored relax branch #1

Open
wants to merge 1 commit into
base: relax
Choose a base branch
from
Open

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Oct 10, 2022

Branch relax refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the relax branch, then run:

git fetch origin sourcery/relax
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from xinetzone October 10, 2022 01:33
Copy link
Author

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Sourcery timed out performing refactorings.

Due to GitHub API limits, only the first 60 comments can be shown.

HARDCODED_ALLOCATIONS = {}
for idx, test in enumerate(_slowest_tests):
HARDCODED_ALLOCATIONS[test] = idx

HARDCODED_ALLOCATIONS = {test: idx for idx, test in enumerate(_slowest_tests)}
Copy link
Author

Choose a reason for hiding this comment

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

Lines 55-58 refactored with the following changes:

if not all(k in os.environ for k in ["CI", "TVM_NUM_SHARDS", "TVM_SHARD_INDEX"]):
if any(
k not in os.environ
for k in ["CI", "TVM_NUM_SHARDS", "TVM_SHARD_INDEX"]
):
Copy link
Author

Choose a reason for hiding this comment

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

Function pytest_collection_modifyitems refactored with the following changes:

Comment on lines -136 to +137
pub_ver = "%s.dev%s" % (dev_version, arr_info[1])
local_ver = "%s+%s" % (pub_ver, arr_info[2])
pub_ver = f"{dev_version}.dev{arr_info[1]}"
local_ver = f"{pub_ver}+{arr_info[2]}"
Copy link
Author

Choose a reason for hiding this comment

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

Function git_describe_version refactored with the following changes:

Comment on lines -148 to +160
result = re.findall(pattern, l)
if result:
if result := re.findall(pattern, l):
assert len(result) == 1
hit_counter += 1
if result[0] != repl:
l = re.sub(pattern, repl, l)
need_update = True
print("%s: %s -> %s" % (file_name, result[0], repl))
print(f"{file_name}: {result[0]} -> {repl}")
else:
print("%s: version is already %s" % (file_name, repl))
print(f"{file_name}: version is already {repl}")

update.append(l)
if hit_counter != 1:
raise RuntimeError("Cannot find version in %s" % file_name)
raise RuntimeError(f"Cannot find version in {file_name}")
Copy link
Author

Choose a reason for hiding this comment

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

Function update refactored with the following changes:

Comment on lines -197 to +201
npm_ver = pub_ver if dev_pos == -1 else "%s.0-%s" % (pub_ver[:dev_pos], pub_ver[dev_pos + 1 :])
npm_ver = (
pub_ver
if dev_pos == -1
else f"{pub_ver[:dev_pos]}.0-{pub_ver[dev_pos + 1:]}"
)

Copy link
Author

Choose a reason for hiding this comment

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

Function sync_version refactored with the following changes:

if target == "metal":
dev = remote.metal(0)
else:
dev = remote.cpu(0)
dev = remote.metal(0) if target == "metal" else remote.cpu(0)
Copy link
Author

Choose a reason for hiding this comment

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

Function test_mobilenet refactored with the following changes:

Comment on lines -177 to 176
help="type of RPC connection (default: tracker), possible values: {}".format(
", ".join(MODES.keys())
),
help=f'type of RPC connection (default: tracker), possible values: {", ".join(MODES.keys())}',
)

Copy link
Author

Choose a reason for hiding this comment

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

Lines 177-179 refactored with the following changes:

@@ -20,6 +20,7 @@
And configure the proxy host field as commented.
"""

Copy link
Author

Choose a reason for hiding this comment

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

Lines 36-36 refactored with the following changes:

Comment on lines -108 to 111
help="type of RPC connection (default: tracker), possible values: {}".format(
", ".join(MODES.keys())
),
help=f'type of RPC connection (default: tracker), possible values: {", ".join(MODES.keys())}',
)

Copy link
Author

Choose a reason for hiding this comment

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

Lines 108-110 refactored with the following changes:

Comment on lines -60 to -61


Copy link
Author

Choose a reason for hiding this comment

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

Lines 60-80 refactored with the following changes:

Comment on lines -211 to +220
all_module_names = []
for name in metadata["modules"].keys():
all_module_names.append(name)

all_module_names = list(metadata["modules"].keys())
assert all(
metadata["modules"][mod_name]["style"] == "full-model" for mod_name in all_module_names
), "when generating AOT, expect only full-model Model Library Format"

workspace_size_bytes = 0
for mod_name in all_module_names:
workspace_size_bytes += metadata["modules"][mod_name]["memory"]["functions"]["main"][0][
workspace_size_bytes = sum(
metadata["modules"][mod_name]["memory"]["functions"]["main"][0][
"workspace_size_bytes"
]
for mod_name in all_module_names
)

Copy link
Author

Choose a reason for hiding this comment

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

Function Handler._template_model_header refactored with the following changes:

Comment on lines -264 to +270
# Check if line has an include
result = re.search(r"#include\s*[<\"]([^>]*)[>\"]", line_str)
if not result:
dst_file.write(line)
else:
if result := re.search(
r"#include\s*[<\"]([^>]*)[>\"]", line_str
):
new_include = self._find_modified_include_path(
project_dir, filename, result.groups()[0]
)
updated_line = f'#include "{new_include}"\n'
dst_file.write(updated_line.encode("utf-8"))
else:
dst_file.write(line)
Copy link
Author

Choose a reason for hiding this comment

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

Function Handler._convert_includes refactored with the following changes:

This removes the following comments ( why? ):

# Check if line has an include

Comment on lines -363 to +360
str_version = re.search(r"Version: ([\.0-9]*)", version_output).group(1)
str_version = re.search(r"Version: ([\.0-9]*)", version_output)[1]
Copy link
Author

Choose a reason for hiding this comment

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

Function Handler._get_platform_version refactored with the following changes:

Comment on lines -431 to +428
assert len(column_headers) > 0
assert column_headers
Copy link
Author

Choose a reason for hiding this comment

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

Function Handler._parse_connected_boards refactored with the following changes:

assert mock_run.call_args_list[1][0][0][0:2] == ["arduino-cli", "upload"]
assert mock_run.call_args_list[1][0][0][:2] == ["arduino-cli", "upload"]
Copy link
Author

Choose a reason for hiding this comment

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

Function TestGenerateProject.test_flash refactored with the following changes:

WEST_CMD = default = sys.executable + " -m west" if sys.executable else None
WEST_CMD = default = f"{sys.executable} -m west" if sys.executable else None
Copy link
Author

Choose a reason for hiding this comment

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

Lines 70-70 refactored with the following changes:

Comment on lines -209 to +216
if len(serial_ports) == 0:
if not serial_ports:
raise Exception(f"No serial port found for board {prop['board']}!")

if len(serial_ports) != 1:
ports_lst = ""
for port in serial_ports:
ports_lst += f"Serial port: {port.device}, serial number: {port.serial_number}\n"
ports_lst = "".join(
f"Serial port: {port.device}, serial number: {port.serial_number}\n"
for port in serial_ports
)
Copy link
Author

Choose a reason for hiding this comment

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

Function generic_find_serial_port refactored with the following changes:

Comment on lines -247 to +248
if not boards:
return []

return ["--snr", boards[0]]
return ["--snr", boards[0]] if boards else []
Copy link
Author

Choose a reason for hiding this comment

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

Function _get_nrf_device_args refactored with the following changes:

for d in (API_SERVER_DIR / "src").iterdir():
if d.is_dir():
PROJECT_TYPES.append(d.name)

PROJECT_TYPES.extend(
d.name for d in (API_SERVER_DIR / "src").iterdir() if d.is_dir()
)
Copy link
Author

Choose a reason for hiding this comment

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

Lines 255-311 refactored with the following changes:

Comment on lines -705 to +714
if nrf_board == None:
if nrf_board is None:
Copy link
Author

Choose a reason for hiding this comment

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

Function ZephyrSerialTransport._find_nrf_serial_port refactored with the following changes:

Comment on lines -765 to -769
to_return = self._port.read(n)
if not to_return:
if to_return := self._port.read(n):
return to_return
else:
raise server.IoTimeoutError()

return to_return
Copy link
Author

Choose a reason for hiding this comment

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

Function ZephyrSerialTransport.read refactored with the following changes:

file_path = pathlib.Path(f"{output_path}/" + name).resolve()
file_path = pathlib.Path(f"{output_path}/{name}").resolve()
Copy link
Author

Choose a reason for hiding this comment

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

Function create_file refactored with the following changes:

for _, label in enumerate(labels):
for label in labels:
Copy link
Author

Choose a reason for hiding this comment

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

Function create_labels_header refactored with the following changes:

Comment on lines -54 to +63
def main(A: T.Buffer[8, "float32"], B: T.Buffer[8, "float32"]) -> None:
def main(self, B: T.Buffer[8, "float32"]) -> None:
T.func_attr({"global_symbol": "main", "tir.noalias": True})
for i_0 in T.thread_binding(2, thread="blockIdx.x"):
for i_2 in T.thread_binding(2, thread="threadIdx.x"):
for i_1 in T.serial(2):
with T.block("B"):
vi = T.axis.spatial(8, i_0 * 4 + i_1 * 2 + i_2)
T.reads(A[vi])
T.reads(self[vi])
T.writes(B[vi])
B[vi] = A[vi] + T.float32(1)
B[vi] = self[vi] + T.float32(1)
Copy link
Author

Choose a reason for hiding this comment

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

Function ModuleGPU.main refactored with the following changes:

Comment on lines -99 to +103
def main(a: T.handle, b: T.handle):
def main(self, b: T.handle):
# We exchange data between function by handles, which are similar to pointer.
T.func_attr({"global_symbol": "main", "tir.noalias": True})
# Create buffer from handles.
A = T.match_buffer(a, (8,), dtype="float32")
A = T.match_buffer(self, (8,), dtype="float32")
Copy link
Author

Choose a reason for hiding this comment

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

Function MyModule.main refactored with the following changes:

ptx = nvcc.compile_cuda(code, target_format="ptx")
return ptx
return nvcc.compile_cuda(code, target_format="ptx")
Copy link
Author

Choose a reason for hiding this comment

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

Function tvm_callback_cuda_compile refactored with the following changes:

Comment on lines -50 to +51
write_code(code, "perf/%s_generated.cu" % TASK)
write_code(code, f"perf/{TASK}_generated.cu")
if USE_MANUAL_CODE:
code = open("perf/%s_manual.cu" % TASK).read()
code = open(f"perf/{TASK}_manual.cu").read()
Copy link
Author

Choose a reason for hiding this comment

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

Function tvm_callback_cuda_postproc refactored with the following changes:

Comment on lines -96 to +95
print("Skip because %s is not enabled" % device)
print(f"Skip because {device} is not enabled")
Copy link
Author

Choose a reason for hiding this comment

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

Function test_depthwise_conv2d_nchw refactored with the following changes:

Comment on lines -202 to +201
print("Skip because %s is not enabled" % device)
print(f"Skip because {device} is not enabled")
Copy link
Author

Choose a reason for hiding this comment

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

Function test_depthwise_conv2d_nhwc refactored with the following changes:

ptx = nvcc.compile_cuda(code, target_format="ptx")
return ptx
return nvcc.compile_cuda(code, target_format="ptx")
Copy link
Author

Choose a reason for hiding this comment

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

Function tvm_callback_cuda_compile refactored with the following changes:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Oct 10, 2022

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.19%.

Quality metrics Before After Change
Complexity 9.54 🙂 9.11 🙂 -0.43 👍
Method Length 89.05 🙂 88.70 🙂 -0.35 👍
Working memory 8.71 🙂 8.71 🙂 0.00
Quality 56.77% 🙂 56.96% 🙂 0.19% 👍
Other metrics Before After Change
Lines 38713 38526 -187
Changed files Quality Before Quality After Quality Change
conftest.py 76.88% ⭐ 76.89% ⭐ 0.01% 👍
version.py 63.90% 🙂 63.42% 🙂 -0.48% 👎
apps/android_camera/models/prepare_model.py 64.98% 🙂 65.20% 🙂 0.22% 👍
apps/android_rpc/tests/android_rpc_test.py 43.55% 😞 43.52% 😞 -0.03% 👎
apps/benchmark/arm_cpu_imagenet_bench.py 55.11% 🙂 55.07% 🙂 -0.04% 👎
apps/benchmark/gpu_imagenet_bench.py 44.63% 😞 44.57% 😞 -0.06% 👎
apps/benchmark/mobile_gpu_imagenet_bench.py 52.89% 🙂 52.85% 🙂 -0.04% 👎
apps/benchmark/util.py 43.73% 😞 43.70% 😞 -0.03% 👎
apps/extension/python/tvm_ext/init.py 97.01% ⭐ 97.73% ⭐ 0.72% 👍
apps/ios_rpc/init_proj.py 72.87% 🙂 73.89% 🙂 1.02% 👍
apps/ios_rpc/tests/ios_rpc_mobilenet.py 55.72% 🙂 56.97% 🙂 1.25% 👍
apps/ios_rpc/tests/ios_rpc_test.py 52.51% 🙂 52.51% 🙂 0.00%
apps/microtvm/arduino/template_project/microtvm_api_server.py 73.96% 🙂 74.09% 🙂 0.13% 👍
apps/microtvm/arduino/template_project/tests/test_arduino_microtvm_api_server.py 75.29% ⭐ 75.33% ⭐ 0.04% 👍
apps/microtvm/cmsisnn/convert_image.py 78.76% ⭐ 78.76% ⭐ 0.00%
apps/microtvm/ethosu/convert_image.py 75.70% ⭐ 75.70% ⭐ 0.00%
apps/microtvm/ethosu/convert_labels.py 79.71% ⭐ 80.19% ⭐ 0.48% 👍
apps/microtvm/reference-vm/base-box-tool.py 56.26% 🙂 55.46% 🙂 -0.80% 👎
apps/microtvm/zephyr/template_project/microtvm_api_server.py 71.65% 🙂 71.81% 🙂 0.16% 👍
apps/microtvm/zephyr_cmsisnn/model/convert_input.py 80.62% ⭐ 80.62% ⭐ 0.00%
apps/microtvm/zephyr_cmsisnn/model/convert_labels.py 82.28% ⭐ 82.77% ⭐ 0.49% 👍
apps/pt_tvmdsoop/tests/test_as_torch.py 74.87% 🙂 74.87% 🙂 0.00%
apps/pt_tvmdsoop/tests/test_optimize_torch.py 85.30% ⭐ 85.52% ⭐ 0.22% 👍
apps/pt_tvmdsoop/tests/test_torch_compile_cpu.py 71.26% 🙂 73.18% 🙂 1.92% 👍
apps/pt_tvmdsoop/tests/test_torch_compile_gpu.py 54.36% 🙂 56.26% 🙂 1.90% 👍
apps/pt_tvmdsoop/tests/test_torch_graph_module.py 36.93% 😞 38.23% 😞 1.30% 👍
apps/pt_tvmdsoop/tests/test_torch_script.py 56.06% 🙂 56.04% 🙂 -0.02% 👎
apps/pt_tvmdsoop/tests/test_torch_vm_module.py 37.15% 😞 38.44% 😞 1.29% 👍
apps/relax_examples/mlp.py 75.07% ⭐ 74.73% 🙂 -0.34% 👎
apps/topi_recipe/broadcast/test_broadcast_map.py 57.96% 🙂 57.38% 🙂 -0.58% 👎
apps/topi_recipe/conv/depthwise_conv2d_test.py 48.38% 😞 48.05% 😞 -0.33% 👎
apps/topi_recipe/conv/test_conv2d_hwcn_map.py 62.23% 🙂 61.52% 🙂 -0.71% 👎
apps/topi_recipe/conv/test_conv_int8_arm.py 44.82% 😞 44.79% 😞 -0.03% 👎
apps/topi_recipe/conv/test_conv_int8_intel.py 49.41% 😞 49.48% 😞 0.07% 👍
apps/topi_recipe/gemm/android_gemm_square.py 47.52% 😞 47.50% 😞 -0.02% 👎
apps/topi_recipe/gemm/cuda_gemm_square.py 44.95% 😞 44.95% 😞 0.00%
apps/topi_recipe/reduce/test_reduce_map.py 60.99% 🙂 60.88% 🙂 -0.11% 👎
apps/topi_recipe/rnn/lstm.py 47.16% 😞 46.70% 😞 -0.46% 👎
apps/topi_recipe/rnn/matexp.py 35.04% 😞 34.42% 😞 -0.62% 👎
apps/uma/uma_cli.py 73.64% 🙂 72.52% 🙂 -1.12% 👎
apps/uma/_template/passes.py 41.60% 😞 41.63% 😞 0.03% 👍
ci/jenkins/generate.py 57.63% 🙂 59.97% 🙂 2.34% 👍
conda/render_cuda_dockerfiles.py 85.31% ⭐ 84.41% ⭐ -0.90% 👎
docs/conf.py 66.78% 🙂 66.62% 🙂 -0.16% 👎
docs/script_convert.py 43.93% 😞 46.13% 😞 2.20% 👍
gallery/how_to/compile_models/from_keras.py 43.94% 😞 43.91% 😞 -0.03% 👎
gallery/how_to/compile_models/from_mxnet.py 74.51% 🙂 73.99% 🙂 -0.52% 👎
gallery/how_to/compile_models/from_oneflow.py 59.75% 🙂 59.16% 🙂 -0.59% 👎
gallery/how_to/compile_models/from_pytorch.py 43.71% 😞 43.70% 😞 -0.01% 👎
gallery/how_to/compile_models/from_tensorflow.py 45.60% 😞 45.78% 😞 0.18% 👍
gallery/how_to/compile_models/from_tflite.py 52.59% 🙂 52.57% 🙂 -0.02% 👎
gallery/how_to/deploy_models/deploy_model_on_android.py 47.07% 😞 47.30% 😞 0.23% 👍
gallery/how_to/deploy_models/deploy_model_on_nano.py 56.31% 🙂 57.41% 🙂 1.10% 👍
gallery/how_to/deploy_models/deploy_model_on_rasp.py 60.45% 🙂 60.48% 🙂 0.03% 👍
gallery/how_to/deploy_models/deploy_object_detection_pytorch.py 66.58% 🙂 66.58% 🙂 0.00%
gallery/how_to/deploy_models/deploy_prequantized_tflite.py 77.18% ⭐ 77.97% ⭐ 0.79% 👍
gallery/how_to/deploy_models/deploy_sparse.py 65.39% 🙂 65.39% 🙂 0.00%
gallery/how_to/extend_tvm/bring_your_own_datatypes.py 51.78% 🙂 51.80% 🙂 0.02% 👍
gallery/how_to/extend_tvm/low_level_custom_pass.py 76.04% ⭐ 76.14% ⭐ 0.10% 👍
gallery/how_to/extend_tvm/use_pass_instrument.py 79.20% ⭐ 79.16% ⭐ -0.04% 👎
gallery/how_to/tune_with_autoscheduler/tune_network_arm.py 49.45% 😞 49.45% 😞 0.00%
gallery/how_to/tune_with_autoscheduler/tune_network_cuda.py 57.74% 🙂 57.73% 🙂 -0.01% 👎
gallery/how_to/tune_with_autoscheduler/tune_network_mali.py 52.52% 🙂 52.51% 🙂 -0.01% 👎
gallery/how_to/tune_with_autoscheduler/tune_network_x86.py 51.28% 🙂 51.27% 🙂 -0.01% 👎
gallery/how_to/tune_with_autoscheduler/tune_sparse_x86.py 51.90% 🙂 52.54% 🙂 0.64% 👍
gallery/how_to/tune_with_autotvm/tune_relay_arm.py 48.12% 😞 49.25% 😞 1.13% 👍
gallery/how_to/tune_with_autotvm/tune_relay_cuda.py 51.96% 🙂 53.31% 🙂 1.35% 👍
gallery/how_to/tune_with_autotvm/tune_relay_mobile_gpu.py 50.97% 🙂 52.08% 🙂 1.11% 👍
gallery/how_to/tune_with_autotvm/tune_relay_x86.py 62.23% 🙂 62.55% 🙂 0.32% 👍
gallery/how_to/work_with_microtvm/micro_tflite.py 37.00% 😞 36.99% 😞 -0.01% 👎
gallery/how_to/work_with_microtvm/micro_train.py 47.21% 😞 47.21% 😞 0.00%
gallery/how_to/work_with_relay/build_gcn.py 63.26% 🙂 63.45% 🙂 0.19% 👍
gallery/how_to/work_with_relay/using_pipeline_executor.py 57.70% 🙂 57.39% 🙂 -0.31% 👎
gallery/how_to/work_with_schedules/extern_op.py 50.10% 🙂 50.07% 🙂 -0.03% 👎
gallery/how_to/work_with_schedules/intrin_math.py 64.12% 🙂 64.10% 🙂 -0.02% 👎
gallery/how_to/work_with_schedules/tensorize.py 64.38% 🙂 63.85% 🙂 -0.53% 👎
gallery/tutorial/autotvm_relay_x86.py 30.76% 😞 30.76% 😞 0.00%
gallery/tutorial/cross_compilation_and_rpc.py 54.41% 🙂 55.28% 🙂 0.87% 👍
gallery/tutorial/relay_quick_start.py 50.79% 🙂 50.85% 🙂 0.06% 👍
gallery/tutorial/tensor_ir_blitz_course.py 62.44% 🙂 62.44% 🙂 0.00%
golang/sample/gen_mobilenet_lib.py 67.55% 🙂 67.52% 🙂 -0.03% 👎
jvm/core/src/test/scripts/test_add_gpu.py 70.73% 🙂 69.60% 🙂 -1.13% 👎
python/gen_requirements.py 53.77% 🙂 53.25% 🙂 -0.52% 👎
python/setup.py 53.46% 🙂 54.67% 🙂 1.21% 👍
python/tvm/init.py 81.06% ⭐ 81.06% ⭐ 0.00%
python/tvm/support.py 80.31% ⭐ 80.31% ⭐ 0.00%
python/tvm/_ffi/_pyversion.py 82.18% ⭐ 82.35% ⭐ 0.17% 👍
python/tvm/_ffi/base.py 67.71% 🙂 68.77% 🙂 1.06% 👍
python/tvm/_ffi/libinfo.py 38.04% 😞 37.60% 😞 -0.44% 👎
python/tvm/_ffi/registry.py 79.34% ⭐ 79.60% ⭐ 0.26% 👍
python/tvm/_ffi/runtime_ctypes.py 71.35% 🙂 71.14% 🙂 -0.21% 👎
python/tvm/_ffi/_ctypes/packed_func.py 56.20% 🙂 56.04% 🙂 -0.16% 👎
python/tvm/arith/analyzer.py 93.81% ⭐ 93.83% ⭐ 0.02% 👍
python/tvm/auto_scheduler/compute_dag.py 77.44% ⭐ 77.99% ⭐ 0.55% 👍
python/tvm/auto_scheduler/dispatcher.py 56.00% 🙂 56.92% 🙂 0.92% 👍
python/tvm/auto_scheduler/feature.py 63.21% 🙂 63.21% 🙂 0.00%
python/tvm/auto_scheduler/loop_state.py 88.81% ⭐ 88.82% ⭐ 0.01% 👍
python/tvm/auto_scheduler/measure.py 51.92% 🙂 51.65% 🙂 -0.27% 👎
python/tvm/auto_scheduler/measure_record.py 61.47% 🙂 61.47% 🙂 0.00%
python/tvm/auto_scheduler/relay_integration.py 58.71% 🙂 58.81% 🙂 0.10% 👍
python/tvm/auto_scheduler/search_policy.py 84.75% ⭐ 83.97% ⭐ -0.78% 👎
python/tvm/auto_scheduler/search_task.py 64.27% 🙂 63.53% 🙂 -0.74% 👎
python/tvm/auto_scheduler/task_scheduler.py 36.26% 😞 36.64% 😞 0.38% 👍
python/tvm/auto_scheduler/utils.py 78.87% ⭐ 78.90% ⭐ 0.03% 👍
python/tvm/auto_scheduler/workload_registry.py 81.89% ⭐ 82.08% ⭐ 0.19% 👍
python/tvm/auto_scheduler/cost_model/xgb_model.py 42.87% 😞 43.10% 😞 0.23% 👍
python/tvm/autotvm/database.py 77.86% ⭐ 77.95% ⭐ 0.09% 👍
python/tvm/autotvm/feature.py 69.28% 🙂 71.28% 🙂 2.00% 👍
python/tvm/autotvm/record.py 40.44% 😞 40.61% 😞 0.17% 👍
python/tvm/autotvm/tophub.py 53.26% 🙂 55.09% 🙂 1.83% 👍
python/tvm/autotvm/graph_tuner/base_graph_tuner.py 25.77% 😞 26.71% 😞 0.94% 👍
python/tvm/autotvm/graph_tuner/dynamic_programming_stage.py 32.02% 😞 33.63% 😞 1.61% 👍
python/tvm/autotvm/graph_tuner/dynamic_programming_tuner.py 23.85% ⛔ 25.08% 😞 1.23% 👍
python/tvm/autotvm/graph_tuner/pbqp_tuner.py 48.77% 😞 48.46% 😞 -0.31% 👎
python/tvm/autotvm/graph_tuner/utils/traverse_graph.py 29.76% 😞 29.74% 😞 -0.02% 👎
python/tvm/autotvm/graph_tuner/utils/utils.py 62.76% 🙂 63.75% 🙂 0.99% 👍
python/tvm/autotvm/measure/measure.py 84.66% ⭐ 84.83% ⭐ 0.17% 👍
python/tvm/autotvm/measure/measure_methods.py 54.19% 🙂 55.42% 🙂 1.23% 👍
python/tvm/autotvm/task/dispatcher.py 71.07% 🙂 71.99% 🙂 0.92% 👍
python/tvm/autotvm/task/space.py 61.94% 🙂 62.11% 🙂 0.17% 👍
python/tvm/autotvm/task/task.py 61.91% 🙂 61.05% 🙂 -0.86% 👎
python/tvm/autotvm/task/topi_integration.py 66.23% 🙂 66.79% 🙂 0.56% 👍
python/tvm/autotvm/tuner/ga_tuner.py 44.01% 😞 44.61% 😞 0.60% 👍
python/tvm/autotvm/tuner/model_based_tuner.py 66.02% 🙂 65.98% 🙂 -0.04% 👎
python/tvm/autotvm/tuner/tuner.py 39.34% 😞 40.24% 😞 0.90% 👍
python/tvm/autotvm/tuner/xgboost_cost_model.py 49.70% 😞 49.80% 😞 0.10% 👍
python/tvm/contrib/cblas.py 62.85% 🙂 62.93% 🙂 0.08% 👍
python/tvm/contrib/cc.py 63.95% 🙂 65.35% 🙂 1.40% 👍
python/tvm/contrib/clang.py 59.09% 🙂 59.26% 🙂 0.17% 👍
python/tvm/contrib/cudnn.py 49.12% 😞 48.63% 😞 -0.49% 👎
python/tvm/contrib/download.py 38.43% 😞 38.41% 😞 -0.02% 👎
python/tvm/contrib/graph_executor.py 75.32% ⭐ 76.06% ⭐ 0.74% 👍
python/tvm/contrib/mkl.py 64.15% 🙂 64.20% 🙂 0.05% 👍
python/tvm/contrib/mxnet.py 69.76% 🙂 69.94% 🙂 0.18% 👍
python/tvm/contrib/ndk.py 71.84% 🙂 73.30% 🙂 1.46% 👍
python/tvm/contrib/nvcc.py 63.10% 🙂 60.94% 🙂 -2.16% 👎
python/tvm/contrib/peak.py 44.95% 😞 44.93% 😞 -0.02% 👎
python/tvm/contrib/pickle_memoize.py 58.90% 🙂 58.88% 🙂 -0.02% 👎
python/tvm/contrib/pipeline_executor.py 71.79% 🙂 73.48% 🙂 1.69% 👍
python/tvm/contrib/pipeline_executor_build.py 59.96% 🙂 61.21% 🙂 1.25% 👍
python/tvm/contrib/popen_pool.py 74.72% 🙂 75.23% ⭐ 0.51% 👍
python/tvm/contrib/rocm.py 75.35% ⭐ 75.12% ⭐ -0.23% 👎
python/tvm/contrib/sdaccel.py 44.33% 😞 44.22% 😞 -0.11% 👎
python/tvm/contrib/sparse.py 66.44% 🙂 67.36% 🙂 0.92% 👍
python/tvm/contrib/tar.py 72.25% 🙂 72.18% 🙂 -0.07% 👎
python/tvm/contrib/tedd.py 36.37% 😞 36.07% 😞 -0.30% 👎
python/tvm/contrib/thrust.py 82.08% ⭐ 82.15% ⭐ 0.07% 👍
python/tvm/contrib/utils.py 84.72% ⭐ 85.26% ⭐ 0.54% 👍
python/tvm/contrib/xcode.py 70.16% 🙂 70.26% 🙂 0.10% 👍
python/tvm/contrib/cutlass/build.py 57.93% 🙂 57.86% 🙂 -0.07% 👎
python/tvm/contrib/cutlass/conv2d_operation.py 61.30% 🙂 61.80% 🙂 0.50% 👍
python/tvm/contrib/cutlass/conv2d_profiler.py 86.28% ⭐ 89.10% ⭐ 2.82% 👍
python/tvm/contrib/cutlass/gemm_operation.py 69.60% 🙂 70.65% 🙂 1.05% 👍
python/tvm/contrib/cutlass/gemm_profiler.py 86.82% ⭐ 90.11% ⭐ 3.29% 👍
python/tvm/contrib/cutlass/gen_conv2d.py 45.07% 😞 45.07% 😞 0.00%
python/tvm/contrib/cutlass/gen_gemm.py 54.56% 🙂 54.58% 🙂 0.02% 👍
python/tvm/contrib/cutlass/gen_tensor_op.py 56.18% 🙂 56.27% 🙂 0.09% 👍
python/tvm/contrib/debugger/debug_executor.py 75.59% ⭐ 75.51% ⭐ -0.08% 👎
python/tvm/contrib/debugger/debug_result.py 64.16% 🙂 65.03% 🙂 0.87% 👍
python/tvm/contrib/ethosu/cascader/device_config.py 36.14% 😞 36.52% 😞 0.38% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
python/tvm/auto_scheduler/cost_model/xgb_model.py custom_callback 66 ⛔ 569 ⛔ 2.24% ⛔ Refactor to reduce nesting. Try splitting into smaller methods
python/tvm/autotvm/tuner/xgboost_cost_model.py custom_callback 61 ⛔ 559 ⛔ 2.92% ⛔ Refactor to reduce nesting. Try splitting into smaller methods
python/tvm/contrib/tedd.py dump_json 49 ⛔ 680 ⛔ 5.14% ⛔ Refactor to reduce nesting. Try splitting into smaller methods
python/tvm/autotvm/graph_tuner/utils/traverse_graph.py _expr2graph_impl 52 ⛔ 469 ⛔ 5.23% ⛔ Refactor to reduce nesting. Try splitting into smaller methods
python/tvm/contrib/ethosu/cascader/device_config.py EthosuDeviceConfig.get_valid_block_configs 46 ⛔ 578 ⛔ 28 ⛔ 5.39% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants