Skip to documentation
SLOP

tiny.accy.kernel.interpret.surface

Reference tiny.accy kernel interpret surface

Defined in kernel.interpret.

API (6)

Actions

Public operations.

Types and contracts

Public types and contracts.

Values and defaults

Public values and defaults.

No direct callersNo direct callskernel.interpretsurface
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Called byCallstest sourcelib.accy.src.kernel.interpret.surfacetest: kernel interpret Layer covers t...private sourcelib.accy.src.kernel.interpret.surfaceassertExclusionsReferToBuilderMethodskernel.interpret.surfaceexclusionprivate sourcelib.accy.src.kernel.interpret.surfaceisFnDeclkernel.interpret.surfaceassertLayerCoversBuilder
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callskernel.interpret.surfaceassertLayerCoversBuilderkernel.interpret.surfacesupportstest sourcelib.accy.src.kernel.interpret.surfacetest: kernel interpret Layer covers t...kernel.interpret.surfaceexclusion
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallstest sourcelib.accy.src.kernel.interpret.surfacetest: kernel interpret Layer covers t...private sourcelib.accy.src.kernel.interpret.surfaceDefaultLayerkernel.interpret.surfaceexclusionprivate sourcelib.accy.src.kernel.interpret.surfaceisFnDeclkernel.interpret.surfacesupports
Static calls · unresolved targets: 0 · external targets: 0.

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

zig
pub const surface = @import("surface.zig");

Source: lib/accy/src/kernel/interpret/surface.zig

zig
const std = @import("std");const policy = @import("policy.zig");const program = @import("../program/root.zig");const spec = @import("spec.zig");pub const ExclusionKind = enum {    lifecycle,    diagnostic_finish,    schedule_construction,};pub const Exclusion = struct {    name: []const u8,    kind: ExclusionKind,};pub const excluded_methods = [_]Exclusion{    .{ .name = "init", .kind = .lifecycle },    .{ .name = "deinit", .kind = .lifecycle },    .{ .name = "finishWithDiagnostic", .kind = .diagnostic_finish },    .{ .name = "axis", .kind = .schedule_construction },    .{ .name = "split", .kind = .schedule_construction },    .{ .name = "bind", .kind = .schedule_construction },    .{ .name = "vectorize", .kind = .schedule_construction },    .{ .name = "unroll", .kind = .schedule_construction },};pub fn exclusion(comptime name: []const u8) ?Exclusion {    inline for (excluded_methods) |item| {        if (std.mem.eql(u8, item.name, name)) return item;    }    return null;}pub fn supports(comptime name: []const u8) bool {    return isFnDecl(program.Builder, name) and exclusion(name) == null and @hasDecl(DefaultLayer(), name);}pub fn assertLayerCoversBuilder(comptime LayerType: type) void {    assertExclusionsReferToBuilderMethods();    inline for (@typeInfo(program.Builder).@"struct".decl_names) |decl_name| {        if (!isFnDecl(program.Builder, decl_name)) continue;        if (exclusion(decl_name) != null) continue;        if (!@hasDecl(LayerType, decl_name)) {            @compileError("kernel.interpret.Layer missing typed builder method: " ++ decl_name);        }    }}fn DefaultLayer() type {    return spec.Layer(*program.Builder, struct {}, policy.lower);}fn assertExclusionsReferToBuilderMethods() void {    inline for (excluded_methods) |item| {        if (!isFnDecl(program.Builder, item.name)) {            @compileError("kernel.interpret surface exclusion is not a typed builder method: " ++ item.name);        }    }}fn isFnDecl(comptime Type: type, comptime name: []const u8) bool {    if (!@hasDecl(Type, name)) return false;    return switch (@typeInfo(@TypeOf(@field(Type, name)))) {        .@"fn" => true,        else => false,    };}test "kernel interpret Layer covers typed builder body surface" {    assertLayerCoversBuilder(DefaultLayer());    try std.testing.expect(supports("forScope"));    try std.testing.expect(supports("tan"));    try std.testing.expect(exclusion("axis").?.kind == .schedule_construction);}

Audit

Definitions7
Public names9
Members5
Version26.7.0
Revisiondaab053ee433