Skip to main content

build_kernel

Function build_kernel 

Source
pub fn build_kernel<R: Runtime>(
    client: &ComputeClient<R>,
    key: ThroughputKey,
    config: LaunchConfig,
    working_set: usize,
) -> KernelConfig
Expand description

Builds the read-only streaming kernel, moving working_set bytes per pass, all of them read.

This is memory_direct with the store removed. The copy kernel moves a line in and a line back out, and counts both directions in ops_count, so what it reports is total traffic across the memory interface. That is the right ceiling for a kernel that also writes what it reads, and the wrong one for a kernel that only reads — a weight stream, a reduction, a gather. Those legitimately exceed the copy figure, because half of the copy’s traffic is a direction they never use.

Reported ops_count is the read count alone. Exactly one line is written, by one thread, to keep the loads from being eliminated (see the kernel); at hundreds of megabytes read that is not worth counting and is deliberately left out of ops_count rather than approximated.