Skip to content

Check genai build from source #3167

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,11 @@ build:windows --action_env OpenCV_DIR="c:/opt/opencv"

build:windows --repo_env=HERMETIC_PYTHON_VERSION=3.11
build:windows --define=USE_DROGON=1
build:windows --define=GENAI_USE_BINARY=1
build:windows --define=GENAI_USE_BINARY=0

# Tests settings ############################################################################################################################
# sometimes failed logs exceed this threshold
test --experimental_ui_max_stdouterr_bytes=104857600
test --experimental_ui_max_stdouterr_bytes=304857600

# envs below are required to succesfully run binaries in bazel as bazel is very strict in sandboxing
test:linux --test_env LD_LIBRARY_PATH=/opt/opencv/lib/:/opt/intel/openvino/runtime/lib/intel64/:/opt/intel/openvino/runtime/3rdparty/tbb/lib/
Expand Down
11 changes: 7 additions & 4 deletions third_party/llm_engine/llm_engine.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def llm_engine():
llm_engine_repository(name="_llm_engine")
new_git_repository(
name = "llm_engine",
remote = "https://github.com/openvinotoolkit/openvino.genai",
commit = "3ce470c851aea7c0d9743bcd7d0d401954611a69", # releases/2025/1 2025-03-20
remote = "https://github.com/mzegla/openvino.genai",
commit = "da1497e2087c7e11af89faab854b412c7594ed63", # based on releases/2025/1, commit with VLM fixes for serving, 2025-03-26
build_file = "@_llm_engine//:BUILD",
init_submodules = True,
recursive_init_submodules = True,
Expand Down Expand Up @@ -66,6 +66,7 @@ def _impl(repository_ctx):
"WIN32": "True",
"X86_64": "True"
"""
jobs_param = "\" -j 8\"" # on Windows we do not need to specify number of jobs, it's set to all available cores number
else:
lib_name = "libopenvino_genai"
out_dll_dir_win = ""
Expand All @@ -79,6 +80,7 @@ def _impl(repository_ctx):
"CMAKE_ARCHIVE_OUTPUT_DIRECTORY": "lib",
"ENABLE_SYSTEM_ICU": "True",
"""
jobs_param = "\"-j 8\"" # on Linux we need to specify jobs number, by default it's set to 1

# Note we need to escape '{/}' by doubling them due to call to format
build_file_content = """
Expand Down Expand Up @@ -112,7 +114,7 @@ cmake(
"--", # <- Pass remaining options to the native tool.
# https://github.com/bazelbuild/rules_foreign_cc/issues/329
# there is no elegant parallel compilation support - lets go with default - CORES + 2 for ninja
"-j 8",
{jobs_param}
],
cache_entries = {{
{cache_entries}
Expand Down Expand Up @@ -154,7 +156,8 @@ cc_library(
)
"""
repository_ctx.file("BUILD", build_file_content.format(OpenVINO_DIR=OpenVINO_DIR, http_proxy=http_proxy, https_proxy=https_proxy,
out_dll_dir_win=out_dll_dir_win, out_lib_dir=out_lib_dir, lib_name=lib_name, out_libs=out_libs, cache_entries=cache_entries, out_static=out_static))
out_dll_dir_win=out_dll_dir_win, out_lib_dir=out_lib_dir, lib_name=lib_name, out_libs=out_libs, cache_entries=cache_entries, out_static=out_static,
jobs_param=jobs_param))

