diff --git a/hpvm/docs/install.rst b/hpvm/docs/install.rst index fa4a3f747b24501537903edc8f7b09da8928571b..9dd8365ae71277f70e72abe6f3c1f6725351eb1f 100644 --- a/hpvm/docs/install.rst +++ b/hpvm/docs/install.rst @@ -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 diff --git a/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt b/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt index f6fed2ac296f93bc060fe09b3b889b42ee8c4a1a..cbabc8bbe0111a0ec6c99520176a8b37a530a4fb 100644 --- a/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt +++ b/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt @@ -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}" diff --git a/hpvm/projects/torch2hpvm/torch2hpvm/compile.py b/hpvm/projects/torch2hpvm/torch2hpvm/compile.py index 922b6795ade457ba4c961af4d2e70ce150e22e92..172448a60d4f65fc4aafc09c9a76d9cb492ff7b0 100644 --- a/hpvm/projects/torch2hpvm/torch2hpvm/compile.py +++ b/hpvm/projects/torch2hpvm/torch2hpvm/compile.py @@ -172,7 +172,7 @@ class ModelExporter: from subprocess import run args = [ - "approxhpvm.py", + "hpvm-clang", str(self.codefile), str(output_binary), *self.compile_args, diff --git a/hpvm/scripts/hpvm_installer.py b/hpvm/scripts/hpvm_installer.py index 6e3418b74bbc7938c796567ca5664946329996d1..cce8b3f07928d9ab096df3166bd02f4e6f8e1f5d 100755 --- a/hpvm/scripts/hpvm_installer.py +++ b/hpvm/scripts/hpvm_installer.py @@ -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. """ ) diff --git a/hpvm/test/dnn_benchmarks/hpvm-c/CMakeLists.txt b/hpvm/test/dnn_benchmarks/hpvm-c/CMakeLists.txt index d429bca23cd56cafc70a84fe79a35fed38912bec..d9cdafa7bc8dcffffb9d6b8bf3fb8d5aa958175f 100644 --- a/hpvm/test/dnn_benchmarks/hpvm-c/CMakeLists.txt +++ b/hpvm/test/dnn_benchmarks/hpvm-c/CMakeLists.txt @@ -1,6 +1,3 @@ -# 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} ) diff --git a/hpvm/test/dnn_benchmarks/keras/Benchmark.py b/hpvm/test/dnn_benchmarks/keras/Benchmark.py index c225ff97661aef8f4fceb123b79190cb7c819dd7..f3d8e9e6b2268618dc835e3d27374a8f7d738a86 100644 --- a/hpvm/test/dnn_benchmarks/keras/Benchmark.py +++ b/hpvm/test/dnn_benchmarks/keras/Benchmark.py @@ -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: diff --git a/hpvm/tools/CMakeLists.txt b/hpvm/tools/CMakeLists.txt index 495348404f3594d8bca46b87acd8be2d08d2c8a4..4758dde6a3f1564739135225f6f8673b5d34843d 100644 --- a/hpvm/tools/CMakeLists.txt +++ b/hpvm/tools/CMakeLists.txt @@ -1,2 +1,2 @@ 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 diff --git a/hpvm/tools/py-approxhpvm/CMakeLists.txt b/hpvm/tools/hpvm-clang/CMakeLists.txt similarity index 95% rename from hpvm/tools/py-approxhpvm/CMakeLists.txt rename to hpvm/tools/hpvm-clang/CMakeLists.txt index e0640cdf9ff09335a0245eb09dfd3e37be594dda..53a98d0b2deed5ed0337cce46a75078abfd8c887 100644 --- a/hpvm/tools/py-approxhpvm/CMakeLists.txt +++ b/hpvm/tools/hpvm-clang/CMakeLists.txt @@ -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) diff --git a/hpvm/tools/py-approxhpvm/main.py.in b/hpvm/tools/hpvm-clang/main.py.in similarity index 99% rename from hpvm/tools/py-approxhpvm/main.py.in rename to hpvm/tools/hpvm-clang/main.py.in index 4062d047a40473776fe2ff5b331eb2a618681083..5fa256d26ba1312b20acbc86ed2c59befb52da2a 100644 --- a/hpvm/tools/py-approxhpvm/main.py.in +++ b/hpvm/tools/hpvm-clang/main.py.in @@ -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( diff --git a/hpvm/tools/py-approxhpvm/setup.py b/hpvm/tools/hpvm-clang/setup.py similarity index 100% rename from hpvm/tools/py-approxhpvm/setup.py rename to hpvm/tools/hpvm-clang/setup.py