Skip to documentation
SLOP

tiny.accy.kernel

Reference tiny.accy kernel

Defined in tiny.accy.

API (120)

Actions

Public operations.

Types and contracts

Public types and contracts.

Namespaces

Public namespaces.

Values and defaults

Public values and defaults.

No direct callersNo direct callstiny.accykernel
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/accy/src/kernel/call.zig:17

zig
pub const Options = struct {    target: []const u8,    version: u32 = 1,    format: ?gpu.ArtifactFormat = null,    kernel_plan: plan_mod.Options = .{},    element_count_argument: artifact_product.ElementCountArgument = .none,    shape_family_fingerprint: ?u64 = null,    shape_profile: ?artifact_product.KernelCallShapeProfile = null,    launch: ?artifact_product.KernelCallLaunch = null,    runtime_scalar_argument_count: u32 = 0,    static_arguments: []const choir_abi.ScalarArgument = &.{},};

Source: lib/accy/src/kernel/call.zig:30

zig
pub const OwnedArtifact = struct {    allocator: std.mem.Allocator,    artifacts: [1]artifact_product.KernelCallArtifact,    pub fn entry(self: *const OwnedArtifact) artifact_product.KernelCallArtifact {        return self.artifacts[0];    }    pub fn registry(self: *const OwnedArtifact) artifact_product.KernelCallRegistry {        return .{ .entries = self.artifacts[0..] };    }    pub fn fingerprint(self: *const OwnedArtifact) u64 {        const registry_value = self.registry();        return artifact_product.kernelCallRegistryFingerprint(&registry_value);    }    pub fn productStamp(self: *const OwnedArtifact) choir.product.incremental.ProductStamp {        return choir.product.incremental.productStamp(product_name, self.fingerprint());    }    pub fn deinit(self: *OwnedArtifact) void {        const allocator = self.allocator;        const artifact = &self.artifacts[0];        allocator.free(@constCast(artifact.target));        allocator.free(@constCast(artifact.entry_name));        if (artifact.shape_profile) |profile| artifact_product.deinitKernelCallShapeProfile(allocator, profile);        if (artifact.static_arguments.len != 0) allocator.free(@constCast(artifact.static_arguments));        deinitCompilePayload(allocator, artifact.payload);        self.* = undefined;    }};

Source: lib/accy/src/kernel/model/core/limits.zig:4

zig
pub const RawLimits = struct {    context: choir.ir.Context.Limits,    parameters: usize,    kernel_name_bytes: usize,    temporary_values: usize,    temporary_types: usize,    pub const standard: RawLimits = .{        .context = choir.ir.Context.Limits.standard,        .parameters = 64,        .kernel_name_bytes = 512,        .temporary_values = 64,        .temporary_types = 64,    };    pub const testing: RawLimits = .{        .context = choir.ir.Context.Limits.testing,        .parameters = 256,        .kernel_name_bytes = 2048,        .temporary_values = 256,        .temporary_types = 256,    };    pub const borrowed_standard: RawLimits = .{        .context = borrowedContextLimits(false),        .parameters = 64,        .kernel_name_bytes = 512,        .temporary_values = 64,        .temporary_types = 64,    };    pub const borrowed_testing: RawLimits = .{        .context = borrowedContextLimits(true),        .parameters = 256,        .kernel_name_bytes = 2048,        .temporary_values = 256,        .temporary_types = 256,    };};
Called byCallsNo direct callersprivate sourcelib.accy.src.kernel.calldeinitCompilePayloadkernel.OwnedKernelCallArtifactdeinit
Static calls · unresolved targets: 0 · external targets: 2.
Called byCallskernel.OwnedKernelCallArtifactproductStampkernel.OwnedKernelCallArtifactregistrykernel.OwnedKernelCallArtifactfingerprint
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callerskernel.OwnedKernelCallArtifactfingerprintkernel.OwnedKernelCallArtifactproductStamp
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callskernel.OwnedKernelCallArtifactfingerprintkernel.OwnedKernelCallArtifactregistry
Static calls · unresolved targets: 0 · external targets: 0.

Source: lib/accy/src/kernel/call.zig:104

