Skip to content

[DNS] Dev/mkeshava/benchmark test - #904

Draft
mkeshavaNV wants to merge 6 commits into
mainfrom
dev/mkeshava/benchmark_test
Draft

[DNS] Dev/mkeshava/benchmark test#904
mkeshavaNV wants to merge 6 commits into
mainfrom
dev/mkeshava/benchmark_test

Conversation

@mkeshavaNV

Copy link
Copy Markdown
Contributor

No description provided.

mkeshavaNV and others added 6 commits March 31, 2026 08:11
…mers

Bypass slangtorch's Python WrappedFunction layer and call the raw
pybind11 C++ fn_handle directly. This matches NRE's pre-compiled
slangtorch extension behavior and reduces dispatch overhead from
~92us to ~39us (fwd p50).

Also adds CPU dispatch timing instrumentation (atexit stats) to both
slangpy and slangtorch PPISP benchmarks for apples-to-apples launch
latency comparison.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Consolidate _fn_handle and _bwd_fn_handle into a single
_get_native_fns() function with documentation explaining why
we bypass slangtorch's WrappedFunction layer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Load the slangtorch-compiled C++ extension directly as a raw pybind11
module, bypassing slangtorch's Python WrappedFunction wrapper entirely.
This matches NRE's pattern where bazel's slangtorch_library() produces
a pre-compiled .so that Python imports and calls directly:

    ppisp_slang.ppisp(block, grid, batch_size, ...)     # NRE: 18us
    ppisp_slang.ppisp_bwd_diff(block, grid, ...)        # NRE: 12us

The standalone JIT-compiled path now achieves 39us fwd / ~30us bwd,
vs 92us previously with WrappedFunction.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add ppisp_slangtorch_cc.so, the pre-compiled C++ CUDA extension for
the PPISP slangtorch kernel. At runtime, _get_native_module() loads
this .so directly (matching NRE's libppisp_slang_cc pattern), avoiding
the ~8s JIT compilation on first run. Falls back to JIT via slangtorch
if the .so fails to load (wrong platform/Python/CUDA version).

Built with: torch 2.11.0+cu128, Python 3.12, Linux x86_64.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Recompile the slangtorch C++ extension with the same flags as NRE's
bazel slangtorch_library():
  - nvcc: -O3 --use_fast_math --generate-line-info
  - g++: -O3 -DTORCH_EXTENSION_NAME=libppisp_slangtorch_cc
  - ld: -Wl,--no-undefined -Wl,--as-needed

This reduces dispatch latency from 31us to 12us (matching NRE's 18us)
and shrinks the .so from 2.0M to 716K. The key optimization is
--as-needed which reduces PLT overhead from unused symbol resolution.

Built with: nvcc 12.8, g++ 13, torch 2.11.0+cu128, Python 3.12.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
build_slangtorch_cc.sh recompiles the JIT-generated slangtorch sources
with optimized flags (-O3, --as-needed)

Usage:
  ./slangpy/benchmarks/ppisp/build_slangtorch_cc.sh /path/to/python
@coderabbitai

coderabbitai Bot commented Mar 31, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6c53a434-e4aa-4f33-9434-92be29438905

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev/mkeshava/benchmark_test

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

2 participants