Repository navigation
Description
Problem Statement
.cu / .cuh (CUDA) and .hip (AMD HIP / ROCm) are outside the allowlist, so every GPU kernel in a diff is silently dropped before review. On a repo with a modified .cu, .cuh, .hip and .cpp file, ocr delegate preview built from main (8eb8334) reports:
# Files (1 reviewable / 4 total)
~~- `kernels/attention.cu` [modified] +1/-0 (excluded: unsupported_ext)~~
~~- `kernels/attention.cuh` [modified] +1/-0 (excluded: unsupported_ext)~~
~~- `kernels/hip_softmax.hip` [modified] +1/-0 (excluded: unsupported_ext)~~
- `src/main.cpp` [modified] +1/-0
ocr rules check kernels/attention.cu resolves the same way: Pattern: default, i.e. the generic default.md checklist, which says nothing about launch configuration, block barriers, warp-level assumptions, or stream ordering.
The repositories where OCR is most often run — vLLM, PyTorch, flash-attention, llama.cpp, CUTLASS — keep a large share of their logic in .cu files, and that share is exactly the code with device-specific failure modes.
Proposed Solution
Treat CUDA and HIP as one language group, following the merged precedent of Solidity/Vyper (#961) and Verilog/SystemVerilog/VHDL (#1050):
supported_file_types.json: add.cu,.cuh,.hipsystem_rules.json:**/*.{cu,cuh}→cuda_hip.mdand**/*.hip→cuda_hip.md— two patterns, one doc, the same shape as{ml,mli}and{re,rei}→ocaml.md, since HIP is the same programming model under a different runtime prefix- new
rule_docs/cuda_hip.mdcovering launch configuration and error checking, shared-memory and block synchronization, warp-level programming and the memory model, bounds/shapes/type sizes, host-device-stream lifetimes, and numerics/aliasing - no new default exclude pattern: CUDA/HIP have no conventional test-path convention (
tests/holds production kernels in several projects, and the C++/C arms deliberately have no extension-scoped test pattern either), so an extension-scoped pattern would drop real source. The test table documents that absence instead. - the rule-resolution table in all five locales
- tests: allowlist cases including case-insensitivity,
IsExcludedPathcases for the deliberate non-exclusion,Resolveassertions per extension, and aResolveDetailtest pinning which pattern matched
Alternatives Considered
- Route
.cuto the existingcpp.mdrules. Rejected: a kernel's real defects are the GPU-specific ones — a barrier that not all threads reach, an unsynchronized shuffle on Volta or later, an unchecked launch, a buffer touched across two streams — and none of them appear in the C++ checklist. - Separate
cuda.mdandhip.mddocuments. Rejected: they would state the same rules twice and drift apart; the repository already shares one document across closely related dialects (ocaml.md,verilog.md,handlebars_mustache.md). - Add
.cuto the allowlist with no rule doc. Rejected: the files would then be reviewed underdefault.md, which is the current behaviour for the generic checklist and was the reason this group is worth a rule doc at all.
Affected Area
Review Rules
Additional Context
- Tracking issue: feat(allowlist): expand supported file types — language experts wanted #470 (
good first issue,help wanted) - CUDA and HIP do not appear in that table, and per its closing line ("Don't see your language? Comment below to propose it!") this is the proposal. No open or closed PR or issue in this repository mentions cuda, hip, or opencl.
- Disclosure: the issue text and the linked change were drafted with the help of an AI coding agent (Hermes Agent by Nous Research, model
deepseek-v4.1-flash); I read every line of the diff myself and verified it against the built CLI and the test suite.
Activity