zig
pub fn createArtifact(    allocator: std.mem.Allocator,    handle: gpu.BackendHandle,    program: *program_mod.Program,    options: Options,) !OwnedArtifact {    if (options.target.len == 0 or options.version == 0) return error.InvalidArtifact;    var authored_plan = try program.createCheckedPlan(allocator, options.kernel_plan);    defer authored_plan.deinit();    const caps = try handle.queryCapabilities();    const backend_kind = handle.backendKind() orelse caps.identity.backend;    const format = options.format orelse artifact_product.defaultArtifactFormat(backend_kind) orelse {        return error.UnsupportedOperation;    };    if (!caps.supportsArtifactFormat(format)) return error.UnsupportedArtifactFormat;    const geometry = launchGeometry(&authored_plan);    try caps.validateLaunchGeometry(geometry);    const compilation = try target.compileKernelForArtifactFormat(        allocator,        format,        authored_plan.entry_name,        program.kernelModule(),        compileOptions(format, geometry),    );    errdefer deinitCompilePayload(allocator, compilation.payload);    const owned_target = try allocator.dupe(u8, options.target);    errdefer allocator.free(owned_target);    const owned_entry_name = try allocator.dupe(u8, authored_plan.entry_name);    errdefer allocator.free(owned_entry_name);    const static_arguments = try compileStaticArguments(allocator, format, geometry, options.static_arguments);    errdefer if (static_arguments.len != 0) allocator.free(static_arguments);    const shape_family_fingerprint = options.shape_family_fingerprint orelse if (options.shape_profile) |profile| profile.fingerprint else null;    if (options.shape_profile) |profile| {        if (shape_family_fingerprint.? != profile.fingerprint) return error.InvalidArtifact;        try profile.validate(options.runtime_scalar_argument_count);    }    const shape_profile = if (options.shape_profile) |profile|        try artifact_product.duplicateKernelCallShapeProfile(allocator, profile)    else        null;    errdefer if (shape_profile) |profile| artifact_product.deinitKernelCallShapeProfile(allocator, profile);    return .{        .allocator = allocator,        .artifacts = .{.{            .target = owned_target,            .version = options.version,            .format = format,            .entry_name = owned_entry_name,            .argument_count = try compileArgumentCount(format, authored_plan.argument_count),            .shape_family_fingerprint = shape_family_fingerprint,            .shape_profile = shape_profile,            .required_dtypes = requiredDTypesForParams(authored_plan.params),            .required_features = gpu_codegen.featureRequirementsForModule(program.kernelModule()),            .required_subgroup = gpu_codegen.subgroupRequirementsForModule(program.kernelModule()),            .push_constants = compilation.push_constants,            .payload = compilation.payload,            .launch = options.launch orelse .{ .fixed = geometry },            .element_count_argument = options.element_count_argument,            .runtime_scalar_argument_count = options.runtime_scalar_argument_count,            .static_arguments = static_arguments,        }},    };}
Called byCallstest sourcelib.accy.src.kernel.calltest: kernel call artifact records at...private sourcelib.accy.src.kernel.callcompileArgumentCountprivate sourcelib.accy.src.kernel.callcompileOptionsprivate sourcelib.accy.src.kernel.callcompileStaticArgumentsprivate sourcelib.accy.src.kernel.calldeinitCompilePayloadprivate sourcelib.accy.src.kernel.calllaunchGeometryprivate sourcelib.accy.src.kernel.callrequiredDTypesForParamskernelcreateKernelCallArtifact
Static calls · unresolved targets: 0 · external targets: 16.

Source: lib/accy/src/kernel/call.zig:63

zig
pub fn createBackendArtifactFromEntry(    allocator: std.mem.Allocator,    handle: gpu.BackendHandle,    entry: artifact_product.KernelCallArtifact,    diagnostic_id: ?[]const u8,) !gpu.KernelArtifact {    const caps = try handle.queryCapabilities();    const scalar_argument_count = try entry.scalarArgumentCount();    var artifact = try gpu.KernelArtifact.init(allocator, .{        .backend = handle.backendKind() orelse caps.identity.backend,        .format = entry.format,        .entry_name = entry.entry_name,        .argument_count = entry.argument_count,        .scalar_argument_count = scalar_argument_count,        .diagnostic_id = diagnostic_id,        .interface = .{            .features = entry.required_features,            .subgroup = entry.required_subgroup,            .push_constants = entry.push_constants,        },    });    errdefer artifact.deinit();    switch (entry.payload) {        .text => |text| artifact.setBorrowedText(text),        .bytes => |bytes| artifact.setBorrowedBytes(bytes),        .words_u32 => |words| artifact.setBorrowedWords(words),        .none => return error.InvalidArtifact,    }    return artifact;}
Called byCallsNo direct callstest sourcelib.accy.src.kernel.calltest: kernel call entry materializes ...kernelcreateBackendArtifactFromKernelCallEn...
Static calls · unresolved targets: 0 · external targets: 8.

Source: lib/accy/src/kernel/call.zig:94

zig
pub fn launchGeometryForEntry(    entry: artifact_product.KernelCallArtifact,    runtime_arguments: []const choir_abi.ScalarArgument,) gpu.BackendError!choir_abi.LaunchGeometry {    return switch (entry.launch) {        .fixed => |geometry| geometry,        .derived => |derived| try derived.geometry(runtime_arguments),    };}
Called byCallsNo direct callstest sourcelib.accy.src.kernel.calltest: kernel call entry materializes ...kernelkernelCallEntryLaunchGeometry
Static calls · unresolved targets: 0 · external targets: 1.

Source: lib/accy/src/kernel/compile/execution.zig:11

zig
pub fn compileFragment(    allocator: std.mem.Allocator,    handle: gpu.BackendHandle,    graph: *program.Program,    options: FragmentCompilerOptions,) !*exec.CompiledFragment {    const artifact_start = nowNs();    const artifact_job = try artifact.createJob(        allocator,        handle,        graph,        artifactPlanOptions(options),    );    defer artifact_job.deinit();    try options.instrumentation.record(.plan_create_backend_artifacts, artifact_start);    return try exec.compileFragmentFromArtifactJob(allocator, artifact_job);}
Called byCallskernelcreateKernelArtifactkernel.artifactcreateJobprivate sourcelib.accy.src.kernel.compile.executionartifactPlanOptionsprivate sourcelib.accy.src.kernel.compile.executionnowNskernelcompileFragment
Static calls · unresolved targets: 0 · external targets: 3.

Source: lib/accy/src/kernel/compile/execution.zig:29

zig
pub fn createArtifact(    allocator: std.mem.Allocator,    handle: gpu.BackendHandle,    graph: *program.Program,    options: ArtifactOptions,) !gpu.KernelArtifact {    const compiled = try compileFragment(allocator, handle, graph, .{        .artifact_format = options.artifact_format,        .authored_kernel_diagnostic_id = options.authored_kernel_diagnostic_id,        .instrumentation = options.instrumentation,    });    defer compiled.deinit();    if (compiled.kernelCount() != 1) return error.InvalidArtifact;    return try exec.candidate.copyKernelArtifactToAllocator(        allocator,        compiled.artifactPlan().kernels.items[0].artifact,    );}
Called byCallsNo direct callerskernelcompileFragmentkernelcreateKernelArtifact
Static calls · unresolved targets: 0 · external targets: 4.

Source: lib/accy/src/kernel/dsl/program/root.zig:12

zig
pub fn Family(comptime definition: anytype) type {    return struct {        pub const name = definition.name;        pub const parameters = definition.parameters;        pub const Layout: type = parameter.Standard(parameters);        pub const Instance: type = definition.Instance;        pub const Limits: type = kernel.Limits;        pub fn arg(comptime name_value: anytype) usize {            return Layout.index(name_value);        }        pub fn schema() []const kernel.Param {            return parameter.schema(parameters);        }        pub fn build(allocator: std.mem.Allocator, limits: Limits, instance: Instance) !kernel.Graph {            return execute.buildInstanceSource(definition, instance, allocator, limits);        }        pub fn buildNamed(allocator: std.mem.Allocator, limits: Limits, graph_name: []const u8, instance: Instance) !kernel.Graph {            return execute.buildNamedInstanceSource(definition, graph_name, instance, allocator, limits);        }        pub fn interpret(allocator: std.mem.Allocator, limits: Limits, instance: Instance, initial: anytype) !execute.result(@TypeOf(initial)) {            return execute.interpretInstanceSource(definition, instance, allocator, limits, initial);        }        pub fn launch(allocator: std.mem.Allocator, limits: Limits, instance: Instance) !kernel.Launch {            var graph = try build(allocator, limits, instance);            defer graph.deinit();            return graph.launch();        }        pub fn scheduleSnapshot(allocator: std.mem.Allocator, limits: Limits, instance: Instance) !kernel.ScheduleSnapshot {            var graph = try build(allocator, limits, instance);            defer graph.deinit();            return graph.scheduleSnapshot(allocator);        }        pub fn createPlan(allocator: std.mem.Allocator, limits: Limits, instance: Instance, options: kernel.PlanOptions) !kernel.Plan {            var graph = try build(allocator, limits, instance);            defer graph.deinit();            return graph.createPlan(allocator, options);        }        pub fn createCheckedPlan(allocator: std.mem.Allocator, limits: Limits, instance: Instance, options: kernel.PlanOptions) !kernel.Plan {            var graph = try build(allocator, limits, instance);            defer graph.deinit();            return graph.createCheckedPlan(allocator, options);        }        pub fn compileFragment(            allocator: std.mem.Allocator,            limits: Limits,            instance: Instance,            handle: kernel.BackendHandle,            options: executable.FragmentCompilerOptions,        ) !*executable.CompiledFragment {            var graph = try build(allocator, limits, instance);            defer graph.deinit();            return kernel_compile.compileFragment(allocator, handle, &graph, options);        }        pub fn createKernelArtifact(            allocator: std.mem.Allocator,            limits: Limits,            instance: Instance,            handle: kernel.BackendHandle,            options: executable.KernelCompilerOptions,        ) !kernel.KernelArtifact {            var graph = try build(allocator, limits, instance);            defer graph.deinit();            return kernel_compile.createArtifact(allocator, handle, &graph, options);        }        pub fn createKernelCallArtifact(            allocator: std.mem.Allocator,            limits: Limits,            instance: Instance,            handle: kernel.BackendHandle,            options: kernel.KernelCallArtifactOptions,        ) !kernel.OwnedKernelCallArtifact {            var graph = try build(allocator, limits, instance);            defer graph.deinit();            return kernel.createKernelCallArtifact(allocator, handle, &graph, options);        }        pub fn runCpu(allocator: std.mem.Allocator, limits: Limits, instance: Instance, args: []const kernel.Argument) !void {            var graph = try build(allocator, limits, instance);            defer graph.deinit();            try graph.runCpu(allocator, args);        }        pub fn runCpuWithDiagnostic(            allocator: std.mem.Allocator,            limits: Limits,            instance: Instance,            args: []const kernel.Argument,            diagnostic: *kernel.ExecutionDiagnostic,        ) !void {            var graph = try build(allocator, limits, instance);            defer graph.deinit();            try graph.runCpuWithDiagnostic(allocator, args, diagnostic);        }        pub fn verify(allocator: std.mem.Allocator, limits: Limits, instance: Instance) !void {            var graph = try build(allocator, limits, instance);            defer graph.deinit();            try graph.verify();        }    };}
Called byCallsNo direct callersprivate sourcelib.accy.src.kernel.dsl.program.executebuildInstanceSourceprivate sourcelib.accy.src.kernel.dsl.program.executebuildNamedInstanceSourceprivate sourcelib.accy.src.kernel.dsl.program.executeinterpretInstanceSourcekernel.program.parameterschematiny.smggraphdeinitkernelFamily
Static calls · unresolved targets: 2 · external targets: 12.

Source: lib/accy/src/kernel/dsl/program/root.zig:8

zig
pub fn Program(comptime definition: anytype) type {    return Source(definition);}
Called byCallsNo direct callersprivate sourcelib.accy.src.kernel.dsl.program.rootSourcekernelProgram
Static calls · unresolved targets: 0 · external targets: 0.

Source: lib/accy/src/kernel/root.zig