llm_engine_repository = repository_rule(
implementation = _impl,
Expand Down
59 changes: 35 additions & 24 deletions windows_install_build_dependencies.bat
Original file line number Diff line number Diff line change
Expand Up @@ -124,54 +124,65 @@ IF /I EXIST %bash_path% (

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::: GENAI/OPENVINO - reinstalled per build trigger
set "genai_dir=openvino_genai_windows_2025.1.0.0rc2_x86_64"
set "genai_ver=openvino_genai_windows_2025.1.0.0rc2_x86_64.zip"
set "genai_http=https://storage.openvinotoolkit.org/repositories/openvino_genai/packages/pre-release/2025.1.0.0rc2/"

set "genai_zip=%BAZEL_SHORT_PATH%\%genai_ver%"
set "genai_workspace=C:\\\\opt\\\\openvino\\\\runtime"
set "genai_new_workspace=C:\\%output_user_root%\\openvino\\runtime"
:: For now we build GenAI from source

echo [INFO] Installing GenAI: %genai_dir% ...
:: Download GenAi
IF /I EXIST %genai_zip% (
::set "genai_dir=openvino_genai_windows_2025.1.0.0rc2_x86_64"
::set "genai_ver=openvino_genai_windows_2025.1.0.0rc2_x86_64.zip"
::set "genai_http=https://storage.openvinotoolkit.org/repositories/openvino_genai/packages/pre-release/2025.1.0.0rc2/"

::set "genai_zip=%BAZEL_SHORT_PATH%\%genai_ver%"
::set "genai_workspace=C:\\\\opt\\\\openvino\\\\runtime"
::set "genai_new_workspace=C:\\%output_user_root%\\openvino\\runtime"

set "openvino_dir=openvino_toolkit_windows_2025.1.0.dev20250320_x86_64"
set "openvino_ver=openvino_toolkit_windows_2025.1.0.dev20250320_x86_64.zip"
set "openvino_http=https://storage.openvinotoolkit.org/repositories/openvino/packages/pre-release/2025.1.0rc2/"

set "openvino_zip=%BAZEL_SHORT_PATH%\%openvino_ver%"
set "openvino_workspace=C:\\\\opt\\\\openvino\\\\runtime"
set "openvino_new_workspace=C:\\%output_user_root%\\openvino\\runtime"

echo [INFO] Installing OpenVINO: %openvino_dir% ...
:: Download OpenVINO
IF /I EXIST %openvino_zip% (
if %expunge% EQU 1 (
del /S /Q %genai_zip%
del /S /Q %openvino_zip%
if !errorlevel! neq 0 exit /b !errorlevel!
%wget_path% -P %BAZEL_SHORT_PATH%\ %genai_http%%genai_ver%
%wget_path% -P %BAZEL_SHORT_PATH%\ %openvino_http%%openvino_ver%
if !errorlevel! neq 0 exit /b !errorlevel!
) else ( echo [INFO] file exists %genai_zip% )
) else ( echo [INFO] file exists %openvino_zip% )

) ELSE (
%wget_path% -P %BAZEL_SHORT_PATH%\ %genai_http%%genai_ver%
%wget_path% -P %BAZEL_SHORT_PATH%\ %openvino_http%%openvino_ver%
if !errorlevel! neq 0 exit /b !errorlevel!
)
:: Extract GenAi
IF /I EXIST %BAZEL_SHORT_PATH%\%genai_dir% (
:: Extract OpenVINO
IF /I EXIST %BAZEL_SHORT_PATH%\%openvino_dir% (
if %expunge% EQU 1 (
rmdir /S /Q %BAZEL_SHORT_PATH%\%genai_dir%
rmdir /S /Q %BAZEL_SHORT_PATH%\%openvino_dir%
if !errorlevel! neq 0 exit /b !errorlevel!
C:\Windows\System32\tar.exe -xf "%genai_zip%" -C %BAZEL_SHORT_PATH%
C:\Windows\System32\tar.exe -xf "%openvino_zip%" -C %BAZEL_SHORT_PATH%
if !errorlevel! neq 0 exit /b !errorlevel!
) else ( echo [INFO] directory exists %BAZEL_SHORT_PATH%\%genai_dir% )
) else ( echo [INFO] directory exists %BAZEL_SHORT_PATH%\%openvino_dir% )

) ELSE (
C:\Windows\System32\tar.exe -xf "%genai_zip%" -C %BAZEL_SHORT_PATH%
C:\Windows\System32\tar.exe -xf "%openvino_zip%" -C %BAZEL_SHORT_PATH%
if !errorlevel! neq 0 exit /b !errorlevel!
)
:: Create GenAi link - always to make sure it points to latest version
:: Create OpenVINO link - always to make sure it points to latest version
IF /I EXIST %BAZEL_SHORT_PATH%\openvino (
rmdir /S /Q %BAZEL_SHORT_PATH%\openvino
)
mklink /d %BAZEL_SHORT_PATH%\openvino %BAZEL_SHORT_PATH%\%genai_dir%
mklink /d %BAZEL_SHORT_PATH%\openvino %BAZEL_SHORT_PATH%\%openvino_dir%
if !errorlevel! neq 0 exit /b !errorlevel!

:: Replace path to GenAi in ovms WORKSPACE file
:: Replace path to OpenVINO in ovms WORKSPACE file
if "!output_user_root!" neq "opt" (
powershell -Command "(gc -Path WORKSPACE) -replace '%genai_workspace%', '%genai_new_workspace%' | Set-Content -Path WORKSPACE"
powershell -Command "(gc -Path WORKSPACE) -replace '%openvino_workspace%', '%openvino_new_workspace%' | Set-Content -Path WORKSPACE"
if !errorlevel! neq 0 exit /b !errorlevel!
)
echo [INFO] GenAi installed: %BAZEL_SHORT_PATH%\%genai_dir%
echo [INFO] OpenVINO installed: %BAZEL_SHORT_PATH%\%openvino_dir%

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::: OpenCL headers
Expand Down