WIP: Build: Shared Libraries Not Included in Buildtime Platform Vars #115790

Closed
Jeroen Bakker wants to merge 3 commits from Jeroen-Bakker:platform/fix-sycl-bundled-libraries into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

When building on Linux Sycl shared libraries could not be found when
using the PLATORM_ENV_BUILD* variables. On Windows Sycl and
OIIO, Embree and cycles shared libraries where not available.

Cause: Sycl library uses a custom way of bundling its
libraries. This updated the PLATFORM_BUNDLED_LIBRARIES, but didn't
update PLATFORM_BUNDLED_LIBRARY_DIRS.

PLATFORM_BUNDLIED_LIBRARY_DIRS is used to populate
PLATFORM_ENV_BUILD_DIRS and PLATFORM_ENV_BUILD.

On Windows the search path is hard coded.

When building on Linux Sycl shared libraries could not be found when using the PLATORM_ENV_BUILD* variables. On Windows Sycl and OIIO, Embree and cycles shared libraries where not available. Cause: Sycl library uses a custom way of bundling its libraries. This updated the PLATFORM_BUNDLED_LIBRARIES, but didn't update PLATFORM_BUNDLED_LIBRARY_DIRS. PLATFORM_BUNDLIED_LIBRARY_DIRS is used to populate PLATFORM_ENV_BUILD_DIRS and PLATFORM_ENV_BUILD. On Windows the search path is hard coded.
Jeroen Bakker added this to the 4.1 milestone 2023-12-05 11:06:36 +01:00
Jeroen Bakker added the
Platform
Linux
label 2023-12-05 11:06:36 +01:00
Jeroen Bakker self-assigned this 2023-12-05 11:06:36 +01:00
Jeroen Bakker added 1 commit 2023-12-05 11:06:41 +01:00
When building on Linux the Sycl libraries could not be found when
using the PLATORM_ENV_BUILD* variables.

Cause: Sycl library under Linux uses a custom way of bundling its
libraries. This updated the PLATFORM_BUNDLED_LIBRARIES, but didn't
update PLATFORM_BUNDLED_LIBRARY_DIRS.

PLATFORM_BUNDLIED_LIBRARY_DIRS is used to populate
PLATFORM_ENV_BUILD_DIRS and PLATFORM_ENV_BUILD.
Jeroen Bakker requested review from Campbell Barton 2023-12-05 11:07:21 +01:00
Jeroen Bakker added this to the Platforms, Builds Tests & Devices project 2023-12-05 11:07:35 +01:00
Jeroen Bakker added 1 commit 2023-12-05 12:41:35 +01:00
Jeroen Bakker added 1 commit 2023-12-05 12:42:44 +01:00
Jeroen Bakker requested review from Ray molenkamp 2023-12-05 12:43:02 +01:00
Jeroen Bakker added the
Platform
Windows
label 2023-12-05 12:43:10 +01:00
Jeroen Bakker changed title from Build: Sycl Not Included in Buildtime Platform Vars to WIP: Build: Shared Libraries Not Included in Buildtime Platform Vars 2023-12-05 12:46:35 +01:00
Jeroen Bakker reviewed 2023-12-05 12:51:30 +01:00
@ -1195,6 +1195,7 @@ if(WITH_CYCLES AND (WITH_CYCLES_DEVICE_ONEAPI OR (WITH_CYCLES_EMBREE AND EMBREE_
unset(_sycl_pi_runtime_libraries_glob)
list(APPEND PLATFORM_BUNDLED_LIBRARIES ${_sycl_runtime_libraries})
list(APPEND PLATFORM_BUNDLED_LIBRARY_DIRS ${SYCL_ROOT_DIR/bin/})
Author
Member

Windows uses a different approach need to adjust it in PLATFORM_ENV_BUILD_DIRS directly.

Windows uses a different approach need to adjust it in PLATFORM_ENV_BUILD_DIRS directly.
Member

while i do not mind the changes i do like to understand better what lead to this fix, the only code that uses sycl afaik is loaded on demand and not exercised during any tests. what problem did you run into and how?

while i do not mind the changes i do like to understand better what lead to this fix, the only code that uses sycl afaik is loaded on demand and not exercised during any tests. what problem did you run into and how?

While this seems OK, there should be code-comments (similar to the ones in the PR) explaining why these paths need to be added.

While this seems OK, there should be code-comments (similar to the ones in the PR) explaining why these paths need to be added.
Author
Member

Yes it is related to building shading builder in current form. (related to #115751, bigger picture #115748)

I used make release only enabling WITH_GPU_BUILDTIME_SHADER_BUILDER=On on both platforms. Goal is to get shader builder in its current form to execute correctly and reducing the stubs file. Shader builder doesn't actually require many dependencies, the way how the libraries are setup in Blender with many cyclic dependencies between them it. Shader builder requires blender::Vector, blender::Map
from BLI, being able to create a headless context from GHOST, so GHOST_System and GHOST_Context related classes

When we ditch OpenGL, we can remove the dependency with GHOST as Metal and Vulkan can rely on tools like shaderc/glslc and its MSL counterpart. Experiments executed during #113938 shows the glslc cannot compile OpenGL glsl files due to dialect differences (mostly binding related)

When checking the dependecies with cmake . --graphviz, I detected that bf_python has a direct connection with cycles, which would then try to find the Sycl dependecy at link time. When starting shader builder on windows it only starts when all the associated dll's can be found.
When running shader_builder.exe test.hh popup will appear for all the missing libs, perhaps there is a way that this can be suppressed.

In order to use shader_builder at this moment on Linux, the proposed change in this patch is needed. For windows there is also another change needed as somehow the shader_builder includes GHOST_Types.h which requires vulkan includes. Even when provided it cannot find it. Even when VS Studio shows that the include path is set correct. This can also be fixed by replacing the vulkan structs require for swapchains to our own types.

Yes it is related to building shading builder in current form. (related to #115751, bigger picture #115748) I used `make release` only enabling `WITH_GPU_BUILDTIME_SHADER_BUILDER=On` on both platforms. Goal is to get shader builder in its current form to execute correctly and reducing the stubs file. Shader builder doesn't actually require many dependencies, the way how the libraries are setup in Blender with many cyclic dependencies between them it. Shader builder requires `blender::Vector`, `blender::Map` from BLI, being able to create a headless context from `GHOST`, so `GHOST_System` and `GHOST_Context` related classes When we ditch OpenGL, we can remove the dependency with GHOST as Metal and Vulkan can rely on tools like shaderc/glslc and its MSL counterpart. Experiments executed during #113938 shows the glslc cannot compile OpenGL glsl files due to dialect differences (mostly binding related) When checking the dependecies with `cmake . --graphviz`, I detected that `bf_python` has a direct connection with cycles, which would then try to find the Sycl dependecy at link time. When starting shader builder on windows it only starts when all the associated dll's can be found. When running `shader_builder.exe test.hh` popup will appear for all the missing libs, perhaps there is a way that this can be suppressed. In order to use shader_builder at this moment on Linux, the proposed change in this patch is needed. For windows there is also another change needed as somehow the shader_builder includes GHOST_Types.h which requires vulkan includes. Even when provided it cannot find it. Even when VS Studio shows that the include path is set correct. This can also be fixed by replacing the vulkan structs require for swapchains to our own types.
Member

I build main with default settings on windows, with the only exceptions being WITH_GPU_BUILDTIME_SHADER_BUILDER=ON since that's the app you are having issues with, and WITH_VULKAN_BACKEND=OFF since shaderbuilder has a null deref in its vulkan codepath in main.

i build against svn libs r63582 and it ran just fine? not seeing any sycl related issues?

k:\BlenderGit\2019_ninja_tests>ninja --verbose K:/BlenderGit/2019_ninja_tests/source/blender/gpu/shader_baked.hh
[1/1] cmd.exe /C "cd /D K:\BlenderGit\2019_ninja_tests\source\blender\gpu && "C:\Program Files\CMake\bin\cmake.exe" -E env PATH=K:/BlenderGit/blender/../lib/win64_vc15/epoxy/bin;K:/BlenderGit/blender/../lib/win64_vc15/tbb/bin;K:/BlenderGit/blender/../lib/win64_vc15/OpenImageIO/bin;K:/BlenderGit/blender/../lib/win64_vc15/boost/lib;K:/BlenderGit/blender/../lib/win64_vc15/openexr/bin;K:/BlenderGit/blender/../lib/win64_vc15/imath/bin;K:/BlenderGit/blender/../lib/win64_vc15/shaderc/bin; K:/BlenderGit/2019_ninja_tests/bin/shader_builder.exe K:/BlenderGit/2019_ninja_tests/source/blender/gpu/shader_baked.hh"
Shader Test compilation result: 769 / 769 passed (skipped 10 for compatibility reasons)
OpenGL backend shader compilation succeeded.

some peculiar behaviour however: it clearly ran without issues, but it didn't actually generate that K:/BlenderGit/2019_ninja_tests/source/blender/gpu/shader_baked.hh file even though we told cmake that we would.

I build main with default settings on windows, with the only exceptions being `WITH_GPU_BUILDTIME_SHADER_BUILDER=ON` since that's the app you are having issues with, and `WITH_VULKAN_BACKEND=OFF` since shaderbuilder has a null deref in its vulkan codepath in main. i build against svn libs r63582 and it ran just fine? not seeing any sycl related issues? ``` k:\BlenderGit\2019_ninja_tests>ninja --verbose K:/BlenderGit/2019_ninja_tests/source/blender/gpu/shader_baked.hh [1/1] cmd.exe /C "cd /D K:\BlenderGit\2019_ninja_tests\source\blender\gpu && "C:\Program Files\CMake\bin\cmake.exe" -E env PATH=K:/BlenderGit/blender/../lib/win64_vc15/epoxy/bin;K:/BlenderGit/blender/../lib/win64_vc15/tbb/bin;K:/BlenderGit/blender/../lib/win64_vc15/OpenImageIO/bin;K:/BlenderGit/blender/../lib/win64_vc15/boost/lib;K:/BlenderGit/blender/../lib/win64_vc15/openexr/bin;K:/BlenderGit/blender/../lib/win64_vc15/imath/bin;K:/BlenderGit/blender/../lib/win64_vc15/shaderc/bin; K:/BlenderGit/2019_ninja_tests/bin/shader_builder.exe K:/BlenderGit/2019_ninja_tests/source/blender/gpu/shader_baked.hh" Shader Test compilation result: 769 / 769 passed (skipped 10 for compatibility reasons) OpenGL backend shader compilation succeeded. ``` some peculiar behaviour however: it clearly ran without issues, but it didn't actually generate that `K:/BlenderGit/2019_ninja_tests/source/blender/gpu/shader_baked.hh` file even though we told cmake that we would.
Author
Member

Closing this pull request as the error was in a local branch where I removed all stubs. Windows require those stubs and somehow doesn't need these DLLs to be loaded.

Closing this pull request as the error was in a local branch where I removed all stubs. Windows require those stubs and somehow doesn't need these DLLs to be loaded.
Jeroen Bakker closed this pull request 2023-12-08 16:19:25 +01:00

Pull request closed

Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#115790
No description provided.