Skip to content

Commit 9f8a2e9

Browse files
committed
feat: JIT mode for up to 5x faster rendering and 1.5x faster training
1 parent 55ce675 commit 9f8a2e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+6172
-2714
lines changed

.editorconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ insert_final_newline = true
66
indent_style = tab
77
indent_size = 4
88
trim_trailing_whitespace = true
9+
max_line_length = 140
910

1011
[*.md]
1112
trim_trailing_whitespace = false
1213

13-
[*.{clangd,yml}]
14+
[*.{clangd,nix,yml}]
1415
indent_style = space
1516
indent_size = 2

.github/workflows/main.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ jobs:
7272
run: ./dependencies/tiny-cuda-nn/dependencies/cuda-cmake-github-actions/scripts/actions/install_cuda_ubuntu.sh
7373
shell: bash
7474
- name: Install Vulkan SDK
75-
uses: humbletim/install-vulkan-sdk@c2aa128094d42ba02959a660f03e0a4e012192f9
75+
uses: humbletim/[email protected]
76+
with:
77+
version: 1.4.309.0
7678
- name: CMake
7779
run: cmake . -B ${{ env.build_dir }} ${{ matrix.cmake_flags }} -DCMAKE_BUILD_TYPE=${{ env.config }}
7880
- name: Build
@@ -85,13 +87,13 @@ jobs:
8587
strategy:
8688
matrix:
8789
include:
88-
- os: windows-2025
90+
- os: windows-2022
8991
visual_studio: "Visual Studio 17 2022"
9092
cuda: "12.9.1"
9193
arch: 120
9294
python: "3.12"
9395
recommended_gpus: "RTX-5000"
94-
- os: windows-2025
96+
- os: windows-2022
9597
visual_studio: "Visual Studio 17 2022"
9698
cuda: "12.6.3"
9799
arch: 89
@@ -144,7 +146,9 @@ jobs:
144146
shell: powershell
145147
run: .\dependencies\tiny-cuda-nn\dependencies\cuda-cmake-github-actions\scripts\actions\install_cuda_windows.ps1
146148
- name: Install Vulkan SDK
147-
uses: humbletim/install-vulkan-sdk@c2aa128094d42ba02959a660f03e0a4e012192f9
149+
uses: humbletim/[email protected]
150+
with:
151+
version: 1.4.309.0
148152
- name: CMake
149153
run: cmake . -B ${{ env.build_dir }} ${{ matrix.cmake_flags }} -G "${{ matrix.visual_studio }}" -A x64
150154
- name: Build
@@ -170,6 +174,7 @@ jobs:
170174
scripts/category2id.json
171175
scripts/colmap2nerf.py
172176
scripts/common.py
177+
scripts/constants.py
173178
scripts/convert_image.py
174179
scripts/download_colmap.bat
175180
scripts/download_ffmpeg.bat

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1+
/.cache
12
/.vscode
23
/.vs
4+
/.direnv
35
/build*
46
/external
57
/figures
68
/out
9+
/logs
710
/results
811
/tmp
912
/venv
1013
/video
14+
/rtc
15+
/outputs
1116
/instant-ngp
1217
/*.dll
1318
/*.so

CMakeLists.txt

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
cmake_minimum_required(VERSION 3.18)
1010

1111
project(instant-ngp
12-
VERSION 1.0
12+
VERSION 2.0
1313
DESCRIPTION "Instant Neural Graphics Primitives"
1414
LANGUAGES C CXX CUDA
1515
)
@@ -23,6 +23,7 @@ option(NGP_BUILD_EXECUTABLE "Build instant-ngp.exe?" ON)
2323
option(NGP_BUILD_WITH_GUI "Build with GUI support (requires GLFW and GLEW)?" ON)
2424
option(NGP_BUILD_WITH_OPTIX "Build with OptiX to enable hardware ray tracing?" ON)
2525
option(NGP_BUILD_WITH_PYTHON_BINDINGS "Build bindings that allow instrumenting instant-ngp with Python?" ON)
26+
option(NGP_BUILD_WITH_RTC "Build support for runtime compilation of fully fused kernels?" ON)
2627
option(NGP_BUILD_WITH_VULKAN "Build with Vulkan to enable DLSS support?" ON)
2728

2829
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
@@ -50,6 +51,11 @@ if (APPLE)
5051
set(CMAKE_MACOSX_RPATH ON)
5152
endif()
5253

54+
if (CMAKE_EXPORT_COMPILE_COMMANDS)
55+
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})
56+
set(CMAKE_CUDA_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES})
57+
endif()
58+
5359
if (MSVC)
5460
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_CRT_SECURE_NO_WARNINGS")
5561
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP24")
@@ -87,6 +93,7 @@ list(APPEND CUDA_NVCC_FLAGS "--use_fast_math")
8793

8894
set(TCNN_BUILD_BENCHMARK OFF)
8995
set(TCNN_BUILD_EXAMPLES OFF)
96+
set(TCNN_BUILD_WITH_RTC ${NGP_BUILD_WITH_RTC})
9097
set(TCNN_ALLOW_CUBLAS_CUSOLVER OFF)
9198
add_subdirectory(dependencies/tiny-cuda-nn)
9299

@@ -193,6 +200,7 @@ if (NGP_BUILD_WITH_GUI)
193200
dependencies/imgui/imgui_draw.cpp
194201
dependencies/imgui/imgui_tables.cpp
195202
dependencies/imgui/imgui_widgets.cpp
203+
dependencies/imgui/misc/cpp/imgui_stdlib.cpp
196204
)
197205

198206
list(APPEND NGP_DEFINITIONS -DNGP_GUI)
@@ -319,13 +327,23 @@ if (NGP_OPTIX)
319327
"-DOUTPUT=${OPTIX_PTX_HEADER}"
320328
-P ${PROJECT_SOURCE_DIR}/cmake/bin2c_wrapper.cmake
321329
VERBATIM
322-
DEPENDS optix_program
330+
DEPENDS $<TARGET_OBJECTS:optix_program>
323331
COMMENT "Converting PTX files to a C header"
324332
)
325333

326334
list(APPEND NGP_SOURCES ${OPTIX_PTX_HEADER})
327335
endif()
328336

337+
cmrc_add_resource_library(ngp-resources NAMESPACE ngp)
338+
list(APPEND NGP_LIBRARIES ngp-resources)
339+
if (NGP_BUILD_WITH_RTC)
340+
# Create local directory that can serve as cache for the runtime compiled artifacts
341+
file(MAKE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/rtc/cache")
342+
343+
file(GLOB_RECURSE NGP_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/neural-graphics-primitives/*")
344+
cmrc_add_resources(ngp-resources WHENCE "${CMAKE_CURRENT_SOURCE_DIR}/include" ${NGP_HEADERS})
345+
endif()
346+
329347
add_library(ngp STATIC ${NGP_SOURCES})
330348
set_target_properties(ngp PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON CUDA_SEPARABLE_COMPILATION ON)
331349
target_compile_definitions(ngp PUBLIC ${NGP_DEFINITIONS})
@@ -347,7 +365,7 @@ if (NGP_VULKAN)
347365
endif()
348366

349367
if (MSVC)
350-
file(GLOB CUDA_DLLS "${CUDA_COMPILER_BIN}/cudart64*.dll")
368+
file(GLOB CUDA_DLLS "${CUDA_COMPILER_BIN}/cudart64*.dll" "${CUDA_COMPILER_BIN}/nvrtc*.dll")
351369
if (CUDA_DLLS)
352370
add_custom_command(TARGET ngp POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CUDA_DLLS} "${CMAKE_CURRENT_BINARY_DIR}" COMMAND_EXPAND_LISTS)
353371
endif()
@@ -361,7 +379,7 @@ if (NGP_BUILD_EXECUTABLE)
361379
set(NGP_BINARY_FILE "\"${CMAKE_CURRENT_SOURCE_DIR}/$<TARGET_FILE_NAME:instant-ngp>\"")
362380
if (MSVC)
363381
add_custom_command(TARGET instant-ngp POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:instant-ngp> ${CMAKE_CURRENT_SOURCE_DIR})
364-
file(GLOB NGP_REQUIRED_DLLS "${CUDA_COMPILER_BIN}/cudart64*.dll")
382+
file(GLOB NGP_REQUIRED_DLLS "${CUDA_COMPILER_BIN}/cudart64*.dll" "${CUDA_COMPILER_BIN}/nvrtc*.dll")
365383
if (NGP_VULKAN)
366384
list(APPEND NGP_REQUIRED_DLLS "${NGX_SHARED_LIB}")
367385
endif()

LICENSE.txt

Lines changed: 97 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,97 @@
1-
Copyright (c) 2022-2023, NVIDIA Corporation & affiliates. All rights reserved.
2-
3-
4-
NVIDIA Source Code License for instant neural graphics primitives
5-
6-
7-
=======================================================================
8-
9-
1. Definitions
10-
11-
"Licensor" means any person or entity that distributes its Work.
12-
13-
"Software" means the original work of authorship made available under
14-
this License.
15-
16-
"Work" means the Software and any additions to or derivative works of
17-
the Software that are made available under this License.
18-
19-
The terms "reproduce," "reproduction," "derivative works," and
20-
"distribution" have the meaning as provided under U.S. copyright law;
21-
provided, however, that for the purposes of this License, derivative
22-
works shall not include works that remain separable from, or merely
23-
link (or bind by name) to the interfaces of, the Work.
24-
25-
Works, including the Software, are "made available" under this License
26-
by including in or with the Work either (a) a copyright notice
27-
referencing the applicability of this License to the Work, or (b) a
28-
copy of this License.
29-
30-
2. License Grants
31-
32-
2.1 Copyright Grant. Subject to the terms and conditions of this
33-
License, each Licensor grants to you a perpetual, worldwide,
34-
non-exclusive, royalty-free, copyright license to reproduce,
35-
prepare derivative works of, publicly display, publicly perform,
36-
sublicense and distribute its Work and any resulting derivative
37-
works in any form.
38-
39-
3. Limitations
40-
41-
3.1 Redistribution. You may reproduce or distribute the Work only
42-
if (a) you do so under this License, (b) you include a complete
43-
copy of this License with your distribution, and (c) you retain
44-
without modification any copyright, patent, trademark, or
45-
attribution notices that are present in the Work.
46-
47-
3.2 Derivative Works. You may specify that additional or different
48-
terms apply to the use, reproduction, and distribution of your
49-
derivative works of the Work ("Your Terms") only if (a) Your Terms
50-
provide that the use limitation in Section 3.3 applies to your
51-
derivative works, and (b) you identify the specific derivative
52-
works that are subject to Your Terms. Notwithstanding Your Terms,
53-
this License (including the redistribution requirements in Section
54-
3.1) will continue to apply to the Work itself.
55-
56-
3.3 Use Limitation. The Work and any derivative works thereof only
57-
may be used or intended for use non-commercially. Notwithstanding
58-
the foregoing, NVIDIA and its affiliates may use the Work and any
59-
derivative works commercially. As used herein, "non-commercially"
60-
means for research or evaluation purposes only.
61-
62-
3.4 Patent Claims. If you bring or threaten to bring a patent claim
63-
against any Licensor (including any claim, cross-claim or
64-
counterclaim in a lawsuit) to enforce any patents that you allege
65-
are infringed by any Work, then your rights under this License from
66-
such Licensor (including the grant in Section 2.1) will terminate
67-
immediately.
68-
69-
3.5 Trademarks. This License does not grant any rights to use any
70-
Licensors or its affiliates names, logos, or trademarks, except
71-
as necessary to reproduce the notices described in this License.
72-
73-
3.6 Termination. If you violate any term of this License, then your
74-
rights under this License (including the grant in Section 2.1) will
75-
terminate immediately.
76-
77-
4. Disclaimer of Warranty.
78-
79-
THE WORK IS PROVIDED "AS IS" WITHOUT WARRANTIES OR CONDITIONS OF ANY
80-
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OR CONDITIONS OF
81-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR
82-
NON-INFRINGEMENT. YOU BEAR THE RISK OF UNDERTAKING ANY ACTIVITIES UNDER
83-
THIS LICENSE.
84-
85-
5. Limitation of Liability.
86-
87-
EXCEPT AS PROHIBITED BY APPLICABLE LAW, IN NO EVENT AND UNDER NO LEGAL
88-
THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE
89-
SHALL ANY LICENSOR BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT,
90-
INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
91-
OR RELATED TO THIS LICENSE, THE USE OR INABILITY TO USE THE WORK
92-
(INCLUDING BUT NOT LIMITED TO LOSS OF GOODWILL, BUSINESS INTERRUPTION,
93-
LOST PROFITS OR DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY OTHER
94-
COMMERCIAL DAMAGES OR LOSSES), EVEN IF THE LICENSOR HAS BEEN ADVISED OF
95-
THE POSSIBILITY OF SUCH DAMAGES.
96-
97-
=======================================================================
1+
Copyright (c) 2022-2025, NVIDIA Corporation & affiliates. All rights reserved.
2+
3+
4+
NVIDIA Source Code License for instant neural graphics primitives
5+
6+
7+
=======================================================================
8+
9+
1. Definitions
10+
11+
"Licensor" means any person or entity that distributes its Work.
12+
13+
"Software" means the original work of authorship made available under
14+
this License.
15+
16+
"Work" means the Software and any additions to or derivative works of
17+
the Software that are made available under this License.
18+
19+
The terms "reproduce," "reproduction," "derivative works," and
20+
"distribution" have the meaning as provided under U.S. copyright law;
21+
provided, however, that for the purposes of this License, derivative
22+
works shall not include works that remain separable from, or merely
23+
link (or bind by name) to the interfaces of, the Work.
24+
25+
Works, including the Software, are "made available" under this License
26+
by including in or with the Work either (a) a copyright notice
27+
referencing the applicability of this License to the Work, or (b) a
28+
copy of this License.
29+
30+
2. License Grants
31+
32+
2.1 Copyright Grant. Subject to the terms and conditions of this
33+
License, each Licensor grants to you a perpetual, worldwide,
34+
non-exclusive, royalty-free, copyright license to reproduce,
35+
prepare derivative works of, publicly display, publicly perform,
36+
sublicense and distribute its Work and any resulting derivative
37+
works in any form.
38+
39+
3. Limitations
40+
41+
3.1 Redistribution. You may reproduce or distribute the Work only
42+
if (a) you do so under this License, (b) you include a complete
43+
copy of this License with your distribution, and (c) you retain
44+
without modification any copyright, patent, trademark, or
45+
attribution notices that are present in the Work.
46+
47+
3.2 Derivative Works. You may specify that additional or different
48+
terms apply to the use, reproduction, and distribution of your
49+
derivative works of the Work ("Your Terms") only if (a) Your Terms
50+
provide that the use limitation in Section 3.3 applies to your
51+
derivative works, and (b) you identify the specific derivative
52+
works that are subject to Your Terms. Notwithstanding Your Terms,
53+
this License (including the redistribution requirements in Section
54+
3.1) will continue to apply to the Work itself.
55+
56+
3.3 Use Limitation. The Work and any derivative works thereof only
57+
may be used or intended for use non-commercially. Notwithstanding
58+
the foregoing, NVIDIA and its affiliates may use the Work and any
59+
derivative works commercially. As used herein, "non-commercially"
60+
means for research or evaluation purposes only.
61+
62+
3.4 Patent Claims. If you bring or threaten to bring a patent claim
63+
against any Licensor (including any claim, cross-claim or
64+
counterclaim in a lawsuit) to enforce any patents that you allege
65+
are infringed by any Work, then your rights under this License from
66+
such Licensor (including the grant in Section 2.1) will terminate
67+
immediately.
68+
69+
3.5 Trademarks. This License does not grant any rights to use any
70+
Licensors or its affiliates names, logos, or trademarks, except
71+
as necessary to reproduce the notices described in this License.
72+
73+
3.6 Termination. If you violate any term of this License, then your
74+
rights under this License (including the grant in Section 2.1) will
75+
terminate immediately.
76+
77+
4. Disclaimer of Warranty.
78+
79+
THE WORK IS PROVIDED "AS IS" WITHOUT WARRANTIES OR CONDITIONS OF ANY
80+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OR CONDITIONS OF
81+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR
82+
NON-INFRINGEMENT. YOU BEAR THE RISK OF UNDERTAKING ANY ACTIVITIES UNDER
83+
THIS LICENSE.
84+
85+
5. Limitation of Liability.
86+
87+
EXCEPT AS PROHIBITED BY APPLICABLE LAW, IN NO EVENT AND UNDER NO LEGAL
88+
THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE
89+
SHALL ANY LICENSOR BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT,
90+
INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
91+
OR RELATED TO THIS LICENSE, THE USE OR INABILITY TO USE THE WORK
92+
(INCLUDING BUT NOT LIMITED TO LOSS OF GOODWILL, BUSINESS INTERRUPTION,
93+
LOST PROFITS OR DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY OTHER
94+
COMMERCIAL DAMAGES OR LOSSES), EVEN IF THE LICENSOR HAS BEEN ADVISED OF
95+
THE POSSIBILITY OF SUCH DAMAGES.
96+
97+
=======================================================================

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ For business inquiries, please submit the [NVIDIA research licensing form](https
1919

2020
If you have Windows, download one of the following releases corresponding to your graphics card and extract it. Then, start `instant-ngp.exe`.
2121

22-
- [**RTX 5000 series and other Blackwell cards**](https://github.com/NVlabs/instant-ngp/releases/download/continuous/Instant-NGP-for-RTX-5000.zip)
22+
- [**RTX 5000 series** and other Blackwell cards](https://github.com/NVlabs/instant-ngp/releases/download/continuous/Instant-NGP-for-RTX-5000.zip)
2323
- [**RTX 3000 & 4000 series, RTX A4000&ndash;A6000**, and other Ampere & Ada cards](https://github.com/NVlabs/instant-ngp/releases/download/continuous/Instant-NGP-for-RTX-3000-and-4000.zip)
2424
- [**RTX 2000 series, Titan RTX, Quadro RTX 4000&ndash;8000**, and other Turing cards](https://github.com/NVlabs/instant-ngp/releases/download/continuous/Instant-NGP-for-RTX-2000.zip)
2525
- [**GTX 1000 series, Titan Xp, Quadro P1000&ndash;P6000**, and other Pascal cards](https://github.com/NVlabs/instant-ngp/releases/download/continuous/Instant-NGP-for-GTX-1000.zip)
@@ -361,4 +361,3 @@ Many thanks to the authors of these brilliant projects!
361361
Copyright © 2022, NVIDIA Corporation. All rights reserved.
362362

363363
This work is made available under the Nvidia Source Code License-NC. Click [here](LICENSE.txt) to view a copy of this license.
364-

dependencies/tiny-cuda-nn

Submodule tiny-cuda-nn updated 96 files

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)