Migrate scalar builtin types to generated TypeDef assembly format ownership - #147
Merged
Merged
Conversation
…ership Agent-Logs-Url: https://github.com/jonathanvdc/MLIR.NET/sessions/3b71b6cc-323a-470e-b500-22499938205c Co-authored-by: jonathanvdc <9839946+jonathanvdc@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Migrate scalar builtin types to generated TypeDef ownership
Migrate scalar builtin types to generated TypeDef assembly format ownership
Apr 16, 2026
jonathanvdc
marked this pull request as ready for review
April 16, 2026 02:34
jonathanvdc
approved these changes
Apr 16, 2026
TableGen Interpreter BenchmarksCommit:
Interpretation:
|
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.
Scalar builtin types (float, index, none) had split ownership: generated
TypeDefclasses existed and were registered, but binding still went through hand-written factory delegates andFloatTypeReferenceheld a catch-allTypeDefinition = new("float"). This completes the migration so generatedTypeDefdefinitions own scalar binding end-to-end via assembly formats, matching the pattern already established byIntegerType.New assembly format classes
BuiltinIndexTypeAssemblyFormat— bindsBuiltinIndexTypeSyntax→IndexTypeBuiltinNoneTypeAssemblyFormat— bindsBuiltinNoneTypeSyntax→NoneTypeBuiltinScalarFloatTypeAssemblyFormat— shared format parameterized by a constructor delegate; handles all 18 float variants without per-type subclassesMetadata-driven generation
BuiltinTypesExtensions.tdnow suppliescsharpAssemblyFormatfor all scalar float types plusBuiltin_IndexandBuiltin_None. The generator (TypeEmitter) uses this metadata to:"f32") rather than the qualified registry key ("builtin.f32")Binder registry lookup
Binder.GetStructuredTypeDefinitionNamenow maps scalar syntax to"builtin.integer","builtin.f32","builtin.index","builtin.none", etc., so the registry lookup resolves correctly to the generated builtinTypeDefinition.FloatTypeReference cleanup
Removed the catch-all
TypeDefinition = new("float")static property. The base class now returnsnullforDefinition; generated subclasses override with their ownTypeDefinition. Fallback-boundFloatTypeReferencevalues (no registry) thus haveDefinition == null.Test coverage
"builtin.integer"lookup keyDefinition; fallback float →Definition == null; all generated scalarTypeDefinitions haveAssemblyFormat != null; registered and fallback scalar types compare equal