Skip to content

Commit

Permalink
[ADRENO][WINDOWS] Windows build dependencies for Adreno target
Browse files Browse the repository at this point in the history
This brings in basic support for Adreno target on Windows platforms
and the tools we generally use for Adreno
  • Loading branch information
srkreddy1238 committed Jan 26, 2025
1 parent d9b2087 commit 29e9480
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@
[submodule "3rdparty/flashinfer"]
path = 3rdparty/flashinfer
url = https://github.com/flashinfer-ai/flashinfer.git
[submodule "3rdparty/zlib"]
path = 3rdparty/zlib
url = https://github.com/madler/zlib.git
1 change: 1 addition & 0 deletions 3rdparty/zlib
Submodule zlib added at ef24c4
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ The Unlicense
-------------

3rdparty/rang
3rdparty/zlib

BSD 3-Clause "New" or "Revised" License
---------------------------------------
Expand Down
17 changes: 13 additions & 4 deletions apps/cpp_rtvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ set(TVM_RUNNER_SOURCES
set(RTVM_LINKER_LIBS "")

if(WIN32)
list(APPEND RTVM_SOURCES ../cpp_rpc/win32_process.cc)
list(APPEND TVM_RUNNER_SOURCES ../cpp_rpc/win32_process.cc)
file(GLOB ZLIB_SRC
"../../3rdparty/zlib/*.c"
)
list(APPEND RTVM_SOURCES ${ZLIB_SRC})
list(APPEND TVM_RUNNER_SOURCES ${ZLIB_SRC})
endif()

# Set output to same directory as the other TVM libs
Expand Down Expand Up @@ -55,6 +58,7 @@ target_include_directories(
rtvm
PUBLIC "../../include"
PUBLIC "../../3rdparty/cnpy"
PUBLIC "../../3rdparty/zlib"
PUBLIC DLPACK_PATH
PUBLIC DMLC_PATH
)
Expand All @@ -72,9 +76,13 @@ if (BUILD_FOR_ANDROID AND USE_HEXAGON)
endif()

if(BUILD_STATIC_RUNTIME)
list(APPEND RTVM_LINKER_LIBS -Wl,--whole-archive tvm_runtime -Wl,--no-whole-archive z)
list(APPEND RTVM_LINKER_LIBS -Wl,--whole-archive tvm_runtime -Wl,--no-whole-archive)
else()
list(APPEND RTVM_LINKER_LIBS tvm_runtime z)
list(APPEND RTVM_LINKER_LIBS tvm_runtime)
endif()

if(NOT WIN32)
list(APPEND RTVM_LINKER_LIBS z)
endif()

target_link_libraries(rtvm ${RTVM_LINKER_LIBS})
Expand All @@ -84,6 +92,7 @@ target_include_directories(
tvm_runner_objs
PUBLIC "../../include"
PUBLIC "../../3rdparty/cnpy"
PUBLIC "../../3rdparty/zlib"
PUBLIC DLPACK_PATH
PUBLIC DMLC_PATH
)
Expand Down
4 changes: 0 additions & 4 deletions apps/cpp_rtvm/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@
#include "../../src/support/utils.h"
#include "tvm_runner.h"

#if defined(_WIN32)
#include "../cpp_rpc/win32_process.h"
#endif

using namespace std;
using namespace tvm::runtime;
using namespace tvm::support;
Expand Down
3 changes: 2 additions & 1 deletion apps/cpp_rtvm/tvm_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ void TVMRunner::UsePreCompiledPrograms(std::string file_name) {
if (f_get != nullptr && f_set != nullptr) {
std::ifstream ifs(file_name, std::ios::in | std::ios::binary);
if (ifs.fail()) {
auto bytes = String(f_get());
std::string ss = f_get();
auto bytes = tvm::String(ss);
std::ofstream fs(file_name, std::ofstream::binary);
fs.write(bytes.c_str(), bytes.size());
} else {
Expand Down
22 changes: 22 additions & 0 deletions licenses/LICENSE.zlib.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright notice:

(C) 1995-2024 Jean-loup Gailly and Mark Adler

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

Jean-loup Gailly Mark Adler
[email protected] [email protected]
6 changes: 6 additions & 0 deletions python/tvm/driver/tvmc/config_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ def get_configs_json_dir() -> str:
candidate_paths.extend(
[os.path.abspath(os.path.join(lib_path, "..")) for lib_path in libinfo.find_lib_path()]
)
candidate_paths.extend(
[
os.path.abspath(os.path.join(lib_path, "../.."))
for lib_path in libinfo.find_lib_path()
]
)
for path in candidate_paths:
configs_path = os.path.join(os.path.dirname(path), "configs")
if os.path.isdir(configs_path):
Expand Down

0 comments on commit 29e9480

Please sign in to comment.