NeuroCC 0.4.0

NeuroCC is an experimental compiler that turns a narrow class of C/C++ functions into x86-64 machine-code bytes. It combines frozen neural models, deterministic tensor transformations, and ordinary compiler checks. The package returns bytes as data; it never assembles, links, or executes them.

Version 0.4.0 is a reproducible research release. Its default compiler has fixed model weights, fixed vocabularies and fixed validation rules, so users can repeat the reported measurements without downloading a model or using a development checkout.

In plain terms

This release is useful if you want to study a small neural-assisted compiler pipeline or reproduce its 598-program evaluation. It is not a replacement for Clang, GCC or LLVM, and it does not accept arbitrary C or C++.

Question Answer
What input is supported? A restricted set of isolated unsigned-integer functions.
What is produced? Candidate x86-64 System V function bytes and diagnostics.
Does it run the bytes? No. Execution is intentionally outside this package.
What is the default? Ordinary compilation, preserving the qualified 0.4.0 behavior.
What hardware is supported? CPU for reproducibility; CUDA for the reported throughput measurements.

The research reports use internal names that are useful for provenance but are not user-facing features. D5A means the qualified ordinary compiler path; it is the default mode. Round16B is simply the fixed 598-program development corpus. D5B3 is the retained tensor-assembly comparison baseline. D5-Final is an experimental scheduler configuration. H4–H7 describe the optional hyperoptimization research stages; H7 is the frozen hyperoptimizer shipped here.

This is a research compiler, not a general C/C++ compiler, not a wholly neural compiler, and not a claim of equivalence or optimality. Generated bytes are returned as data and are never executed by this package.

Model family

Release Default implementation Scope Reference
NeuroCC 0.3.0 Frozen hybrid backend Earlier compact unsigned-function subset 0.3.0 tag
NeuroCC 0.4.0 Qualified default compiler (D5A) Restricted isolated-function subset This release

The 0.3.0 release is preserved. D5-Final is included as an explicitly selected experimental configuration and is not the release default.

Install

The wheel and source tree are self-contained: the frozen checkpoints, vocabularies and tensor schemas are included. No development checkout, absolute Windows path or remote model download is required.

python -m pip install neuro_compiler-0.4.0-py3-none-any.whl

The tested runtime is Python 3.11+ with PyTorch 2.13.x, NumPy 1.26+ and SafeTensors 0.4+. CPU is supported for reproducibility; CUDA is recommended for the reported throughput measurements.

Python API

from neuro_compiler import NeuroCompiler

compiler = NeuroCompiler(device="auto")  # the qualified default is selected automatically
result = compiler.compile_source(
    'extern "C" unsigned kernel(const unsigned* a, unsigned* out, '
    'unsigned n, unsigned seed) { return (seed + 195u) + n * 5u; }'
)
print(result.valid, result.size, result.code.hex())

Batch inference preserves input lane order and returns invalid lanes with valid=False and empty bytes:

results = compiler.compile_batch([source_a, source_b])

Ordinary compilation is the default and is the compatibility mode:

ordinary = NeuroCompiler(device="auto")
result = ordinary.compile_source(source)

Hyperoptimization is explicitly opt-in. It retrieves guarded H4/H5 and H6/H7 alternatives, ranks them with the frozen H7 neural retriever and learned cost model, and sends any accepted candidate through the same existing backend:

optimized = NeuroCompiler(device="cuda", hyperopt=True)
result = optimized.compile_source(source)

If the source is outside H7's narrow expression-template coverage, a guard rejects every transformation, or candidate compilation fails, the result is the ordinary compiler result. result.record reports the mode, selected candidate kind, and fallback diagnostics.

To try the experimental final scheduler:

experimental = NeuroCompiler(device="cuda", implementation="d5-final")

CLI

neuro-compiler --device cpu --input kernel.cpp --output result.json
neuro-compiler --device cuda --implementation d5a --input kernel.cpp
neuro-compiler --device cuda --hyperopt --input kernel.cpp --output result.json

The CLI emits lane-aligned JSON with valid, size, code_hex and diagnostics. It does not assemble, link or execute the generated bytes.

Architecture

Ordinary compilation follows this tensor-first path:

  1. Source-only lexical packing and wrapper validation.
  2. Frozen neural syntax recognition with deterministic legality checks and repair ordering. (The earlier source-validation stage is called C5 in the research reports.)
  3. Bulk semantic packing and literal routing.
  4. Typed intermediate-representation construction, tensor instruction selection, compact liveness analysis, learned allocation scoring and learned instruction encoding.
  5. Lane-aligned function tensors with zeroed invalid lanes.

The optional H7 mode inserts guarded candidate generation before the same backend lowering and encoding stages:

source
  β”‚
  β”œβ”€β”€ ordinary mode ───────────────────────────────────────────────┐
  β”‚                                                               β”‚
  └── optional H7 mode                                            β”‚
        β”‚ capture source SSA                                      β”‚
        β”œβ”€ H4/H5 learned transformation memory                    β”‚
        β”œβ”€ H6 expression-hole rules + H7 alternatives              β”‚
        β”œβ”€ neural retrieval + learned runtime-cost selection       β”‚
        └─ structural guards / ordinary candidate                  β”‚
                              β”‚                                    β”‚
                              └── existing tensor backend β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚
                          x86-64 System V function bytes

