Conversation
A dtype-generic field operator can now be called from a concrete `@program`, including at several dtypes in one program. - Type-checking: `return_type_fieldop` and `function_signature_incompatibilities_fieldop` bind the operator's type variables from the concrete call arguments and substitute before the existing checks (so zero-dim promotion only ever sees concrete types). - Lowering: a new PAST pass `monomorphize_generic_calls` binds each call site, name-mangles the callee per binding (e.g. `diff__FloatT_float32`), and replaces the generic closure callable with concrete specializations via a new `GTCallable.__gt_specialize__(binding, name)` (implemented by `FieldOperator` and `ItirShim` using the `SpecializeTypeVars` FOAST pass + rename). Two bindings of one operator become two GTIR `FunctionDefinition`s. Calling a generic operator from another operator remains a follow-up. Verified across the backend matrix incl. GPU (a program instantiating one operator at float32 and float64).
havogt
force-pushed
the
dtype-generics-3-field-operators
branch
from
June 16, 2026 14:54
b5b9169 to
99c0abf
Compare
havogt
force-pushed
the
dtype-generics-4-programs
branch
from
June 16, 2026 14:54
88ec8c3 to
0ad328b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack 4/4 — dtype-generic field operators. Base: `dtype-generics-3-field-operators` (#64).
A dtype-generic field operator can now be called from a concrete `@program`, including at
several dtypes in one program.
bind the operator's type variables from the concrete call arguments and substitute before
the existing checks (so zero-dim promotion only ever sees concrete types — this also obviated
a separately-planned `promote_zero_dims` change).
the callee per binding (e.g. `diff__FloatT_float32`), and replaces the generic closure
callable with concrete specializations via a new `GTCallable.gt_specialize(binding, name)`
(implemented by `FieldOperator` and `ItirShim` using the `SpecializeTypeVars` FOAST pass +
rename). Two bindings of one operator become two GTIR `FunctionDefinition`s.
Calling a generic operator from another operator remains a follow-up. Verified across the
backend matrix incl. GPU (a program instantiating one operator at float32 and float64).
Stacked: 1 (#62) → 2 (#63) → 3 (#64) → 4 this. Review/merge in order; this is the tip.