zig
const gpu = @import("gpu");const model = @import("model/root.zig");pub const builder = model.core.builder;const call = @import("call.zig");pub const domain = model.core.domain;const dsl = @import("dsl/root.zig");const compile = @import("compile/root.zig");const interpret_mod = @import("interpret/root.zig");const library_mod = @import("library/root.zig");const limits = model.core;const logical_mod = @import("logical/root.zig");pub const oracle = @import("oracle/root.zig");pub const plan = model.plan;pub const program = @import("program/root.zig");pub const schedule = model.core.schedule;pub const typed = model.core.typed;pub const vector = model.core.vector;pub const view = model.core.view;pub const artifact = compile.artifact;pub const Param = builder.Param;pub const Buffer = builder.Buffer;pub const Type = builder.Type;pub const Kernel = builder.Kernel;pub const RawBuilder = builder.Builder;pub const RawStorage = builder.Storage;pub const Builder = program.Builder;pub const MmaShape = builder.MmaShape;pub const Value = builder.Value;pub const Block = builder.Block;pub const If = builder.If;pub const For = builder.For;pub const ForScope = builder.ForScope;pub const While = builder.While;pub const WhileScope = builder.WhileScope;pub const InsertionScope = builder.InsertionScope;pub const VerificationDiagnostic = builder.VerificationDiagnostic;pub const Plan = plan.Plan;pub const PlanOptions = plan.Options;pub const PlanError = plan.Error;pub const PlanVersion = plan.plan_version;pub const BackendHandle = gpu.BackendHandle;pub const KernelArtifact = gpu.KernelArtifact;pub const KernelCallArtifactOptions = call.Options;pub const OwnedKernelCallArtifact = call.OwnedArtifact;pub const Argument = oracle.Argument;pub const Scalar = oracle.Scalar;pub const ExecutionDiagnostic = oracle.ExecutionDiagnostic;pub const Graph = program.Program;pub const Program = dsl.Program;pub const Family = dsl.Family;pub const program_product_name = program.product_name;pub const interpret = interpret_mod;pub const library = library_mod;pub const logical = logical_mod;pub const DomainAxis = domain.DomainAxis;pub const Domain2D = domain.Domain2D;pub const Domain3D = domain.Domain3D;pub const Index1D = domain.Index1D;pub const VectorIndex1D = domain.VectorIndex1D;pub const Index2D = domain.Index2D;pub const Index3D = domain.Index3D;pub const BufferView = view.BufferView;pub const KeyBufferView = view.KeyBufferView;pub const TypedValue = typed.Value;pub const KeyValue = typed.KeyValue;pub const TypedVec2 = typed.Vec2;pub const TypedVec3 = typed.Vec3;pub const Vec2 = vector.Vec2;pub const Vec3 = vector.Vec3;pub const Guard = program.Guard;pub const Schedule = schedule.Schedule;pub const ScheduleError = schedule.ScheduleError;pub const Launch = schedule.Launch;pub const Limits = limits.Limits;pub const Capacity = program.Builder.Capacity;pub const RawLimits = limits.RawLimits;pub const RawCapacity = builder.Builder.Capacity;pub const RawUsage = builder.Storage.Usage;pub const RawExhaustion = builder.Storage.Exhaustion;pub const ScheduleLimits = schedule.ScheduleLimits;pub const ScheduleCapacity = schedule.ScheduleCapacity;pub const ScheduleUsage = schedule.ScheduleUsage;pub const ScheduleExhaustion = schedule.ScheduleExhaustion;pub const ScheduleSnapshotLimits = schedule.SnapshotLimits;pub const ScheduleSnapshotCapacity = schedule.SnapshotCapacity;pub const ScheduleSnapshotUsage = schedule.SnapshotUsage;pub const ScheduleSnapshotExhaustion = schedule.SnapshotExhaustion;pub const Axis = schedule.Axis;pub const AxisId = schedule.AxisId;pub const AxisStep = schedule.AxisStep;pub const BindTarget = schedule.BindTarget;pub const ScheduleSnapshot = schedule.Snapshot;pub const ScheduleSnapshotVersion = schedule.snapshot_version;pub const Split = schedule.Split;pub const Step = schedule.Step;pub const scalar = builder.scalar;pub const buffer = builder.buffer;pub const dynamicBuffer = builder.dynamicBuffer;pub const domainAxis = domain.domainAxis;pub const createPlan = plan.create;pub const createArtifactJob = artifact.createJob;pub const createArtifactPlan = artifact.createPlan;pub const createKernelCallArtifact = call.createArtifact;pub const createBackendArtifactFromKernelCallEntry = call.createBackendArtifactFromEntry;pub const kernelCallEntryLaunchGeometry = call.launchGeometryForEntry;pub const compileFragment = compile.compileFragment;pub const createKernelArtifact = compile.createArtifact;pub const argumentBuffer = oracle.argumentBuffer;pub const argumentBool = oracle.argumentBool;pub const argumentI32 = oracle.argumentI32;pub const argumentU32 = oracle.argumentU32;pub const argumentI64 = oracle.argumentI64;pub const argumentF32 = oracle.argumentF32;pub const argumentF64 = oracle.argumentF64;pub const Compare = builder.Compare;pub const Dimension = builder.Dimension;pub const AddressSpace = builder.AddressSpace;pub const MemoryOrder = builder.MemoryOrder;pub const Scope = builder.Scope;pub const WarpOpKind = builder.WarpOpKind;

Source: lib/accy/src/root.zig:88

zig
pub const kernel = @import("kernel/root.zig");

Also reachable as

kernel.library.random.base.kernel.

Audit

Definitions92
Public names93
Members17
Version26.7.0
Revisiondaab053ee433