Skip to main content

Crate cubek_test_utils

Crate cubek_test_utils 

Source

Modules§

hardware
Devices a routine’s decisions are tested against, as their runtimes report them.
quant_layout
The shapes and element types a QuantScheme implies.

Structs§

BaseInputSpec
Binding
The resource that bound a run’s duration, the slowest of the declared resources even running flat out at its own peak, alongside how fast the run actually achieved it. Mirrors the selection rule in throughput::binding_achieved.
CatalogEntry
A catalogued problem or strategy: stable id, human label, and the typed payload the category needs to actually run with. Categories build vectors of these and the registry erases them to ItemDescriptor for callers that only care about the id/label pair.
CategoryWork
What a (strategy, problem) run honestly moves and computes, built from problem alone and never from a measurement of its own run.
ComputeWork
Operations a run performs, and the probe whose peak they are judged against.
CubekConfig
Top-level configuration loaded from cubek.toml.
HostData
ItemDescriptor
PrintSection
Progress
Counter shared between a reference algorithm (which bumps it) and a caller (which polls it for streaming progression).
QuantizationInfo
Information about a quantized tensor in tests. This allows marking a tensor as quantized for the kernel dispatcher while keeping the original unquantized data on the host for reference.
QuantizedTileInput
A packed-quantized input born whole: a quantized tensor is one thing (data, scales, scheme), so the quantized builder mints the pair together, plus the exact numbers behind both for host references.
QuantizedTileInputBuilder
The quantized continuation of a TileInputBuilder: the container is fixed (packed-u32, values-unit declaration, the scheme’s block grid for scales); a content finalizer fills it and mints the values tile and its scales together: a quantized tensor is one thing (data, scales, scheme).
RandomInputSpec
RunSamples
TestInput
TestInputBuilder
Fluent builder for TestInput.
TestSection
TestTensor
A test tensor which might be marked as quantized.
TileInput
A tile-shaped test input: the device buffer plus the logical Space it’s viewed in. The sub-tile sizes live in the buffer’s trailing dims, so the view reads them from there.
TileInputBuilder
Fluent builder for a TileInput: a Space, a coarse→fine stack of tiling levels (each a split or tile), and a data finalizer that fills the [grid…, level…, finest…] buffer.

Enums§

DataKind
DimFilter
Distribution
ExecutionOutcome
Whether a kernel was executed (without regard to correctness) or failed to compile.
HostDataType
HostDataVec
InputDataType
LayoutSpec
The layout of a test tensor: a base StridedLayout that drives the physical strides.
PrintView
ResourceKind
Which resource a bench row’s binding measurement is judged against.
StridedLayout
How the base strides of a tensor are laid out before any tile-level rank expansion is applied.
TestDecision
The final policy-based verdict of a test, after applying the test mode. Determines whether the test should be considered passing or failing.
TestOutcome
The overall outcome of a test, combining execution and validation. Either the kernel was validated or failed to compile.
TestPolicy
ValidationResult
The result of correctness validation for a kernel execution.

Traits§

BenchmarkCategory
Public, string-keyed registry surface. Implemented automatically for any type that implements Category; categories should implement Category rather than this trait directly.
Category
Typed per-category definition. Implementors expose their problem and strategy catalogues with the actual payloads attached, plus a typed bench closure. The blanket impl below adapts to the string-keyed BenchmarkCategory consumed by the public registry, so categories no longer have to write the lookup boilerplate.
Correctness
Optional correctness surface for a category. Both methods take a seeds slice instead of fixed seed_lhs/seed_rhs so unary ops use just seeds[0] and future ops with more inputs can take more seeds without churning the trait.

Functions§

assert_equals_approx
Check if two tensors are approximately equal
assert_equals_approx_in_slice
Check if two tensors are approximately equal within the given filter.
client
The client every category scores against: measure_peak_throughput is always run on cubecl::test_device(), so the process-wide peak memo below can key on ThroughputKey alone.
compare_host_data_files
Compare two HostData blobs previously written to disk by crate::write_host_data.
config
Returns the active config. Cached on first call.
decide
Decide whether a test outcome passes or fails under the active policy.
launch_and_capture_outcome
Run launch against client, returning its ExecutionOutcome. A failure that surfaces only asynchronously is caught by checking outputs — the buffers the launch was going to write, which carry the failure when it never ran.
parse_tensor_filter
physical_extent
Number of elements in the physical buffer required to cover every logical index in shape under strides, assuming element 0 is at offset 0.
pretty_print_zip
print_tensor
Backwards-compatible single-tensor helper. Delegates to print_tensors.
print_tensors
Pretty-print one or two tensors through the unified renderer.
profile_launch
Times one launch on the device, failing the row when the launch itself failed.
read_host_data
Read a HostData previously produced by write_host_data.
skip_unless_cpu
CPU-only routines (e.g. cpu_gemm, where a plane is a thread) compute the wrong result on a GPU backend. Records a Skipped outcome and returns true when client is not a CPU backend (num_cpu_cores is None), so the caller can bail out of the test.
skip_unless_plane_holds
A kernel whose levels cut down to units needs a plane wide enough to hold them: a unit level must partition the plane exactly, so a plane of one unit (what the CPU runtime always reports) leaves such a partitioning with nothing to cut. Records a Skipped outcome and returns true when client’s plane is narrower than units, so the caller can bail out of the test.
supports_f16_arithmetic
Whether client’s device does real f16 arithmetic, not just storage, so a category can skip f16 rows the device would only fail on.
timing_method
The timing method a category measures with, overridden for a whole run by CUBEK_BENCH_TIMING. Device timestamps leave the launch out, so a row that beats its ceiling is checked by measuring it again on the wall clock.
write_host_data
Write data to path in the binary format documented at the module level.

Type Aliases§

TensorFilter