-
Notifications
You must be signed in to change notification settings - Fork 0
Feature: Add initial SYCL backend support for gsplat #1
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
asrathore-ai
wants to merge
61
commits into
main
Choose a base branch
from
sycl_code_integration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
9089568
added sycl code
asrathore-ai dedfc2d
Resolve Windows compiler / linker errors.
ssheorey 6f44999
Fix Windows linker errors
ssheorey a9eaf99
Loading kernels now works in Windows.
ssheorey 2f28ba3
COrrected libtorch path issues
asrathore-ai 3fff3de
Updated correct shape calculation
asrathore-ai 10c0efd
Updated proj changes
asrathore-ai 7b3bfb8
corrected isect code
asrathore-ai 0d25c9e
Update fully fused projection kernels
asrathore-ai 02a596b
wip packed kernel
asrathore-ai fc801e8
added fully fused projection packed
asrathore-ai f773859
Update kernel
asrathore-ai 4dfea00
updated training code
asrathore-ai 6624ec0
update steps for memory error
asrathore-ai 6597d44
torch_acc uniform API for both cuda and xpu. Maybe replaced by torch.…
ssheorey 0a472cf
Added forward pass for 2fgs fully fused projection
asrathore-ai 417942e
added backward pass
asrathore-ai 6763ada
update tests
asrathore-ai f4d0123
Working tests
asrathore-ai 167d0b6
Added rasterize forward kernel
asrathore-ai a4f90ac
added backward kernel
asrathore-ai aa6ff08
Update rasterize_to_pixels_2dgs_bwd.cpp
asrathore-ai 6542d4c
Update RasterizeToPixels2DGSBwdKernel.hpp
asrathore-ai cb5c72a
Update RasterizeToPixels2DGSBwdKernel.hpp
asrathore-ai 4a5bde3
Update RasterizeToPixels2DGSFwdKernel.hpp
asrathore-ai 11604f5
Update rasterize_to_pixels_2dgs_fwd.cpp for correct block size comput…
asrathore-ai b5c46a9
Update rasterize_to_pixels_2dgs_bwd.cpp for correct block size comput…
asrathore-ai eb2174c
relocation kernel for MCMC strategy
ssheorey 390ffc2
Merge branch '2d_gaussian_splatting' of github.com:isl-org/gsplat int…
ssheorey 6524660
CI tests and docs should pass now.
ssheorey e261c04
Use pytorch 2.6 for CI (docs and core_tests)
ssheorey d03c5f3
black v22 and clang-format
ssheorey ed7352a
Fix test_rasterization for packed, fix has_xpu check from previous co…
ssheorey b5bc4f0
#pragma once to follow gsplat convention
ssheorey b785b20
Merge pull request #2 from isl-org/2d_gaussian_splatting
ssheorey 72fcd3a
Common _wrapper.py for cuda and sycl
ssheorey 570de47
Merge branch 'main' into sycl_code_integration
ssheorey cabd342
contiguous() tensors to fused_ssim
ssheorey 31c484e
Updated fused_ssim to latest including sycl bugfix.
ssheorey a70b2f5
empty xpu docs
ssheorey bc60098
Evaluation results on B580
ssheorey 4f022e4
Windows MSVC fixes
ssheorey a9f1536
Do not install fused-bilagrid
ssheorey b315442
Update instructions.
ssheorey fa4cdd9
Simplify build process.
ssheorey 3cb8262
Initial plan
Copilot 02d094c
Add SYCL/XPU wheel build and publish GitHub Actions workflows
Copilot 0305370
Address PR review comments on SYCL/XPU wheel workflows
Copilot a5c4e47
Add SYCL/XPU wheel build and publish GitHub Actions workflows
ssheorey 2406dfb
Initial plan
Copilot a0025c6
Fix XPU workflow: truncate oneAPI version X.Y.Z to X.Y for apt packag…
Copilot 1256a06
Windows wheel workflow
ssheorey 1baa172
Fix
ssheorey 3328824
Fix setup.py for source only wheel
ssheorey b3a8f5d
installer fix
ssheorey 02b390b
fix
ssheorey 54de18a
Separate Windows and Linux build steps.
ssheorey 1442ff5
fix build type for windows
ssheorey 21f1f85
Update docs
ssheorey 711958b
SYCL CI - wheels and PyPI repo hosting on github pages.
ssheorey 760d963
Add info about pre-built wheels.
ssheorey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule glm
updated
32 files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| cmake_minimum_required(VERSION 3.23...4.0) # Need min 3.23 on Windows | ||
|
|
||
| set(CMAKE_C_COMPILER icx) | ||
| set(CMAKE_CXX_COMPILER icx) | ||
|
|
||
| project(gsplat_sycl) | ||
|
|
||
| if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) | ||
| set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) | ||
| set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") | ||
| endif() | ||
|
|
||
| if (NOT SYCL_AOT_TARGETS) | ||
| set (SYCL_AOT_TARGETS "spir64" CACHE STRING "Comma separated list of SYCL targets for ahead of time compilation. See https://github.com/intel/llvm/blob/sycl/sycl/doc/UsersManual.md for a full list.") | ||
| endif() | ||
|
|
||
| find_package(Python 3.8 COMPONENTS Interpreter Development.Module REQUIRED) | ||
|
|
||
|
|
||
| execute_process( | ||
| COMMAND "${Python_EXECUTABLE}" -c "import torch.utils; print(torch.utils.cmake_prefix_path)" | ||
| OUTPUT_STRIP_TRAILING_WHITESPACE | ||
| OUTPUT_VARIABLE Torch_DIR_From_Python | ||
| RESULT_VARIABLE _torch_path_result | ||
| ERROR_QUIET | ||
| ) | ||
| if(NOT _torch_path_result EQUAL 0) | ||
| message(WARNING "Failed to get Torch CMake path from Python. " | ||
| "Make sure PyTorch is installed in the Python environment: ${Python_EXECUTABLE}") | ||
| set(Torch_DIR_From_Python "") | ||
| endif() | ||
|
|
||
| if(Torch_DIR_From_Python AND IS_DIRECTORY "${Torch_DIR_From_Python}") | ||
| set(Torch_DIR ${Torch_DIR_From_Python}) | ||
| message(STATUS "Found Torch CMake directory via Python: ${Torch_DIR}") | ||
| find_package(Torch REQUIRED HINTS ${Torch_DIR_From_Python}) | ||
| else() | ||
| message(FATAL_ERROR "Could not find Torch via Python introspection. " | ||
| "Please ensure PyTorch is installed or set CMAKE_PREFIX_PATH/Torch_DIR manually.") | ||
| endif() | ||
| execute_process( | ||
| COMMAND "${Python_EXECUTABLE}" -c "import os; from torch.utils import cpp_extension; print(os.path.join(cpp_extension.library_paths(True)[0], 'libtorch_python.so'))" | ||
| OUTPUT_STRIP_TRAILING_WHITESPACE | ||
| OUTPUT_VARIABLE TORCH_PYTHON_LIB | ||
| ) | ||
|
|
||
| if (NOT EXISTS "${TORCH_PYTHON_LIB}") | ||
| message(FATAL_ERROR "Could not find libtorch_python.so at ${TORCH_PYTHON_LIB}. Please check your PyTorch installation.") | ||
| else() | ||
| message(STATUS "Found torch_python library at: ${TORCH_PYTHON_LIB}") | ||
| endif() | ||
|
|
||
|
|
||
| set(PYBIND11_FINDPYTHON ON) | ||
| find_package(pybind11 CONFIG REQUIRED) | ||
|
|
||
| set( SYCL_SOURCES | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/ext.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/adam.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/intersect_offset.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/intersect_tile.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/null.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/projection_2dgs_fused_bwd.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/projection_2dgs_fused_fwd.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/projection_2dgs_packed_bwd.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/projection_2dgs_packed_fwd.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/projection_ewa_3dgs_fused_bwd.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/projection_ewa_3dgs_fused_fwd.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/projection_ewa_3dgs_packed_bwd.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/projection_ewa_3dgs_packed_fwd.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/projection_ewa_simple_bwd.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/projection_ewa_simple_fwd.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/projection_ut_3dgs_fused.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/quat_scale_to_covar_preci_bwd.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/quat_scale_to_covar_preci_fwd.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/rasterize_to_indices_2dgs.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/rasterize_to_indices_3dgs.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/rasterize_to_pixels_2dgs_bwd.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/rasterize_to_pixels_2dgs_fwd.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/rasterize_to_pixels_3dgs_bwd.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/rasterize_to_pixels_3dgs_fwd.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/rasterize_to_pixels_from_world_3dgs_bwd.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/rasterize_to_pixels_from_world_3dgs_fwd.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/relocation.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/spherical_harmonics_bwd.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/spherical_harmonics_fwd.cpp | ||
| ) | ||
|
|
||
| set(SYCL_MODULE_NAME gsplat_sycl_kernels) | ||
|
|
||
| pybind11_add_module(${SYCL_MODULE_NAME} MODULE ${SYCL_SOURCES}) | ||
|
|
||
| target_include_directories( ${SYCL_MODULE_NAME} SYSTEM PRIVATE | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/include | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/../cuda/csrc/third_party/glm | ||
| ) | ||
|
|
||
| target_compile_definitions(${SYCL_MODULE_NAME} PRIVATE | ||
| TORCH_EXTENSION_NAME=${SYCL_MODULE_NAME} | ||
| ) | ||
|
|
||
| target_compile_options(${SYCL_MODULE_NAME} PRIVATE -fsycl) | ||
| target_compile_features(${SYCL_MODULE_NAME} PUBLIC cxx_std_17) | ||
|
|
||
| target_link_options(${SYCL_MODULE_NAME} PRIVATE -fsycl -fsycl-targets=${SYCL_AOT_TARGETS}) | ||
| target_link_libraries(${SYCL_MODULE_NAME} PRIVATE torch) | ||
|
|
||
|
|
||
| # Fix for icx: error: '-MP' is not supported with offloading enabled | ||
| if (WIN32 AND NOT UNIX) | ||
| get_target_property(CURRENT_OPTIONS ${SYCL_MODULE_NAME} COMPILE_OPTIONS) | ||
| string(REPLACE "/MP" "" MODIFIED_OPTIONS "${CURRENT_OPTIONS}") | ||
| set_target_properties(${SYCL_MODULE_NAME} PROPERTIES COMPILE_OPTIONS "${MODIFIED_OPTIONS}") | ||
| endif () | ||
| if (UNIX AND NOT APPLE) | ||
| # Find libtorch_xpu and libsycl at runtime in Python environment | ||
| set_target_properties(${SYCL_MODULE_NAME} PROPERTIES INSTALL_RPATH | ||
| "$ORIGIN/../../torch/lib/;$ORIGIN/../../../../") | ||
| endif() |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| _C = None | ||
|
|
||
| try: | ||
| # Try to import the compiled module (via setup.py or pre-built .so) | ||
| from gsplat import gsplat_sycl_kernels as _C | ||
| except ImportError: | ||
| raise ImportError("Unable to find compiled sycl kernels package") |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the glm upgrade required? If yes, we need to explain why. If no, this should not be part of this PR.