kernelrankdevice

command
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2026 License: Apache-2.0 Imports: 27 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Kernelrankdevice measures how far the stock kernel cost models are from one CUDA device, on a small fixed suite of kernel decisions.

kernelrankdevice -o corpus.jsonl [-n 10] [-seed N] [-driver V] [-contention TEXT]
kernelrankdevice -score corpus.jsonl [-v]
kernelrankdevice -stamp

With -o it runs the suite on the first CUDA device and writes two files that must not exist: the corpus, in package kernelrank's format, and beside it a raw sample log (-raw, by default the corpus name with .raw.jsonl). Then it prints the report. With -score it prints the report for a corpus that already exists and needs no device. With -stamp it prints the state of host and device and runs no kernel. Without a CUDA device, -o and -stamp fail and say so.

The suite

A decision is a set of candidates that compute the same thing. The suite is the table in suite.go: sweeps that trade bytes against FLOPs, line loads over working sets around the L2 size, one workload over grids that reach different shares of the SMs, one sweep at several block sizes, a matrix-vector loop at several unroll factors, and one sweep in one launch or several. The last is recorded twice: at the kernel_span boundary, each launch's own span summed, and at the device_span boundary, from the first launch's entry to the last one's exit, which includes the gaps between launches and so is not a kernel span. A candidate of several launches records the work of each launch record beside its own. The suite has no launch triggered from inside another and states no cache policy for any load, so no launch records a trigger or a cache policy.

Times are differences of %globaltimer read inside the kernels: the latest block exit minus the earliest block entry. No host clock enters a sample. Each decision is run in rounds, two untimed and then -n timed ones. A round runs every candidate once, and the first candidate a second time as the decision's A/A null arm, recorded as the control, in an order drawn for that round from -seed. Nothing is reset between arms: what one arm leaves in the caches is part of what the next one is measured under, and a random order keeps that from repeating with the round. The raw log names each sample's predecessor, so the carry-over can be read out. Every candidate's output is checked once before timing. Ten samples per candidate is the least the collector accepts; a run meant to be cited should take 20 or more.

A sample cites its line of the raw log and that line's SHA-256. The corpus records the device as the driver names it, the driver and compiler versions, the compiler flags, the seed, the digest of each candidate's source, and the registers, shared memory, frame and text size of each kernel as its cubin states them. Launches queued behind another of the same sample say so. Device memory and L2 capacity are the driver's own figures, marked probed; no capacity is taken from the command line. The corpus waives what the collector does not have: the blocks per SM the device actually held, and a stall profile.

The state of the device

Before the first kernel and after the last the collector stamps the host's load average, the number of other compute processes on the device and the memory they hold, as nvidia-smi lists them, and the device's free memory. Both stamps go into every decision's contention record, after whatever -contention states, and no process, user or host is named. The collector then prints one line: "quiet: yes" when both stamps show no other compute process on the device, "quiet: no" otherwise, including when the list could not be read. That line is all it says about the run. Whether a run can be cited is for its reader to decide; a quiet stamp at both ends does not show the time between.

The report

The report leads with time error: for each stock model, the summary of kernelrank.ScoreError over all candidates and over the held-out ones (every second candidate of a decision). Then it gives the ranking tally of kernelrank.Score, and then each decision with the noise floor its pairs were judged under: two candidates whose medians differ by less than the floor are a tie in the tally. The floor is printed with its parts as kernelrank.Decision.Floors gives them: the A/A gap between the null arm and the candidate it repeats, the range, which decides nothing, and any candidate whose samples fall in two groups and so has no order. The stock models are package stockform's stepplan and cudalower forms and kernelrank's structural model calibrated on the corpus's fit candidates. For the structural model only the held-out lines are a test.

What the numbers mean

A tally, a ratio of predicted to measured time and every figure summarizing such ratios describe these models on this suite, on the one device the corpus names, under the compiler and driver it names, on the day it was taken, at the boundary each decision states. They are not an accuracy claim for the models in general, for another device, for kernels unlike the suite's, or for a serving workload: the suite holds a few dozen planted candidates chosen so that the features kernelrank extracts apply to them. A candidate a model declines to price is counted as unknown or illegal and enters no ratio, so a model that declines often is summarized on fewer candidates, not on easier terms; read the counts beside the error. The work of each candidate is arithmetic on its source, not a measurement, and an error in that arithmetic appears here as model error. The measured time is a median of device-clock differences. Where the host and the device share memory some samples run slow; they widen the range and leave the median where it was, and a candidate that runs at two speeds is reported as bimodal rather than given a median that describes neither.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL