| name | compileiq-author-objective |
| description | Use when writing the objective_function= passed to Search(). Covers the two legal signatures (compiler-only str vs mixed list), the baseline-knockout branch, per-eval cache busting, framework-specific --apply-controls injection (raw PTXAS, NVCC, Triton, Helion, cuTeDSL/FA4, FlashInfer), correctness-before-timing, INVALID_SCORE handling, and the Debug-pack O0/O3 ACF-injection canary that must pass before launching a search. Triggers on "objective function", "apply-controls", "INVALID_SCORE", "save_compiler_config", "baseline knockout", "BASELINE_CONFIG", "every config returns the same score", "TypeError fromhex".
|
| when_to_use | - About to write or modify the function passed as objective_function=.
- Search runs but every config returns an identical score (canary fails).
- Getting TypeError around fromhex or bytes (legacy pattern).
- Search hangs on individual configs (timeout/correctness handling missing).
|
| license | Apache-2.0 |
| metadata | {"version":"1.0.0","author":"NVIDIA CompileIQ","domain":"compiler-optimization"} |
| allowed-tools | Bash Read |
| paths | ["**/*.py","**/*.cu","**/*.cuh"] |
compileiq-author-objective
The objective function is where ~80% of CompileIQ user errors happen. This
skill tells you the exact shape it must have for current CompileIQ, how to
inject --apply-controls for each supported compile path, and how to verify
the whole pipeline works before paying for a full search.
For paste-ready full-file templates per framework, see
references/templates.md.
When
- Writing a brand-new objective function.
- Migrating an older objective off the legacy
bytes.fromhex(config_blob) pattern.
- Diagnosing "every config returns the same score" or "TypeError: fromhex".
The two legal signatures
Shape of search_space= | Objective signature | What config is |
|---|
Single provider, e.g. PtxasSearchSpace() | def objective(config: str) -> float | A hex string. Pass it straight to save_compiler_config(acf_path, config). |
List, e.g. [{"k": ss.choice(...)}, PtxasSearchSpace()] | def objective(mixed: list) -> float | A list of the same length. Unpack: user_space, ptxas_config = mixed. |
Mixed-space results keep the same list shape in best["params"]. Unpack it
before saving the ACF, for example:
user_space, ptxas_config = best["params"]. (Pattern reference:
examples/compilers/triton_example/mixed_triton.py:123-146.)
For multi-objective, return tuple[float, ...] of length num_objectives.
Canonical imports
from compileiq.types import INVALID_SCORE, BASELINE_CONFIG
from compileiq.utils.helpers import save_compiler_config
INVALID_SCORE is CompileIQ's sentinel — return it on any failure (compile,
hang, wrong answer, exception). Do not redefine it as float('inf').
BASELINE_CONFIG is the empty-dict sentinel CompileIQ passes when a knockout
knocks out every parameter (typically with normalize=True).