Skip to content

[c.parallel]: migrate transform to use jit templates instead of string based implementations - #7399

Merged
NaderAlAwar merged 8 commits into
NVIDIA:mainfrom
NaderAlAwar:transform-c-parallel-stateful-ops
Jan 30, 2026
Merged

NaderAlAwar merged 8 commits into
NVIDIA:mainfrom
NaderAlAwar:transform-c-parallel-stateful-ops

Conversation

@NaderAlAwar

Copy link
Copy Markdown
Contributor

Description

closes #7387

Additionally, this PR makes changes to jit_templates to handle algorithms which could contain more than one type erased storage type. Prior to this, it was assumed that only one storage_t exists, but this change allows the caller to use a tagged_arg which contains a tag specifying the name of the storage type. This enables algorithms to define storage types with different sizes and alignments.

Checklist

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

@NaderAlAwar
NaderAlAwar requested review from a team as code owners January 28, 2026 18:57
@NaderAlAwar
NaderAlAwar requested review from gonidelis and rwgk January 28, 2026 18:57
@github-project-automation github-project-automation Bot moved this to Todo in CCCL Jan 28, 2026
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Jan 28, 2026
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

…void to ensure proper policy selection in device code
@github-actions

This comment has been minimized.

@griwes griwes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is good work, but I do have an issue with a couple of features that we lose if we do it as you have it right now.

Also, I believe this additionally resolves #7169 and #7010.

Comment thread c/parallel/src/jit_templates/traits.h Resolved
Comment on lines +295 to +298
if (ret.type == cccl_type_enum::CCCL_STORAGE || ((arguments.type == cccl_type_enum::CCCL_STORAGE) || ...))
{
return cuda::std::nullopt;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a bit of a regression; originally, @gevtushenko asked to also lower to cuda::std::foo for storage types, after giving them an operator foo, and that's handled within the if (entry->symbol) branch below. Can you see if that can be preserved here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted the change, although now this test

C2H_TEST("Transform works with custom types with well-known operators", "[transform][well_known]")
is failing since it expects input and output types to be the same, which is no longer the case now that we introduced different input and output storage types, which won't work since the op type is set to NEGATE

@NaderAlAwar NaderAlAwar Jan 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We discussed this offline:

  • The well known operators path with storage types will currently not work because there is no way for the C API to tell whether two storage types are the same or not. This is an issue because operators like negate require the input and output types to be the same
  • It might be possible to use the upper bits of the type enum as a storage type discriminator, but this is beyond the scope of this PR
  • We will open an issue to enhance the C API to tell whether two storage types are the same

For now I will keep my original change which bails out if a well known operator is used with storage types

@github-project-automation github-project-automation Bot moved this from In Review to In Progress in CCCL Jan 29, 2026
…lAwar/cccl into transform-c-parallel-stateful-ops
with storage types to properly handle enum to string conversion
@github-actions

This comment has been minimized.

@NaderAlAwar
NaderAlAwar requested a review from griwes January 30, 2026 16:03
@github-actions

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 1h 19m: Pass: 100%/18 | Total: 4h 58m | Max: 46m 20s | Hits: 97%/1264

See results here.

@github-project-automation github-project-automation Bot moved this from In Progress to In Review in CCCL Jan 30, 2026
@NaderAlAwar
NaderAlAwar merged commit aadc0c4 into NVIDIA:main Jan 30, 2026
@github-project-automation github-project-automation Bot moved this from In Review to Done in CCCL Jan 30, 2026
fbusato pushed a commit to fbusato/cccl that referenced this pull request Feb 19, 2026
…g based implementations (NVIDIA#7399)

* Plumb custom storage_t through jit templates to handle cases where operators can have different storage types for input and output

* Set value_type of output iterator template to actual type instead of void to ensure proper policy selection in device code

* Disable well known operations for storage types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[BUG] c.parallel: Stateful ops don't work with transform (and some other algorithms)

2 participants