The H4/H5 and H7 neural components are frozen PyTorch models. SSA capture, rule application, shape/ABI checks, candidate deduplication, and backend lowering are deterministic tensor or host-control operations. CPU operations remain for source I/O, lexical tokenization, guarded template matching, metadata, model loading, and final audit/export; the semantic and backend tensor stages retain their existing CUDA support. H7 never receives training witnesses, evaluation targets, reference outputs, or runtime oracle results at inference time.

The package includes the vocabulary tables, tensor schemas, frozen SSA, recognizer, router, encoder and allocator checkpoints required by this path. manifest.json and SHA256SUMS identify every shipped file and checkpoint. See ARCHITECTURE.md for the component-level contract and the exact ordinary-versus-H7 boundary.

Qualification and benchmarks

The actual packaged default compiler was qualified against all 598 programs in the fixed development test set. Audited parity and function-only byte equivalence both matched 598/598 with empty error and failure lists, inherited qualification, and unchanged checkpoint hashes. The reproducible reports are in neuro_compiler/qualification/.

Packaged CUDA qualification measurements at batch 16 (one completed run per configuration; the D5B3 value is retained as the architectural reference):

Configuration Function-only Audited Peak allocated / reserved
Qualified default compiler (D5A) 23.599 s 29.377 s 4,724.5 / 6,070 MiB function-only; 4,963.8 / 6,220 MiB audited
Tensor-assembly comparison (D5B3) 23.759 s 30.008 s retained architectural reference
Experimental final scheduler (D5-Final) 25.401 s 32.494 s 4,724.5 / 6,070 MiB function-only; 4,963.8 / 6,220 MiB audited

These are measurements of NeuroCC configurations only. They are not a fair LLVM benchmark and do not establish superiority over LLVM.

H7 hyperoptimization evaluation

The frozen H7 experiment contains 28 transformation rules, including 7 alternative rules, with 84/84 successful rule witnesses. On 496 evaluation programs, 445 transformations were applicable, neural top-1 retrieval was 442/445, top-k retrieval was 445/445, 389 optimized candidates were selected, and 368 selected the exact target. Finite pre-native oracle checks were 4,960/4,960; native correctness checks were 86,304 with zero program failures; negative controls activated 0/992 times.

Across 992 runtime size cases, NeuroCC won 452, LLVM won 499, and 41 were inconclusive. The overall geometric mean LLVM/NeuroCC ratio was 1.4911x; the previously inspected development population was 1.9696x and the fresh population was 0.4676x. The maximum observed speedup was 156.2889x. The prior population was inspected during development, and the fresh population was not an unseen-family holdout. These results use Clang 10 targeting x86-64. Native testing is finite and is not a general equivalence proof. H7 does not guarantee faster machine code, and the combined geometric mean is not evidence of general performance superiority over LLVM.

Supported subset and ABI

This release supports the restricted source subset accepted by the frozen development-test wrapper, semantic validator and tensor schemas. It is intended for isolated functions with the qualified unsigned integer signatures and operators represented by that corpus. Unsupported syntax, types, arity, capacity, control-flow or memory forms are rejected deterministically.

The emitted candidate function contract is x86-64 System V with no active calls or relocations. It is not a complete object, ELF/PE executable or Windows x64 ABI implementation. The package does not provide a general translation unit, include system, linker, optimizer or native execution path.

Limitations

  • Language coverage is deliberately narrow and rejection is expected outside the qualified subset.
  • GPU residency is incomplete: the default compiler still has host semantic/intermediate-representation planning and audit boundaries; the diagnostic guard is not a proof of end-to-end residency.
  • Compilation is for isolated functions; calls, relocations and executable packaging are not qualified.
  • The 598-program result inherits the existing qualification and is not an independent held-out generalization study.
  • D5-Final remains experimental and is not selected by default.
  • No native execution of predicted bytes is performed.
  • H7 is optional, applies only to its guarded canonical expression templates, and may be slower than ordinary compilation or LLVM on fresh inputs.
  • H7's learned cost model is trained on development timings; no timing labels, targets, or native oracle results are supplied during inference.

E1 is a separate research experiment and is not part of this release gate.

Integrated exact-state optimization (H1–H3)

The default 0.4.0 compiler includes a frozen exact intermediate-state optimization from the H1/H2 work. The package contains 241 unambiguous source/SSA/ABI entries built from 249 paired development examples; eight conflicting keys were excluded. When a source, intermediate-state digest and ABI match one of those entries, the compiler reuses the verified target intermediate packet before instruction selection. All other inputs use the ordinary qualified compiler path unchanged. This is a development-set memory, not a trained general-purpose optimizer, and it provides no independent generalization evidence.

phase_h1_h3.py, hyperopt_runtime_support.py, test_h1_h3.py and README_H1_H3.md document how to regenerate or inspect the artifact. H3 is a separate benchmark of the integrated path; it does not change the default compiler and does not claim superiority over LLVM. The experiment does not retrain models or execute raw predicted bytes. Compact H1/H2 provenance and H3 results are included under neuro_compiler/qualification/h1_*.json.

Reproducibility

The release contains neuro_compiler/qualification/, manifest.json and SHA256SUMS. The source repository can rerun the packaged harness with the development corpus and the existing qualified baseline:

python tools/phase_d5_qualify.py `
  --runner tools/ast_native_phase_d5a_packaged.py `
  --data <round16b_all> `
  --baseline <phase_c_frozen_all> `
  --batch 16 `
  --out runs\package_d5a

No training, retraining, language expansion or publication step is required to reproduce inference.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Collection including chrisuser/NeuroCC_0.4.0