feat(cccl): integrate missing CCCL directories — python/, ci/, .agent/, docs/, test/

Sparse-checkout from NVIDIA/cccl main branch to complete cccl_upstream:

Added:
- python/cuda_cccl/ (226 files) — Python bindings for device-level algorithms
  Critical for muh toolchain: cuda.compute.reduce_into, scan, radix_sort, etc.
  Includes 204 .py files with full test coverage for all 27 algorithms
- ci/ (163 files) — Build/test infrastructure
  build_cub.sh, test_cub.sh, build_and_test_targets.sh, matrix.yaml
  Directly maps to our [INFRA-CI] and [INFRA-BUILD] items
- .agent/skills/ (7 files) — NVIDIA's own agent skills for CCCL
  cccl-style/SKILL.md, cccl-test/SKILL.md, sass-diff/SKILL.md
- docs/ (491 files) — Official CCCL documentation
  CI references, CMake guides, Python compute docs, libcudacxx PTX docs
- test/ (12 files) — Top-level integration tests (cuda_smoke, stdpar)
- Root configs: .clang-format, .clang-tidy, CONTRIBUTING.md, pyproject.toml
- CLAUDE.md symlink → AGENTS.md (NVIDIA's standard)

cccl_upstream now mirrors full NVIDIA/cccl structure:
  Before: 42M (cub + thrust + libcudacxx + cudax + c + examples + benchmarks)
  After:  53M (+python +ci +docs +.agent +test +configs)

This completes the CCCL base needed for:
- [muh-bench] items: ci/util/build_and_test_targets.sh for targeted builds
- [CCCL-verify] items: python/cuda_cccl/tests/ as reference implementations
- [CCCL-test] items: ci/test_cub.sh, ci/test_thrust.sh
- Agent workflow: .agent/skills/ for consistent style and test patterns
This commit is contained in:
muh-bot
2026-08-07 02:34:33 +00:00
parent 3f97dca7ad
commit 2a7ca101d7
908 changed files with 121615 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
// Clean up the "On this page" sidebar for C++ API pages.
//
// Two problems caused by Breathe's per-overload anchor generation:
// 1. toc-h4 entries: Breathe adds a bare redundant "transform()" child anchor under each
// overload's section heading. Always remove them.
// 2. Duplicate toc-h3 entries: when all overloads share the same display name
// (e.g. "ExclusiveSum()"), keep only the first occurrence.
document.addEventListener('DOMContentLoaded', function() {
var tocNav = document.getElementById('pst-page-toc-nav');
if (!tocNav)
return;
tocNav.querySelectorAll('li.toc-h4').forEach(function(li) {
var label = li.textContent.trim();
if (label.endsWith('()')) {
li.remove();
}
});
var seen = new Set();
tocNav.querySelectorAll('li.toc-h3').forEach(function(li) {
var label = li.textContent.trim();
if (!label.endsWith(')')) {
return;
}
if (seen.has(label)) {
li.remove();
} else {
seen.add(label);
}
});
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

View File

@@ -0,0 +1,41 @@
.cccl-search-breadcrumbs {
display: flex;
flex-wrap: wrap;
font-size: 0.72em;
line-height: normal;
list-style: none;
padding: 0;
}
.cccl-search-breadcrumbs .breadcrumb-item {
align-items: center;
display: flex;
font-weight: 700;
margin: 0;
padding: 0;
white-space: nowrap;
}
.cccl-search-breadcrumbs .breadcrumb-item a {
color: var(--pst-color-text-muted);
margin: 0.1875rem;
overflow-x: hidden;
text-decoration: none;
text-overflow: ellipsis;
}
.cccl-search-breadcrumbs .breadcrumb-item a:hover {
color: var(--pst-color-link-hover);
text-decoration: underline;
text-decoration-skip-ink: none;
text-decoration-thickness: max(3px, 0.1875rem, 0.12em);
text-underline-offset: 0.1578em;
}
.cccl-search-breadcrumbs .breadcrumb-item + .breadcrumb-item::before {
color: var(--pst-color-text-muted);
content: var(--pst-breadcrumb-divider);
font: var(--fa-font-solid);
font-size: 0.8rem;
padding: 0 0.5rem;
}

View File

@@ -0,0 +1,265 @@
"use strict";
(function () {
const maxBreadcrumbResults = 10;
const decodeEntities = (value) =>
String(value || "")
.replace(/&lt;/g, "<")
.replace(/&gt;/g, ">")
.replace(/&amp;/g, "&")
.replace(/&quot;/g, '"')
.replace(/&#39;|&apos;/g, "'")
.replace(/&nbsp;/g, " ")
.replace(/&hellip;/g, "...");
const getDocLinkSuffix = () =>
(typeof DOCUMENTATION_OPTIONS !== "undefined" &&
DOCUMENTATION_OPTIONS.LINK_SUFFIX) ||
".html";
const pageInfoCache = new Map();
const getDocTitle = (docName) => {
if (
typeof Search === "undefined" ||
!Search._index ||
!Array.isArray(Search._index.docnames) ||
!Array.isArray(Search._index.titles)
) {
return null;
}
const index = Search._index.docnames.indexOf(docName);
return index >= 0 ? Search._index.titles[index] : null;
};
const getResultDocNameFromHref = (href) => {
if (!href) {
return null;
}
const withoutAnchor = String(href).split("#", 1)[0];
const linkSuffix = getDocLinkSuffix();
const suffixIndex = withoutAnchor.lastIndexOf(linkSuffix);
if (suffixIndex < 0) {
return null;
}
let docName = withoutAnchor.slice(0, suffixIndex);
if (docName.startsWith("./")) {
docName = docName.slice(2);
}
const contentRoot =
document?.documentElement?.dataset?.content_root || "";
if (contentRoot && docName.startsWith(contentRoot)) {
docName = docName.slice(contentRoot.length);
}
return docName.replace(/^\/+/, "");
};
const getPageInfo = async (docName) => {
if (pageInfoCache.has(docName)) {
return pageInfoCache.get(docName);
}
const infoPromise = (async () => {
const pageUrl = `${docName}${getDocLinkSuffix()}`;
const response = await fetch(pageUrl);
const html = await response.text();
const parsed = new DOMParser().parseFromString(html, "text/html");
const pageHeading = parsed.querySelector("h1");
const breadcrumbLinks = Array.from(
parsed.querySelectorAll(".breadcrumb-item a.nav-link"),
);
const breadcrumbs = breadcrumbLinks
.map((breadcrumbLink) => {
const rawHref = breadcrumbLink.getAttribute("href");
if (!rawHref) {
return null;
}
return {
href: new URL(rawHref, response.url).href,
title: breadcrumbLink.textContent?.trim() || null,
};
})
.filter((breadcrumb) => breadcrumb && breadcrumb.title);
return {
pageTitle:
pageHeading?.textContent?.replace(/#\s*$/, "").trim() ||
getDocTitle(docName) ||
null,
breadcrumbs,
};
})().catch(() => null);
pageInfoCache.set(docName, infoPromise);
return infoPromise;
};
const addBreadcrumbTrail = async (listItem) => {
if (
!listItem ||
listItem.dataset.ccclBreadcrumbsAttached === "true" ||
listItem.dataset.ccclBreadcrumbsPending === "true"
) {
return;
}
listItem.dataset.ccclBreadcrumbsPending = "true";
const primaryLink = listItem.querySelector("a");
if (!primaryLink) {
delete listItem.dataset.ccclBreadcrumbsPending;
return;
}
const primaryTitle = primaryLink.textContent?.trim() || "";
const href = primaryLink.getAttribute("href");
const docName = getResultDocNameFromHref(href);
if (!docName) {
delete listItem.dataset.ccclBreadcrumbsPending;
return;
}
const pageInfo = await getPageInfo(docName);
if (!pageInfo) {
delete listItem.dataset.ccclBreadcrumbsPending;
return;
}
const pageTitle = pageInfo.pageTitle || getDocTitle(docName);
const breadcrumbs = [...(pageInfo.breadcrumbs || [])];
if (pageTitle && primaryTitle && pageTitle !== primaryTitle) {
breadcrumbs.push({
href: `${docName}${getDocLinkSuffix()}`,
title: pageTitle,
});
}
if (breadcrumbs.length === 0) {
delete listItem.dataset.ccclBreadcrumbsPending;
return;
}
const breadcrumbContainer = document.createElement("div");
breadcrumbContainer.className = "cccl-search-breadcrumbs";
breadcrumbs.forEach((breadcrumb) => {
const breadcrumbItem = document.createElement("span");
breadcrumbItem.className = "breadcrumb-item";
const breadcrumbLink = document.createElement("a");
breadcrumbLink.href = breadcrumb.href;
breadcrumbLink.textContent = breadcrumb.title;
breadcrumbItem.appendChild(breadcrumbLink);
breadcrumbContainer.appendChild(breadcrumbItem);
});
listItem.insertBefore(breadcrumbContainer, primaryLink.nextSibling);
listItem.dataset.ccclBreadcrumbsAttached = "true";
delete listItem.dataset.ccclBreadcrumbsPending;
};
const installResultDecorator = () => {
if (
typeof Search === "undefined" ||
Search.__ccclResultDecoratorInstalled ||
typeof MutationObserver === "undefined"
) {
return;
}
const originalPerformSearch = Search.performSearch;
Search.performSearch = (...args) => {
const result = originalPerformSearch(...args);
const output = Search.output;
if (!output) {
return result;
}
const decorateTopResults = () => {
Array.from(output.querySelectorAll("li"))
.slice(0, maxBreadcrumbResults)
.forEach(addBreadcrumbTrail);
};
if (Search.__ccclResultsObserver) {
Search.__ccclResultsObserver.disconnect();
}
decorateTopResults();
const observer = new MutationObserver((mutations) => {
decorateTopResults();
});
observer.observe(output, { childList: true, subtree: true });
Search.__ccclResultsObserver = observer;
Search.__ccclResultDecoratorInstalled = true;
return result;
};
};
const installPostprocess = () => {
if (typeof Search === "undefined" || Search.__ccclDedupInstalled) {
return;
}
const originalPerformSearch = Search._performSearch;
Search._performSearch = (...args) => {
const results = originalPerformSearch(...args);
// Sphinx keeps results in low->high score order and displays via pop().
// Walk from the end so we see the best-ranked result first, but prefer
// canonical page links without anchors when collapsing duplicates.
const chosen = new Map();
for (let i = results.length - 1; i >= 0; --i) {
const result = results[i];
const title = String(result[1] || "").toLowerCase();
const filename = String(result[5] || "");
const key = `${filename}\0${title}`;
const anchor = String(result[2] || "");
const existing = chosen.get(key);
if (!existing) {
chosen.set(key, result);
continue;
}
const existingAnchor = String(existing[2] || "");
const prefersCurrent = existingAnchor && !anchor;
if (prefersCurrent) {
chosen.set(key, result);
}
}
const deduped = [];
const emitted = new Set();
for (let i = 0; i < results.length; ++i) {
const result = results[i];
const title = String(result[1] || "").toLowerCase();
const filename = String(result[5] || "");
const key = `${filename}\0${title}`;
if (emitted.has(key)) {
continue;
}
const winner = chosen.get(key);
if (winner) {
winner[1] = decodeEntities(winner[1]);
winner[3] = decodeEntities(winner[3]);
deduped.push(winner);
emitted.add(key);
}
}
return deduped;
};
Search.__ccclDedupInstalled = true;
};
installPostprocess();
installResultDecorator();
})();

View File

@@ -0,0 +1,224 @@
"use strict";
const _normalizeSearchSymbol = (value) =>
(value || "")
.toLowerCase()
.replace(/&lt;|&gt;|&amp;|&quot;|&#39;|&apos;|&nbsp;|&hellip;/g, " ")
.replace(/[^a-z0-9:]+/g, "");
const _splitSymbolWords = (value) =>
(value || "")
.replace(/&lt;|&gt;|&amp;|&quot;|&#39;|&apos;|&nbsp;|&hellip;/g, " ")
.replace(/::/g, " ")
.replace(/([a-z0-9])([A-Z])/g, "$1 $2")
.replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2")
.toLowerCase()
.match(/[a-z0-9]+/g) || [];
const _getSearchQuery = () => {
try {
return new URLSearchParams(window.location.search).get("q") || "";
} catch {
return "";
}
};
var Scorer = {
// Keep strong object-name bias at the base layer.
objNameMatch: 80,
objPartialMatch: 35,
objPrio: {
0: 25, // highest-priority API objects
1: 10,
2: -10,
},
objPrioDefault: 0,
title: 15,
partialTitle: 7,
term: 5,
partialTerm: 2,
score: (result) => {
const [docName, title, anchor, descr, baseScore, filename] = result;
let score = baseScore;
const trimmedTitle = (title || "").trim();
const trimmedAnchor = (anchor || "").trim();
const trimmedDescription = (descr || "").trim();
const trimmedFilename = (filename || "").trim();
const trimmedDocName = (docName || "").trim();
const lowerDescription = trimmedDescription.toLowerCase();
const lowerFilename = trimmedFilename.toLowerCase();
const lowerDocName = trimmedDocName.toLowerCase();
const query = _getSearchQuery().trim();
const lowerQuery = query.toLowerCase();
const normalizedQuery = _normalizeSearchSymbol(query);
const titleParts = trimmedTitle.split("::").filter(Boolean);
const symbolDepth = titleParts.length;
const leaf = titleParts.length
? titleParts[titleParts.length - 1]
: trimmedTitle;
const parentTitle =
titleParts.length > 1 ? titleParts.slice(0, -1).join("::") : "";
const normalizedLeaf = _normalizeSearchSymbol(leaf);
const normalizedParent = _normalizeSearchSymbol(parentTitle);
const normalizedLeafOnlyQuery = _normalizeSearchSymbol(
query.includes("::") ? query.split("::").pop() : query,
);
const leafWords = _splitSymbolWords(leaf);
const queryWords = _splitSymbolWords(query);
const simpleQuery =
lowerQuery &&
!/[.:/_]/.test(lowerQuery) &&
/^[a-z0-9]+$/.test(lowerQuery);
const looksLikeNamespaceQualified =
/^[a-zA-Z_]\w*(::[a-zA-Z_]\w*)+/.test(trimmedTitle);
const isExactFunctionishTitle =
/::[A-Za-z_]\w*$/.test(trimmedTitle); // e.g. thrust::transform
const isClassishTitle =
/::[A-Z]\w*$/.test(trimmedTitle); // e.g. cub::DeviceRadixSort
const isParameterLike =
/(template parameter|function parameter)/i.test(trimmedDescription);
const isMemberLike =
/(C\+\+ (member|type|property))/i.test(trimmedDescription);
const isCallableLike =
/(C\+\+ function\b|C\+\+ class\b|C\+\+ struct\b)/i.test(trimmedDescription);
const isTopLevelSymbol = looksLikeNamespaceQualified && symbolDepth <= 2;
const isNestedSymbol = symbolDepth >= 3;
const isConstructorLike =
isNestedSymbol &&
_normalizeSearchSymbol(titleParts[symbolDepth - 2]) === normalizedLeaf;
const hasQueryInFilename =
lowerQuery && lowerFilename.includes(lowerQuery);
const hasQueryInDocName = lowerQuery && lowerDocName.includes(lowerQuery);
const isEnumeratorLike =
/(C\+\+ enumerator\b)/i.test(trimmedDescription) || /^[A-Z0-9_]+$/.test(leaf);
const isInternalHelperLike =
/(policy|dispatch|state|status|callback|preference|layout|runningprefixop|emptycallback|op)/i.test(
trimmedTitle,
) ||
/(TileState|Policy|Dispatch|Callback|Preference|Layout|RunningPrefixOp|Status|EmptyCallback)/.test(
trimmedTitle,
);
const isPythonModuleLike = /(Python module\b)/i.test(trimmedDescription);
const leafStartsWithQueryWord =
queryWords.length === 1 && leafWords[0] === queryWords[0];
const leafEndsWithQueryWord =
queryWords.length === 1 &&
leafWords.length > 0 &&
leafWords[leafWords.length - 1] === queryWords[0];
const leafQueryRemainderWords = queryWords.length === 1
? leafWords.filter((word) => word !== queryWords[0])
: [];
const hasCompactQueryWordRemainder =
leafStartsWithQueryWord &&
leafQueryRemainderWords.length > 0 &&
leafQueryRemainderWords.length <= 2;
const hasHelperSuffix =
/(Strategy|Policy|State|Status|Callback|Preference|Layout|Type|Op|Match|Functor|Tag|Traits|Descriptor|Counts)$/.test(
leaf,
);
// Strong bias toward actual API symbols.
if (isExactFunctionishTitle) score += 35;
if (isClassishTitle) score += 20;
// Small boost for anchored entries; these are often object targets.
if (trimmedAnchor) score += 5;
// Penalize taxonomy/concept pages that match lots of body text.
if (
lowerDescription.includes("thrust::") ||
lowerDescription.includes("cub::") ||
lowerDescription.includes("cuda::")
) {
score += 8;
}
// Query-aware ranking: prefer canonical symbol pages over nested members.
if (normalizedQuery) {
if (normalizedLeaf === normalizedLeafOnlyQuery) {
score += isTopLevelSymbol ? 180 : 35;
} else if (
normalizedLeafOnlyQuery &&
normalizedLeaf.includes(normalizedLeafOnlyQuery)
) {
score += 15;
}
}
if (isNestedSymbol) score -= 25;
if (isParameterLike) score -= 80;
if (isMemberLike) score -= 35;
if (isConstructorLike) score -= 30;
if (isCallableLike && isTopLevelSymbol) score += 20;
// Prefer libcudacxx/cuda symbols over thrust equivalents on ties.
if (
normalizedLeaf === normalizedLeafOnlyQuery &&
/^cuda::/.test(trimmedTitle)
) {
score += 12;
}
// For plain keyword queries, prefer pages that match in title/path metadata.
if (simpleQuery) {
if (hasQueryInFilename || hasQueryInDocName) score += 45;
if (isInternalHelperLike) score -= 100;
if (isPythonModuleLike) score -= 30;
if (hasHelperSuffix) score -= 80;
if (isTopLevelSymbol && isCallableLike && !hasHelperSuffix) score += 40;
if (
leafStartsWithQueryWord &&
isTopLevelSymbol &&
!isEnumeratorLike &&
!isInternalHelperLike
) {
score += 75;
}
if (
leafEndsWithQueryWord &&
isTopLevelSymbol &&
!isEnumeratorLike &&
!isInternalHelperLike
) {
score += 45;
}
// For broad prefix-style queries like "block", prefer compact public API
// names over longer compound variants or helper-like extensions.
if (
hasCompactQueryWordRemainder &&
isTopLevelSymbol &&
!isEnumeratorLike &&
!isInternalHelperLike &&
!hasHelperSuffix
) {
score += 70 - 15 * (leafQueryRemainderWords.length - 1);
}
// If a nested member matches the query but its parent symbol also does,
// prefer the parent page/class over the member overload.
if (
isNestedSymbol &&
normalizedLeaf === normalizedLeafOnlyQuery &&
normalizedParent.includes(normalizedLeafOnlyQuery)
) {
score -= 70;
}
if (
isTopLevelSymbol &&
normalizedLeaf.includes(normalizedLeafOnlyQuery) &&
normalizedLeaf !== normalizedLeafOnlyQuery
) {
score += 70;
}
}
return score;
},
};