Skip to content

Conversation

@antoinebou12
Copy link
Contributor

@antoinebou12 antoinebou12 commented Jan 26, 2026

Description

This PR fixes GPU CCD (SweepAndTiniestQueue broad phase) ignoring user-specified TightInclusionCCD parameters in compute_collision_free_stepsize.

Previously, the GPU path called scalable_ccd::cuda::ipc_ccd_strategy with hardcoded TightInclusionCCD::DEFAULT_TOLERANCE and TightInclusionCCD::DEFAULT_MAX_ITERATIONS, even when the user passed a custom TightInclusionCCD via the narrow_phase_ccd parameter.

Now, when narrow_phase_ccd is a TightInclusionCCD instance, the GPU path extracts tolerance and max_iterations using dynamic_cast and forwards them to scalable_ccd::cuda::ipc_ccd_strategy. If narrow_phase_ccd is not a TightInclusionCCD instance, we fall back to default values to preserve backward compatibility.

Motivation / Context

Dependencies

  • No new dependencies.
  • Requires existing CUDA support (IPC_TOOLKIT_WITH_CUDA=ON) and existing TightInclusionCCD class.

Fixes #124

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Added a new test case "GPU CCD parameter extraction" in tests/src/tests/ccd/test_gpu_ccd.cpp that verifies:

  • Custom TightInclusionCCD parameters (tolerance and max_iterations) are extracted and used on the GPU path
  • Default TightInclusionCCD works with default parameters
  • Non-TightInclusionCCD types (e.g., AdditiveCCD) fall back to defaults correctly
  • Explicit default parameters match implicit defaults, proving parameter extraction is working

Test Instructions:

  1. Build with CUDA support enabled (IPC_TOOLKIT_WITH_CUDA=ON)
  2. Run: ctest -R test_gpu_ccd
  3. Confirm the new "GPU CCD parameter extraction" test case passes

Test Configuration:

  • OS and Version: Windows 11 / Linux (WSL)
  • Compiler and Version: gcc 10+ / clang (with CUDA 12.6 support)

Checklist

  • I have followed the project style guide
  • My code follows the clang-format style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

When using SweepAndTiniestQueue broad phase, extract tolerance and
max_iterations from the narrow_phase_ccd parameter if it's a
TightInclusionCCD instance, otherwise fall back to defaults.

Adds tests to verify the parameter extraction works correctly.

Fixes ipc-sim#124
Copy link
Member

@zfergus zfergus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the fix!

@zfergus zfergus merged commit a9ece21 into ipc-sim:main Jan 26, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No Option to Pass Parameters to Scalable CCD Narrow-Phase

2 participants