Skip to content

Commit

Permalink
v1.93:
Browse files Browse the repository at this point in the history
- NRI: replacing "QueueSemaphore" and "DeviceSemaphore" with "Fence" object
- NRI: decoupling synchronization from submission of commands
- NRI: added optional Streamline support
- NRI: "CmdDispatchMeshTasks" got "Dispatch"-like parameters
- NRI: "PhysicalDeviceGroup::description" changed back to char
- NRI: fixed compilation of C-style interface on Linux
- NRI: fixed potential out-of-bounds access in "GetPhysicalDevices"
- VK: VK SDK updated to v1.3.239
- VK: NV-only extensions replaced with cross-vendor EXT extensions
- VK: switched to VK v1.3, simplified initialization
- VK: removed "error to warning" conversion for old errors
- D3D12: fixed wrong PS_RESOURCE state usage in non-graphics queues
- D3D12: expensive allocation in "CommandQueueD3D12::Submit" replaced with stack alloc
- D3D11: fixed leaks caused by mixing "ptr" and "ComPtr" logic
- D3D11: maximum frame latency is set based on number of buffers in SwapChain
- fixes for Linux
- Cmake improvements
- updated dependencies
- updated scripts
- updated docs
- refactoring
  • Loading branch information
dzhdanNV committed Mar 20, 2023
1 parent efad48e commit 028bf26
Show file tree
Hide file tree
Showing 257 changed files with 9,767 additions and 11,681 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[submodule "External/vulkan"]
path = External/vulkan
url = https://github.com/KhronosGroup/Vulkan-Headers.git
branch = sdk-1.3.236.0
branch = sdk-1.3.239.0
update = merge
2 changes: 1 addition & 1 deletion 1-Deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ chmod +x "4-Clean.sh"
mkdir -p "_Compiler"

cd "_Compiler"
cmake .. -A x64
cmake ..
cd ..
4 changes: 2 additions & 2 deletions 2-Build.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@echo off

cd "_Compiler"
cmake --build . --config Release
cmake --build . --config Debug
cmake --build . --config Release -j 4
cmake --build . --config Debug -j 4
cd ..
4 changes: 2 additions & 2 deletions 2-Build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ mkdir -p "_Compiler"

cd "_Compiler"
cmake ..
cmake --build . --config Release
cmake --build . --config Debug
cmake --build . --config Release -j 4
cmake --build . --config Debug -j 4
cd ..
465 changes: 260 additions & 205 deletions CMakeLists.txt

Large diffs are not rendered by default.

25 changes: 6 additions & 19 deletions External/Packman/bootstrap/configure.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
:: Copyright 2019 NVIDIA CORPORATION
:: Copyright 2019-2023 NVIDIA CORPORATION
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
Expand All @@ -12,7 +12,7 @@
:: See the License for the specific language governing permissions and
:: limitations under the License.

set PM_PACKMAN_VERSION=6.35
set PM_PACKMAN_VERSION=7.2.1

:: Specify where packman command is rooted
set PM_INSTALL_PATH=%~dp0..
Expand Down Expand Up @@ -48,7 +48,7 @@ echo.
:: that may be needed in the path
:ENSURE_DIR
if not exist "%PM_PACKAGES_ROOT%" (
echo Creating directory %PM_PACKAGES_ROOT%
echo Creating packman packages cache at %PM_PACKAGES_ROOT%
mkdir "%PM_PACKAGES_ROOT%"
)
if %errorlevel% neq 0 ( goto ERROR_MKDIR_PACKAGES_ROOT )
Expand All @@ -59,7 +59,7 @@ if defined PM_PYTHON_EXT (
goto PACKMAN
)

set PM_PYTHON_VERSION=3.7.9-windows-x86_64
set PM_PYTHON_VERSION=3.10.5-1-windows-x86_64
set PM_PYTHON_BASE_DIR=%PM_PACKAGES_ROOT%\python
set PM_PYTHON_DIR=%PM_PYTHON_BASE_DIR%\%PM_PYTHON_VERSION%
set PM_PYTHON=%PM_PYTHON_DIR%\python.exe
Expand Down Expand Up @@ -112,9 +112,9 @@ if defined PM_MODULE_DIR_EXT (
set PM_MODULE_DIR=%PM_PACKAGES_ROOT%\packman-common\%PM_PACKMAN_VERSION%
)

set PM_MODULE=%PM_MODULE_DIR%\packman.py
set PM_MODULE=%PM_MODULE_DIR%\run.py

if exist "%PM_MODULE%" goto ENSURE_7ZA
if exist "%PM_MODULE%" goto END

:: Clean out broken PM_MODULE_DIR if it exists
if exist "%PM_MODULE_DIR%" ( rd /s /q "%PM_MODULE_DIR%" > nul )
Expand All @@ -137,19 +137,6 @@ if %errorlevel% neq 0 (

del "%TARGET%"

:ENSURE_7ZA
set PM_7Za_VERSION=16.02.4
set PM_7Za_PATH=%PM_PACKAGES_ROOT%\7za\%PM_7ZA_VERSION%
if exist "%PM_7Za_PATH%" goto END
set PM_7Za_PATH=%PM_PACKAGES_ROOT%\chk\7za\%PM_7ZA_VERSION%
if exist "%PM_7Za_PATH%" goto END

"%PM_PYTHON%" -S -s -u -E "%PM_MODULE%" pull "%PM_MODULE_DIR%\deps.packman.xml"
if %errorlevel% neq 0 (
echo !!! Error fetching packman dependencies !!!
goto ERROR
)

goto END

:ERROR_MKDIR_PACKAGES_ROOT
Expand Down
19 changes: 15 additions & 4 deletions External/Packman/bootstrap/download_file_from_url.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ param(
)
$filename = $output

$triesLeft = 3

$triesLeft = 4
$delay = 2
do
{
$triesLeft -= 1
Expand All @@ -31,12 +31,23 @@ do
Write-Host "Downloading from bootstrap.packman.nvidia.com ..."
$wc = New-Object net.webclient
$wc.Downloadfile($source, $fileName)
$triesLeft = 0
exit 0
}
catch
{
Write-Host "Error downloading $source!"
Write-Host $_.Exception|format-list -force
if ($triesLeft)
{
Write-Host "Retrying in $delay seconds ..."
Start-Sleep -seconds $delay
}
$delay = $delay * $delay
}
} while ($triesLeft -gt 0)

# We only get here if the retries have been exhausted, remove any left-overs:
if (Test-Path $fileName)
{
Remove-Item $fileName
}
exit 1
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
@powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0download_file_from_url.ps1" ^
-source "http://bootstrap.packman.nvidia.com/%PACKAGE_NAME%" -output %TARGET_PATH%
:: A bug in powershell prevents the errorlevel code from being set when using the -File execution option
:: We must therefore do our own failure analysis, basically make sure the file exists and is larger than 0 bytes:
:: We must therefore do our own failure analysis, basically make sure the file exists:
@if not exist %TARGET_PATH% goto ERROR_DOWNLOAD_FAILED
@if %~z2==0 goto ERROR_DOWNLOAD_FAILED

@endlocal
@exit /b 0
Expand Down
143 changes: 120 additions & 23 deletions External/Packman/bootstrap/install_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,139 @@
import zipfile
import tempfile
import sys
import shutil
import os
import stat
import time
from typing import Any, Callable


RENAME_RETRY_COUNT = 100
RENAME_RETRY_DELAY = 0.1

__author__ = "hfannar"
logging.basicConfig(level=logging.WARNING, format="%(message)s")
logger = logging.getLogger("install_package")


class TemporaryDirectory:
def __init__(self):
self.path = None
def remove_directory_item(path):
if os.path.islink(path) or os.path.isfile(path):
try:
os.remove(path)
except PermissionError:
# make sure we have access and try again:
os.chmod(path, stat.S_IRWXU)
os.remove(path)
else:
# try first to delete the dir because this will work for folder junctions, otherwise we would follow the junctions and cause destruction!
clean_out_folder = False
try:
# make sure we have access preemptively - this is necessary because recursing into a directory without permissions
# will only lead to heart ache
os.chmod(path, stat.S_IRWXU)
os.rmdir(path)
except OSError:
clean_out_folder = True

if clean_out_folder:
# we should make sure the directory is empty
names = os.listdir(path)
for name in names:
fullname = os.path.join(path, name)
remove_directory_item(fullname)
# now try to again get rid of the folder - and not catch if it raises:
os.rmdir(path)


class StagingDirectory:
def __init__(self, staging_path):
self.staging_path = staging_path
self.temp_folder_path = None
os.makedirs(staging_path, exist_ok=True)

def __enter__(self):
self.path = tempfile.mkdtemp()
return self.path
self.temp_folder_path = tempfile.mkdtemp(prefix="ver-", dir=self.staging_path)
return self

def get_temp_folder_path(self):
return self.temp_folder_path

# this function renames the temp staging folder to folder_name, it is required that the parent path exists!
def promote_and_rename(self, folder_name):
abs_dst_folder_name = os.path.join(self.staging_path, folder_name)
os.rename(self.temp_folder_path, abs_dst_folder_name)

def __exit__(self, type, value, traceback):
# Remove temporary data created
shutil.rmtree(self.path)
# Remove temp staging folder if it's still there (something went wrong):
path = self.temp_folder_path
if os.path.isdir(path):
remove_directory_item(path)


def install_package(package_src_path, package_dst_path):
with zipfile.ZipFile(
package_src_path, allowZip64=True
) as zip_file, TemporaryDirectory() as temp_dir:
zip_file.extractall(temp_dir)
# Recursively copy (temp_dir will be automatically cleaned up on exit)
try:
# Recursive copy is needed because both package name and version folder could be missing in
# target directory:
shutil.copytree(temp_dir, package_dst_path)
except OSError as exc:
def rename_folder(staging_dir: StagingDirectory, folder_name: str):
try:
staging_dir.promote_and_rename(folder_name)
except OSError as exc:
# if we failed to rename because the folder now exists we can assume that another packman process
# has managed to update the package before us - in all other cases we re-raise the exception
abs_dst_folder_name = os.path.join(staging_dir.staging_path, folder_name)
if os.path.exists(abs_dst_folder_name):
logger.warning(
"Directory %s already present, packaged installation aborted" % package_dst_path
f"Directory {abs_dst_folder_name} already present, package installation already completed"
)
else:
logger.info("Package successfully installed to %s" % package_dst_path)
raise


def call_with_retry(
op_name: str, func: Callable, retry_count: int = 3, retry_delay: float = 20
) -> Any:
retries_left = retry_count
while True:
try:
return func()
except (OSError, IOError) as exc:
logger.warning(f"Failure while executing {op_name} [{str(exc)}]")
if retries_left:
retry_str = "retry" if retries_left == 1 else "retries"
logger.warning(
f"Retrying after {retry_delay} seconds"
f" ({retries_left} {retry_str} left) ..."
)
time.sleep(retry_delay)
else:
logger.error("Maximum retries exceeded, giving up")
raise
retries_left -= 1


def rename_folder_with_retry(staging_dir: StagingDirectory, folder_name):
dst_path = os.path.join(staging_dir.staging_path, folder_name)
call_with_retry(
f"rename {staging_dir.get_temp_folder_path()} -> {dst_path}",
lambda: rename_folder(staging_dir, folder_name),
RENAME_RETRY_COUNT,
RENAME_RETRY_DELAY,
)


def install_package(package_path, install_path):
staging_path, version = os.path.split(install_path)
with StagingDirectory(staging_path) as staging_dir:
output_folder = staging_dir.get_temp_folder_path()
with zipfile.ZipFile(package_path, allowZip64=True) as zip_file:
zip_file.extractall(output_folder)

# attempt the rename operation
rename_folder_with_retry(staging_dir, version)

print(f"Package successfully installed to {install_path}")


install_package(sys.argv[1], sys.argv[2])
if __name__ == "__main__":
executable_paths = os.getenv("PATH")
paths_list = executable_paths.split(os.path.pathsep) if executable_paths else []
target_path_np = os.path.normpath(sys.argv[2])
target_path_np_nc = os.path.normcase(target_path_np)
for exec_path in paths_list:
if os.path.normcase(os.path.normpath(exec_path)) == target_path_np_nc:
raise RuntimeError(f"packman will not install to executable path '{exec_path}'")
install_package(sys.argv[1], target_path_np)
22 changes: 13 additions & 9 deletions External/Packman/packman.cmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
:: Reset errorlevel status (don't inherit from caller) [xxxxxxxxxxx]
:: RUN_PM_MODULE must always be at the same spot for packman update to work (batch reloads file during update!)
:: [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]
:: Reset errorlevel status (don't inherit from caller)
@call :ECHO_AND_RESET_ERROR
:: You can remove the call below if you do your own manual configuration of the dev machines
call "%~dp0\bootstrap\configure.bat"
Expand All @@ -8,16 +10,12 @@ if %errorlevel% neq 0 ( exit /b %errorlevel% )
if not defined PM_PYTHON goto :PYTHON_ENV_ERROR
if not defined PM_MODULE goto :MODULE_ENV_ERROR

:: Generate temporary path for variable file
for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile ^
-File "%~dp0bootstrap\generate_temp_file_name.ps1"') do set PM_VAR_PATH=%%a
set PM_VAR_PATH_ARG=

if %1.==. (
set PM_VAR_PATH_ARG=
) else (
set PM_VAR_PATH_ARG=--var-path="%PM_VAR_PATH%"
)
if "%1"=="pull" goto :SET_VAR_PATH
if "%1"=="install" goto :SET_VAR_PATH

:RUN_PM_MODULE
"%PM_PYTHON%" -S -s -u -E "%PM_MODULE%" %* %PM_VAR_PATH_ARG%
if %errorlevel% neq 0 ( exit /b %errorlevel% )

Expand Down Expand Up @@ -54,3 +52,9 @@ if /I "%PM_VERBOSITY%"=="debug" (
@echo on
)
exit /b 0

:SET_VAR_PATH
:: Generate temporary path for variable file
for /f "delims=" %%a in ('%PM_PYTHON% -S -s -u -E -c "import tempfile;file = tempfile.NamedTemporaryFile(mode='w+t', delete=False);print(file.name)"') do (set PM_VAR_PATH=%%a)
set PM_VAR_PATH_ARG=--var-path="%PM_VAR_PATH%"
goto :RUN_PM_MODULE
Loading

0 comments on commit 028bf26

Please sign in to comment.