Skip to content
Snippets Groups Projects
Commit 63cf585b authored by Yifan Zhao's avatar Yifan Zhao
Browse files

approxhpvm.py => hpvm-clang renaming worldwide

parent 7159ab99
No related branches found
No related tags found
No related merge requests found
......@@ -143,14 +143,14 @@ Some common options that can be used with CMake are:
* ``-DCMAKE_BUILD_TYPE=type`` --- Valid options for type are Debug, Release, RelWithDebInfo, and MinSizeRel. Default is Debug.
* ``-DLLVM_ENABLE_ASSERTIONS=On`` --- Compile with assertion checks enabled (default is Yes for Debug builds, No for all other build types).
Now, compile the HPVM Compilation Tool ``approxhpvm.py`` using:
Now, compile the HPVM Compilation Tool ``hpvm-clang`` using:
.. code-block:: shell
make -j<number of threads> approxhpvm.py
make -j<number of threads> hpvm-clang
With all the aforementioned steps, HPVM should be built, installed, tested and ready to use.
In particular, ``approxhpvm.py`` should be an executable command from your command line.
In particular, ``hpvm-clang`` should be an executable command from your command line.
Benchmarks and Tests
--------------------
......@@ -159,7 +159,7 @@ We provide a number of general benchmarks, DNN benchmarks, and test cases, writt
``make`` targets ``check-hpvm-pass``, ``check-hpvm-dnn``, and ``check-hpvm-profiler``
tests various components of HPVM and are increasingly time-consuming.
You can run tests similarly as how ``approxhpvm.py`` is compiled: for example,
You can run tests similarly as how ``hpvm-clang`` is compiled: for example,
.. code-block:: shell
......
......@@ -53,7 +53,7 @@ endif()
# -- Manually list the directories (TRT_LINK_DIRS) and libraries (TRT_LINK_LIBS)
# tensor_runtime links to, because CMake doesn't help us do this.
# This is needed by both approxhpvm.py and the RPATH setting step (below).
# This is needed by both hpvm-clang and the RPATH setting step (below).
# First, take a guess at the paths to the libraries that are used here.
# (CMake, why do you make this so difficult?)
foreach(interface_lib ${LINK_LIBS})
......@@ -120,7 +120,7 @@ function(add_tensor_runtime target_name)
target_link_options(${target_name} PRIVATE "-Wl,-rpath,${libdir}")
endforeach()
# Also slap TRT_LINK_DIRS and TRT_LINK_LIBS on this target
# so that approxhpvm.py can read them. (we'll create our own properties.)
# so that hpvm-clang can read them. (we'll create our own properties.)
set_target_properties(
${target_name} PROPERTIES
TRT_LINK_DIRS "${TRT_LINK_DIRS}"
......
......@@ -172,7 +172,7 @@ class ModelExporter:
from subprocess import run
args = [
"approxhpvm.py",
"hpvm-clang",
str(self.codefile),
str(output_binary),
*self.compile_args,
......
......@@ -30,7 +30,7 @@ LINKS = [
"test",
"tools",
]
MAKE_TARGETS = ["approxhpvm.py"]
MAKE_TARGETS = ["hpvm-clang"]
MAKE_TEST_TARGETS = ["check-hpvm-dnn", "check-hpvm-pass"]
# Relative to project root which is __file__.parent.parent
......@@ -345,7 +345,7 @@ HPVM not installed.
To complete installation, follow these instructions:
- Create and navigate to a folder "./build"
- Run "cmake ../llvm [options]". Find potential options in README.md.
- Run "make -j<number of threads> approxhpvm.py" and then "make install"
- Run "make -j<number of threads> hpvm-clang" and then "make install"
For more details refer to README.md.
"""
)
......
# First get approxhpvm.py which we then use to compile benchmarks.
get_filename_component(APPROXHPVM_PY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/approxhpvm.py REALPATH)
# Each source file contains a @MODEL_PARAMS_DIR@ waiting to be filled in.
set(MODEL_PARAMS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../model_params/")
set(test_compile_targets "")
......@@ -12,8 +9,8 @@ function(compile_hpvm_c target_name src_filepath codegen_target)
# the name of output file and custom target to clash.
add_custom_command(
OUTPUT ${output_bin_path}
DEPENDS ${generated_file_path} approxhpvm.py
COMMAND ${APPROXHPVM_PY}
DEPENDS ${generated_file_path} hpvm-clang
COMMAND hpvm-clang
${generated_file_path} ${output_bin_path}
-t ${codegen_target} -I ${CMAKE_CURRENT_SOURCE_DIR}/include ${ARGN}
)
......
......@@ -52,20 +52,23 @@ class Benchmark:
try:
subprocess.run([
"approxhpvm.py",
"hpvm-clang",
"-h"
], check=True, stdout=FNULL)
except:
print ("\n\n ERROR: Could not find approxhpvm.py (HPVM compile script)!! \n\n")
print ("To Compile, Must set PATH to include approxhpvm.py script. Do the following: ")
print ("**** export PATH=${PATH_TO_YOUR_HPVM_INSTALLATION}/build/bin/:$PATH *****")
print("""
ERROR: Could not find hpvm-clang (HPVM compile script)!!
hpvm-clang is installed to the python environment used when compiling HPVM.
Please try rerunning 'make -j hpvm-clang'.""")
sys.exit(1)
try:
subprocess.run([
"approxhpvm.py", src_file, target_binary,
"hpvm-clang", src_file, target_binary,
"-t", "tensor", "--conf-file", approx_conf_file
], check=True)
except:
......
add_llvm_tool_subdirectory(hpvm-config)
add_llvm_tool_subdirectory(py-approxhpvm)
\ No newline at end of file
add_llvm_tool_subdirectory(hpvm-clang)
\ No newline at end of file
......@@ -73,3 +73,6 @@ add_custom_target(
COMMAND python3 -m pip install ./
DEPENDS ${init_path} setup.py
)
# hpvm-clang is the name of the compiler binary (see setup.py)
# We provide this alias for convenience
add_custom_target(hpvm-clang DEPENDS hpvmpy)
......@@ -153,7 +153,7 @@ def _run_opt(
def parse_args():
parser = argparse.ArgumentParser("approxhpvm")
parser = argparse.ArgumentParser("hpvm-clang")
parser.add_argument("input_file", type=Path, help="HPVM-C code to compile")
parser.add_argument("output_file", type=Path, help="Path to generate binary to")
parser.add_argument(
......
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment