ae28d55f81
Source: RGB-D -> Dyn-HaMR -> L20 retargeting -> FoundationPose -> reference repair -> SPIDER, documented in docs/PIPELINE_LATEST.md and docs/SETUP_AND_WEIGHTS.md. Adds FoundationPose and nvdiffrast upstream snapshots, requirements/pipeline_venv.txt and the FoundationPose weight manifest/downloader. Assets (Git LFS): weights/ (WiLoR detector, HandFlow denoiser, UniDepth-L), FoundationPose checkpoints, HaMeR checkpoint, Dyn-HaMR HMP model and BMC constraints, L20 URDF/meshes, the 20260915_171525 D405 recording and the two box CADs. MANO models are not redistributed (third_party/hamer/_DATA/data/mano/README.txt). Environments, caches and run outputs excluded. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
61 lines
1.8 KiB
C++
61 lines
1.8 KiB
C++
// Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
|
|
//
|
|
// NVIDIA CORPORATION and its licensors retain all intellectual property
|
|
// and proprietary rights in and to this software, related documentation
|
|
// and any modifications thereto. Any use, reproduction, disclosure or
|
|
// distribution of this software and related documentation without an express
|
|
// license agreement from NVIDIA CORPORATION is strictly prohibited.
|
|
|
|
#include <cuda_runtime.h>
|
|
|
|
//------------------------------------------------------------------------
|
|
// Block and grid size calculators for kernel launches.
|
|
|
|
dim3 getLaunchBlockSize(int maxWidth, int maxHeight, int width, int height)
|
|
{
|
|
int maxThreads = maxWidth * maxHeight;
|
|
if (maxThreads <= 1 || (width * height) <= 1)
|
|
return dim3(1, 1, 1); // Degenerate.
|
|
|
|
// Start from max size.
|
|
int bw = maxWidth;
|
|
int bh = maxHeight;
|
|
|
|
// Optimizations for weirdly sized buffers.
|
|
if (width < bw)
|
|
{
|
|
// Decrease block width to smallest power of two that covers the buffer width.
|
|
while ((bw >> 1) >= width)
|
|
bw >>= 1;
|
|
|
|
// Maximize height.
|
|
bh = maxThreads / bw;
|
|
if (bh > height)
|
|
bh = height;
|
|
}
|
|
else if (height < bh)
|
|
{
|
|
// Halve height and double width until fits completely inside buffer vertically.
|
|
while (bh > height)
|
|
{
|
|
bh >>= 1;
|
|
if (bw < width)
|
|
bw <<= 1;
|
|
}
|
|
}
|
|
|
|
// Done.
|
|
return dim3(bw, bh, 1);
|
|
}
|
|
|
|
dim3 getLaunchGridSize(dim3 blockSize, int width, int height, int depth)
|
|
{
|
|
dim3 gridSize;
|
|
gridSize.x = (width - 1) / blockSize.x + 1;
|
|
gridSize.y = (height - 1) / blockSize.y + 1;
|
|
gridSize.z = (depth - 1) / blockSize.z + 1;
|
|
return gridSize;
|
|
}
|
|
|
|
//------------------------------------------------------------------------
|