Skip to content

Simplify TileArray replacement and model typed buffers - #8

Merged
ShangkunLi merged 2 commits into
mainfrom
feature/type-system-modification
Sep 28, 2026
Merged

ShangkunLi merged 2 commits into
mainfrom
feature/type-system-modification

Conversation

@ShangkunLi

Copy link
Copy Markdown
Collaborator

Summary

This PR introduces an explicit type/value model for TileArray buffers and makes pattern-specific code responsible for replacement legality.

It adds:

  • SynapseType and SynapseValue base classes;
  • BufferType for shape and element type;
  • Buffer for symbolic program arguments;
  • BufferSlice for typed static selections such as A[:, k];
  • Buffer-based TileArray, frontend lowering, compiler, library, and test APIs.

It also simplifies PatternReplacer: patterns now define their own applicability and semantic preconditions, while the shared replacement path adapts buffer types, stages the generated kernel, and verifies the resulting IR.

Example

A = synl.Buffer("A", synl.i32[3, 4])

column = A[:, 1]

assert column.source is A
assert column.type == synl.i32[3]

value = synl.load(column, tile=array[0, 1])

The slice remains a frontend value. It lowers directly to the original buffer operand and configured element offsets:

%value = "neura.load"(%A) {
  constants = array<i64: 1, 5, 9>
}

@ShangkunLi ShangkunLi self-assigned this Sep 28, 2026
@ShangkunLi
ShangkunLi merged commit c45acc0 into main Sep 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants