From 0e78608e62e2558bd4301ff1ff8790f684ca7fd1 Mon Sep 17 00:00:00 2001 From: mzegla Date: Wed, 26 Mar 2025 10:57:56 +0100 Subject: [PATCH 1/9] change genai commit --- third_party/llm_engine/llm_engine.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/third_party/llm_engine/llm_engine.bzl b/third_party/llm_engine/llm_engine.bzl index dfb82fef2a..fd9ad2bca9 100644 --- a/third_party/llm_engine/llm_engine.bzl +++ b/third_party/llm_engine/llm_engine.bzl @@ -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 = "a3179588f3fc6ae4037f606bc0d7786c66947752", # 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, From 5074601079e6ab73a1023446597d5082e64853a0 Mon Sep 17 00:00:00 2001 From: mzegla Date: Wed, 26 Mar 2025 14:39:58 +0100 Subject: [PATCH 2/9] try build genai from source for windows --- common_settings.bzl | 2 +- windows_install_build_dependencies.bat | 59 +++++++++++++++----------- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/common_settings.bzl b/common_settings.bzl index 07ecb81708..f2f286c18b 100644 --- a/common_settings.bzl +++ b/common_settings.bzl @@ -37,7 +37,7 @@ def create_config_settings(): native.config_setting( name = "genai_bin", define_values = { - "GENAI_USE_BINARY": "1", + "GENAI_USE_BINARY": "0", }, visibility = ["//visibility:public"], ) diff --git a/windows_install_build_dependencies.bat b/windows_install_build_dependencies.bat index c7d593d1d5..b3b019a146 100644 --- a/windows_install_build_dependencies.bat +++ b/windows_install_build_dependencies.bat @@ -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 From db1c732ec01be899ea22a031144e3d8e5309a287 Mon Sep 17 00:00:00 2001 From: mzegla Date: Wed, 26 Mar 2025 14:56:28 +0100 Subject: [PATCH 3/9] commit with prefix caching fix --- third_party/llm_engine/llm_engine.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/llm_engine/llm_engine.bzl b/third_party/llm_engine/llm_engine.bzl index fd9ad2bca9..bf135b0f48 100644 --- a/third_party/llm_engine/llm_engine.bzl +++ b/third_party/llm_engine/llm_engine.bzl @@ -24,7 +24,7 @@ def llm_engine(): new_git_repository( name = "llm_engine", remote = "https://github.com/mzegla/openvino.genai", - commit = "a3179588f3fc6ae4037f606bc0d7786c66947752", # based on releases/2025/1, commit with VLM fixes for serving, 2025-03-26 + 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, From 6885c3d6ae4a3ab9fcca28f7b35cebf986798f0b Mon Sep 17 00:00:00 2001 From: mzegla Date: Wed, 26 Mar 2025 15:38:08 +0100 Subject: [PATCH 4/9] change jobs configuration for cmake build --- third_party/llm_engine/llm_engine.bzl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/third_party/llm_engine/llm_engine.bzl b/third_party/llm_engine/llm_engine.bzl index bf135b0f48..a1b678b1c4 100644 --- a/third_party/llm_engine/llm_engine.bzl +++ b/third_party/llm_engine/llm_engine.bzl @@ -66,6 +66,7 @@ def _impl(repository_ctx): "WIN32": "True", "X86_64": "True" """ + jobs_param = "\"-j\"" # 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 = "" @@ -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 = """ @@ -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} @@ -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, From abf6615af1a1358856306766691f9dd8a3c7c5f1 Mon Sep 17 00:00:00 2001 From: mzegla Date: Wed, 26 Mar 2025 16:50:00 +0100 Subject: [PATCH 5/9] infinite jobs for windows build --- third_party/llm_engine/llm_engine.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/llm_engine/llm_engine.bzl b/third_party/llm_engine/llm_engine.bzl index a1b678b1c4..7711a5f77f 100644 --- a/third_party/llm_engine/llm_engine.bzl +++ b/third_party/llm_engine/llm_engine.bzl @@ -66,7 +66,7 @@ def _impl(repository_ctx): "WIN32": "True", "X86_64": "True" """ - jobs_param = "\"-j\"" # on Windows we do not need to specify number of jobs, it's set to all available cores number + jobs_param = "\"-j 0\"" # 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 = "" From a101a06759ad947e2ed6bcf72b1a8e92e704772c Mon Sep 17 00:00:00 2001 From: Dariusz Trawinski Date: Wed, 26 Mar 2025 21:20:03 +0100 Subject: [PATCH 6/9] temorary change label --- ci/build_test_OnCommit.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/build_test_OnCommit.groovy b/ci/build_test_OnCommit.groovy index 94ccd26174..04ced5508f 100644 --- a/ci/build_test_OnCommit.groovy +++ b/ci/build_test_OnCommit.groovy @@ -87,7 +87,7 @@ pipeline { } stage('Build windows') { agent { - label 'win_ovms' + label 'win_build' } when { expression { win_image_build_needed == "true" } } steps { From bdbdd6d71d0c25a0fd3bc0ca43dc7c79f10a5a4e Mon Sep 17 00:00:00 2001 From: Rafal Sapala Date: Thu, 27 Mar 2025 09:50:16 +0100 Subject: [PATCH 7/9] Update build_test_OnCommit.groovy --- ci/build_test_OnCommit.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/build_test_OnCommit.groovy b/ci/build_test_OnCommit.groovy index 04ced5508f..94ccd26174 100644 --- a/ci/build_test_OnCommit.groovy +++ b/ci/build_test_OnCommit.groovy @@ -87,7 +87,7 @@ pipeline { } stage('Build windows') { agent { - label 'win_build' + label 'win_ovms' } when { expression { win_image_build_needed == "true" } } steps { From 535d8c943b8872e0501c158f47b9718f28732517 Mon Sep 17 00:00:00 2001 From: rasapala Date: Thu, 27 Mar 2025 10:44:51 +0100 Subject: [PATCH 8/9] Try fix --- .bazelrc | 4 ++-- common_settings.bzl | 2 +- third_party/llm_engine/llm_engine.bzl | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.bazelrc b/.bazelrc index 194508b9cf..96cf152223 100644 --- a/.bazelrc +++ b/.bazelrc @@ -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/ diff --git a/common_settings.bzl b/common_settings.bzl index f2f286c18b..07ecb81708 100644 --- a/common_settings.bzl +++ b/common_settings.bzl @@ -37,7 +37,7 @@ def create_config_settings(): native.config_setting( name = "genai_bin", define_values = { - "GENAI_USE_BINARY": "0", + "GENAI_USE_BINARY": "1", }, visibility = ["//visibility:public"], ) diff --git a/third_party/llm_engine/llm_engine.bzl b/third_party/llm_engine/llm_engine.bzl index 7711a5f77f..4e9ad8e7ca 100644 --- a/third_party/llm_engine/llm_engine.bzl +++ b/third_party/llm_engine/llm_engine.bzl @@ -66,7 +66,7 @@ def _impl(repository_ctx): "WIN32": "True", "X86_64": "True" """ - jobs_param = "\"-j 0\"" # on Windows we do not need to specify number of jobs, it's set to all available cores number + jobs_param = "\" \"" # 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 = "" From e60ca3bc8b296f1ffd87a0f72cec6867c0f82d27 Mon Sep 17 00:00:00 2001 From: Tobiszewski Date: Thu, 27 Mar 2025 11:22:16 +0100 Subject: [PATCH 9/9] Use concurrency --- third_party/llm_engine/llm_engine.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/llm_engine/llm_engine.bzl b/third_party/llm_engine/llm_engine.bzl index 4e9ad8e7ca..58882037b2 100644 --- a/third_party/llm_engine/llm_engine.bzl +++ b/third_party/llm_engine/llm_engine.bzl @@ -66,7 +66,7 @@ def _impl(repository_ctx): "WIN32": "True", "X86_64": "True" """ - jobs_param = "\" \"" # on Windows we do not need to specify number of jobs, it's set to all available cores number + 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 = ""