Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c.parallel: device wrappers as code, not format strings #3439

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

griwes
Copy link
Collaborator

@griwes griwes commented Jan 17, 2025

Description

So far, even with the recent refactoring, the code for the device wrappers lived in format strings. This has a number of downsides, and this PR aims to resolve those.

The wrappers are now actual C++ templates, can be edited with the help of LSP and code formatters, and attempts to obtain their type names will now do some rudimentary type checking in the host code. This is not perfect, as things like cccl_op_t carry basically no type information, but is an improvement over the status quo.

Also added is a CMake target that bundles all the wrappers into a file that contains their contents, preprocessed to a degree, wrapped into a string, so all the code can be simply added into the NVRTC TU wherever needed.

Resolves #2525
Resolves #2665
Resolves #2918

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@griwes griwes added the feature request New feature or request. label Jan 17, 2025
@griwes griwes self-assigned this Jan 17, 2025
@griwes griwes requested review from a team as code owners January 17, 2025 17:26
Copy link
Contributor

🟩 CI finished in 51m 21s: Pass: 100%/3 | Total: 1h 03m | Avg: 21m 13s | Max: 50m 58s
  • 🟩 cccl_c_parallel: Pass: 100%/2 | Total: 12m 42s | Avg: 6m 21s | Max: 10m 39s

    🟩 cpu
      🟩 amd64              Pass: 100%/2   | Total: 12m 42s | Avg:  6m 21s | Max: 10m 39s
    🟩 ctk
      🟩 12.6               Pass: 100%/2   | Total: 12m 42s | Avg:  6m 21s | Max: 10m 39s
    🟩 cudacxx
      🟩 nvcc12.6           Pass: 100%/2   | Total: 12m 42s | Avg:  6m 21s | Max: 10m 39s
    🟩 cudacxx_family
      🟩 nvcc               Pass: 100%/2   | Total: 12m 42s | Avg:  6m 21s | Max: 10m 39s
    🟩 cxx
      🟩 GCC13              Pass: 100%/2   | Total: 12m 42s | Avg:  6m 21s | Max: 10m 39s
    🟩 cxx_family
      🟩 GCC                Pass: 100%/2   | Total: 12m 42s | Avg:  6m 21s | Max: 10m 39s
    🟩 gpu
      🟩 v100               Pass: 100%/2   | Total: 12m 42s | Avg:  6m 21s | Max: 10m 39s
    🟩 jobs
      🟩 Build              Pass: 100%/1   | Total:  2m 03s | Avg:  2m 03s | Max:  2m 03s
      🟩 Test               Pass: 100%/1   | Total: 10m 39s | Avg: 10m 39s | Max: 10m 39s
    
  • 🟩 python: Pass: 100%/1 | Total: 50m 58s | Avg: 50m 58s | Max: 50m 58s

    🟩 cpu
      🟩 amd64              Pass: 100%/1   | Total: 50m 58s | Avg: 50m 58s | Max: 50m 58s
    🟩 ctk
      🟩 12.6               Pass: 100%/1   | Total: 50m 58s | Avg: 50m 58s | Max: 50m 58s
    🟩 cudacxx
      🟩 nvcc12.6           Pass: 100%/1   | Total: 50m 58s | Avg: 50m 58s | Max: 50m 58s
    🟩 cudacxx_family
      🟩 nvcc               Pass: 100%/1   | Total: 50m 58s | Avg: 50m 58s | Max: 50m 58s
    🟩 cxx
      🟩 GCC13              Pass: 100%/1   | Total: 50m 58s | Avg: 50m 58s | Max: 50m 58s
    🟩 cxx_family
      🟩 GCC                Pass: 100%/1   | Total: 50m 58s | Avg: 50m 58s | Max: 50m 58s
    🟩 gpu
      🟩 v100               Pass: 100%/1   | Total: 50m 58s | Avg: 50m 58s | Max: 50m 58s
    🟩 jobs
      🟩 Test               Pass: 100%/1   | Total: 50m 58s | Avg: 50m 58s | Max: 50m 58s
    

👃 Inspect Changes

Modifications in project?

Project
CCCL Infrastructure
libcu++
CUB
Thrust
CUDA Experimental
python
+/- CCCL C Parallel Library
Catch2Helper

Modifications in project or dependencies?

Project
CCCL Infrastructure
libcu++
CUB
Thrust
CUDA Experimental
+/- python
+/- CCCL C Parallel Library
Catch2Helper

🏃‍ Runner counts (total jobs: 3)

# Runner
2 linux-amd64-gpu-v100-latest-1
1 linux-amd64-cpu16

Copy link
Contributor

@shwina shwina left a comment

Choose a reason for hiding this comment

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

I can't provide feedback on the implementation, but it's definitely a quality-of-life improvement to be able to define the kernels in code rather than as strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request.
Projects
Status: In Review
2 participants