Skip to main content

Module mock

Module mock 

Source
Expand description

GPU Mock Testing Utilities

This module provides utilities for mocking GPU behavior in CPU tests. It simulates GPU intrinsics, thread organization, and memory patterns.

§Example

use ringkernel_cpu::mock::{MockGpu, MockThread, MockKernelConfig};

// Configure a mock kernel launch
let config = MockKernelConfig::new()
    .with_grid_size(4, 4, 1)
    .with_block_size(32, 8, 1);

// Create mock GPU context
let gpu = MockGpu::new(config);

// Execute kernel with mock threads
gpu.dispatch(|thread| {
    let gid = thread.global_id();
    // Kernel code here
});

Structs§

MockAtomics
Mock atomic operations.
MockGpu
Mock GPU for testing kernel execution.
MockKernelConfig
Configuration for mock kernel execution.
MockSharedMemory
Mock shared memory for a block.
MockThread
Mock thread context providing GPU intrinsics.
MockWarp
Mock warp operations for testing warp-level primitives.