tiny.simd.topology
Defined in tiny.simd.
API (19)
Actions
Public operations.
computeCacheSetsdataCachesgetThreadAffinityhaveThreadingSupportinitpinThreadToLogicalProcessorsetThreadAffinitytotalLogicalProcessors
Types and contracts
Public types and contracts.
Values and defaults
Public values and defaults.
Source
Source: lib/simd/src/topology/model.zig:18
zig
pub const Cluster = struct { lps: LogicalProcessorSet = .{}, private_kib: u64 = 0, shared_kib: u64 = 0, reserved1: u64 = 0, reserved2: u64 = 0, reserved3: u64 = 0,};Source: lib/simd/src/topology/model.zig:27
zig
pub const Core = struct { lps: LogicalProcessorSet = .{}, reserved: u64 = 0,};Source: lib/simd/src/topology/model.zig:9
zig
pub const LP = packed struct { cluster: u16 = 0, core: u16 = 0, package: u8 = 0, smt: u8 = 0, node: u8 = 0, reserved: u8 = 0,};Source: lib/simd/src/topology/model.zig:32
zig
pub const Package = struct { clusters: []const Cluster, cores: []const Core,};Source: lib/simd/src/topology/model.zig:48
zig
pub const ProcessorRecord = struct { package_id: u64, cluster_id: u64, core_id: u64, node: u8 = 0, private_kib: u64 = 0, shared_kib: u64 = 0,};Source: lib/simd/src/topology/model.zig:65
zig
pub const Error = std.mem.Allocator.Error || CapacityError;Source: lib/simd/src/topology/model.zig:67
zig
pub fn computeCacheSets(cache: *Cache) bool { if (cache.size_kib == 0) { cache.sets = 0; return true; } if (cache.bytes_per_line == 0 or cache.associativity == 0) return false; const bytes = @as(u64, cache.size_kib) * 1024; const computed = bytes / cache.bytes_per_line / cache.associativity; if (computed > std.math.maxInt(u32)) return false; if (cache.sets == 0) { cache.sets = @intCast(computed); return true; } const actual: u64 = cache.sets; return actual >= computed and actual - computed <= 1;}Source: lib/simd/src/root.zig:15
zig
pub const topology = @import("topology/root.zig");Source: lib/simd/src/topology/root.zig
zig
const model = @import("model.zig");const native = @import("native.zig");const parsing = @import("parse/root.zig");pub const max_logical_processors = model.max_logical_processors;pub const LogicalProcessorSet = model.LogicalProcessorSet;pub const LP = model.LP;pub const Cluster = model.Cluster;pub const Core = model.Core;pub const Package = model.Package;pub const Cache = model.Cache;pub const ProcessorRecord = model.ProcessorRecord;pub const Topology = model.Topology;pub const Error = model.Error;pub const computeCacheSets = model.computeCacheSets;pub const haveThreadingSupport = native.haveThreadingSupport;pub const totalLogicalProcessors = native.totalLogicalProcessors;pub const getThreadAffinity = native.getThreadAffinity;pub const setThreadAffinity = native.setThreadAffinity;pub const pinThreadToLogicalProcessor = native.pinThreadToLogicalProcessor;pub const init = native.init;pub const dataCaches = native.dataCaches;pub const testing = struct { pub const CpuListOptions: type = parsing.CpuListOptions; pub const parseCpuList = parsing.cpuList; pub const parseNumberWithOptionalSuffix = parsing.numberWithOptionalSuffix; pub const computeCacheSets = model.computeCacheSets;};Audit
| Definitions | 8 |
|---|---|
| Public names | 8 |
| Members | 22 |
| Version | 26.7.0 |
| Revision | daab053ee433 |