Skip to content

Commit

Permalink
[BUG] Fixed search_space bug in bench_op.py (#348)
Browse files Browse the repository at this point in the history
In #342 accidentally disable `search_space=2` for `bench_op.py`
Regression script. Fixed it.
  • Loading branch information
vadiklyutiy committed Jul 23, 2024
1 parent 984cf75 commit 29e4c0e
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions tests/benchmarks/bench_op.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@
import sys
import os
import argparse
import numpy as np
import hidet

from hidet.testing.torch_utils import bench_torch_model, Backend


def init_hidet():
import hidet
import os

hidet.option.search_space(2)

# hidet.option.cache_dir(hidet.option.get_cache_dir() + '')
# hidet.option.parallel_tune(max_parallel_jobs=1)
# hidet.option.debug_cache_tuning(True)
# hidet.option.save_lower_ir(True)
# hidet.option.debug_show_verbose_flow_graph(True)

# Initialise compiler server
if os.environ.get('CI_CS_HOSTNAME'):
hidet.option.compile_server.addr(os.environ.get('CI_CS_HOSTNAME'))
hidet.option.compile_server.port(int(os.environ.get('CI_CS_PORT')))
hidet.option.compile_server.username(os.environ.get('CI_CS_USERNAME'))
hidet.option.compile_server.password(os.environ.get('CI_CS_PASSWORD'))
hidet.option.compile_server.repo(os.environ.get('REPO_NAME').strip(), os.environ.get('REPO_BRANCH').strip())
hidet.option.compile_server.enable(flag=True)


def bench_matmul_f16(params: str, *args, **kwargs) -> float:
a_shape, b_shape = params.split(',')
a_shape = [int(s) for s in a_shape.split('x')]
Expand Down Expand Up @@ -149,7 +168,7 @@ def bench_reduce(params: str, *args, **kwargs) -> float:
else:
raise ValueError(f'Benchmark function for operator {operator} not implemented')

Backend(backend='hidet', mode='max-autotune', dtype=dtype).init_hidet()
init_hidet()

with hidet.graph.PassContext() as ctx:
ctx.set_reduce_precision(dtype)
Expand Down

0 comments on commit 29e4c0e

Please sign in to comment.