/** * ruRE Phase 5 — CUDA fatbin and cubin static analysis (ADR-0006). One entry point: `analyzeCuda(bytes)` decides what it was handed from * the bytes (a host ELF or PE with a `.nv_fatbin` section, a standalone fatbin, a standalone cubin, or PTX text), walks the containers, * decompresses what may be decompressed under the caps, and returns the inventory: architectures, PTX, kernels and what each costs. * Parses, never executes; no CUDA toolkit or driver is touched. */ import { MAX_BINARY_BYTES } from './binary-parse.js'; import { type Compression, type Zstd } from './cuda-fatbin.js'; import { type CubinKernel } from './cuda-cubin.js'; import { type PtxInfo } from './cuda-ptx.js'; export { MAX_BINARY_BYTES }; export type CudaSource = 'host' | 'fatbin' | 'cubin' | 'ptx'; export interface CudaEntry { index: number; container: number; kind: 'ptx' | 'cubin' | 'unknown'; rawKind: number; arch: string | null; /** Reported raw: its meaning is not documented. */ version: string; flags: string; compressed: Compression; storedBytes: number; /** Bytes after decompression, or null when the payload could not be read. */ size: number | null; read: boolean; note?: string; objName?: { offset: number; length: number; }; } export interface CudaKernel extends CubinKernel { /** The index of the entry (cubin) it was read from, and that entry's architecture. */ entry: number | null; arch: string | null; } export interface CudaPtxModule extends PtxInfo { entry: number | null; } export interface CudaInfo { source: CudaSource; /** Where the fatbin was in a host file. */ hostSection: { name: string; offset: number; size: number; } | null; /** Names in a host file that say it uses CUDA: sections, libraries, driver and runtime imports. */ hostSignals: string[]; containers: number; entries: CudaEntry[]; /** Distinct `sm_NN` of the cubins and of the PTX, sorted. */ cubinArchs: string[]; ptxArchs: string[]; kernels: CudaKernel[]; ptx: CudaPtxModule[]; warnings: string[]; truncated: boolean; } export interface CudaOptions { includePtx?: boolean; /** Overridable so a Node without zstd can be tested; null means "this runtime cannot read zstd". */ zstd?: Zstd | null; } /** What the bytes are and what is in them. Never throws on hostile input: a failure is a warning. */ export declare function analyzeCuda(b: Buffer, opts?: CudaOptions): CudaInfo; //# sourceMappingURL=cuda-parse.d.ts.map