srdatalog.ir.codegen.cuda.schema

Schema types for C++ codegen.

Describes the per-program relation declarations that drive the emitted C++ using aliases (RelationSchema, Database, SemiNaiveDatabase). Ported from mhk’s python-api-notemplate branch nt_schema.py; independent of MIR types, so nothing here couples back to mir_types.

Two emission formats exist:

  • str(schema) — plain alias list, used by the orchestrator today.

  • schema.get_batch_prelude(name) — same aliases plus the Database / SemiNaiveDatabase typedefs, used at the top of each JIT batch file.

Module Contents

Classes

FactDefinition

A schema-declared relation. name must match the relation name used by MIR nodes (InsertInto.rel_name, ColumnSource.rel_name, …). params is the column type tuple, e.g. [int, int] for an arity-2 int-valued relation.

Pragma

Fact pragmas. INPUT carries the CSV filename to load from (required for load_data() in the FFI wrapper). PRINT_SIZE and SEMIRING are bool.

SchemaDefinition

All relations used by a program. Order matters for the emitted AST::Database<...> template argument list.

API

class srdatalog.ir.codegen.cuda.schema.FactDefinition[source]

A schema-declared relation. name must match the relation name used by MIR nodes (InsertInto.rel_name, ColumnSource.rel_name, …). params is the column type tuple, e.g. [int, int] for an arity-2 int-valued relation.

__str__() str[source]
name: str

None

params: list[type]

None

pragmas: dict[srdatalog.ir.codegen.cuda.schema.Pragma, Any]

‘field(…)’

class srdatalog.ir.codegen.cuda.schema.Pragma(*args, **kwds)[source]

Bases: enum.Enum

Fact pragmas. INPUT carries the CSV filename to load from (required for load_data() in the FFI wrapper). PRINT_SIZE and SEMIRING are bool.

Initialization

INPUT

‘input’

PRINT_SIZE

‘print_size’

SEMIRING

‘semiring’

class srdatalog.ir.codegen.cuda.schema.SchemaDefinition[source]

All relations used by a program. Order matters for the emitted AST::Database<...> template argument list.

__str__() str[source]
facts: list[srdatalog.ir.codegen.cuda.schema.FactDefinition]

None

get_batch_prelude(name: str) str[source]

Header block emitted at the top of a JIT batch file: per-relation aliases plus the blueprint / device-DB typedefs keyed on name.