Skip to documentation
SLOP

tiny.simd.IndexRangePartition

Reference tiny.simd IndexRangePartition

Defined in thread.ranges.

API (11)

Actions

Public operations.

Fields and members

Public fields and members.

No direct callersNo direct callsthread.rangesIndexRangePartition
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/simd/src/thread/range.zig:39

zig
pub const IndexRangePartition = struct {    range: IndexRange,    task_size: u32,    task_count: u32,    pub fn single(        task_size: usize,    ) error{ EmptyTask, TaskTooLarge }!IndexRangePartition {        if (task_size == 0) return error.EmptyTask;        if (task_size > std.math.maxInt(u32)) return error.TaskTooLarge;        return .{            .range = .{ .begin = 0, .end = task_size },            .task_size = @intCast(task_size),            .task_count = 1,        };    }    pub fn init(        range: IndexRange,        task_size: usize,    ) error{ InvalidRange, EmptyTask, RangeTooLarge, TaskTooLarge }!IndexRangePartition {        if (range.begin >= range.end) return error.InvalidRange;        if (task_size == 0) return error.EmptyTask;        if (range.count() > std.math.maxInt(u32)) return error.RangeTooLarge;        if (task_size > std.math.maxInt(u32)) return error.TaskTooLarge;        const task_count = std.math.divCeil(            u32,            @intCast(range.count()),            @intCast(task_size),        ) catch unreachable;        std.debug.assert(task_count != 0);        return .{            .range = range,            .task_size = @intCast(task_size),            .task_count = task_count,        };    }    pub fn taskSize(self: IndexRangePartition) usize {        return self.task_size;    }    pub fn taskCount(self: IndexRangePartition) usize {        return self.task_count;    }    pub fn rangeAt(        self: IndexRangePartition,        task_index: usize,    ) error{TaskOutOfBounds}!IndexRange {        if (task_index >= self.task_count) return error.TaskOutOfBounds;        const begin = self.range.begin + task_index * self.task_size;        return .{            .begin = begin,            .end = begin + @min(self.task_size, self.range.end - begin),        };    }    pub fn visitAll(        self: IndexRangePartition,        context: anytype,        comptime visit: fn (@TypeOf(context), IndexRange) void,    ) void {        for (0..self.task_count) |task_index| {            visit(context, self.rangeAt(task_index) catch unreachable);        }    }    pub fn visitFirst(        self: IndexRangePartition,        context: anytype,        comptime visit: fn (@TypeOf(context), IndexRange) void,    ) void {        visit(context, self.rangeAt(0) catch unreachable);    }    pub fn visitRemaining(        self: IndexRangePartition,        context: anytype,        comptime visit: fn (@TypeOf(context), IndexRange) void,    ) void {        for (1..self.task_count) |task_index| {            visit(context, self.rangeAt(task_index) catch unreachable);        }    }};

Source: lib/simd/src/root.zig:113

zig
pub const IndexRangePartition = thread.IndexRangePartition;
Called byCallsNo direct callstest sourcelib.simd.src.thread.rangetest: Highway index range partition r...test sourcelib.simd.src.thread.rangetest: Highway index range partitions ...IndexRangePartitioninit
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callsIndexRangePartitionvisitAllIndexRangePartitionvisitFirstIndexRangePartitionvisitRemainingtest sourcelib.simd.src.thread.rangetest: Highway index range partitions ...IndexRangePartitionrangeAt
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callstest sourcelib.simd.src.thread.rangetest: Highway one-task partition cove...IndexRangePartitionsingle
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callstest sourcelib.simd.src.thread.rangetest: Highway index range partitions ...IndexRangePartitiontaskCount
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callstest sourcelib.simd.src.thread.rangetest: Highway index range partitions ...IndexRangePartitiontaskSize
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallstest sourcelib.simd.src.thread.rangetest: Highway index range partitions ...IndexRangePartitionrangeAtIndexRangePartitionvisitAll
Static calls · unresolved targets: 2 · external targets: 0.
Called byCallstest sourcelib.simd.src.thread.rangetest: Highway index range partitions ...IndexRangePartitionrangeAtIndexRangePartitionvisitFirst
Static calls · unresolved targets: 2 · external targets: 0.
Called byCallstest sourcelib.simd.src.thread.rangetest: Highway index range partitions ...IndexRangePartitionrangeAtIndexRangePartitionvisitRemaining
Static calls · unresolved targets: 2 · external targets: 0.

Also reachable as

thread.IndexRangePartition.

Audit

Definitions9
Public names27
Members3
Version26.7.0
Revisiondaab053ee433