tiny.simd.PoolWorkerMapping
Defined in thread.pool.
API (6)
Actions
Public operations.
Fields and members
Public fields and members.
Source
Source: lib/simd/src/thread/pool.zig:103
zig
pub const PoolWorkerMapping = struct { cluster_index: u8 = 0, max_cluster_workers: usize = 0, pub fn init( cluster_index: usize, max_cluster_workers: usize, ) error{ InvalidCluster, EmptyCluster }!PoolWorkerMapping { if (cluster_index > all_clusters) return error.InvalidCluster; if (max_cluster_workers == 0) return error.EmptyCluster; return .{ .cluster_index = @intCast(cluster_index), .max_cluster_workers = max_cluster_workers, }; } pub fn clusterIndex(self: PoolWorkerMapping) usize { return self.cluster_index; } pub fn maxClusterWorkers(self: PoolWorkerMapping) usize { return self.max_cluster_workers; } pub fn globalIndex( self: PoolWorkerMapping, worker_index: usize, ) usize { if (self.max_cluster_workers == 0) return worker_index; if (self.cluster_index == all_clusters) { std.debug.assert(worker_index < all_clusters); return worker_index * self.max_cluster_workers; } std.debug.assert(worker_index < self.max_cluster_workers); return self.cluster_index * self.max_cluster_workers + worker_index; }};Source: lib/simd/src/root.zig:131
zig
pub const PoolWorkerMapping = thread.PoolWorkerMapping;Also reachable as
Audit
| Definitions | 5 |
|---|---|
| Public names | 15 |
| Members | 2 |
| Version | 26.7.0 |
| Revision | daab053ee433 |