Merged
Conversation
…ly grab local id for yaml and asm file, modify the test file with reg id
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the Neura architecture and code generation pipeline by introducing local register identifiers alongside global IDs, expanding LLVM-to-Neura operation conversion patterns, and adding compiled initiation interval (II) tracking in array configurations.
Key changes:
- Introduced
local_idproperty for registers to provide per-tile local register identification separate from global IDs - Added five new LLVM-to-Neura conversion patterns (XOR→OR, AND→MUL, FNeg→FSub, LShr→Shl, Select→arithmetic ops)
- Added
compiled_iifield to array configurations with corresponding YAML and ASM output support
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| include/NeuraDialect/Architecture/Architecture.h | Added local_id member and getter/setter methods to Register class |
| lib/NeuraDialect/Architecture/Architecture.cpp | Updated Register constructor to accept local_id; modified register creation to assign both global and local IDs |
| lib/NeuraDialect/Mapping/MappingState.cpp | Enhanced mapping state encoding to include both global and local register IDs in dictionary output |
| lib/NeuraDialect/Transforms/GenerateCodePass.cpp | Modified code generation to use local_register_id; added compiled_ii support to ArrayConfig and output functions |
| lib/Conversion/LlvmToNeura/LlvmToNeuraPass.cpp | Added five new conversion patterns and registered them in the conversion pipeline |
| test/neura/ctrl/branch_for.mlir | Updated test expectations to include compiled_ii field |
| test/mapping_quality/branch_for.mlir | Updated test expectations to include compiled_ii field |
| test/e2e/histogram/histogram_kernel.mlir | Updated test expectations to include local_register_id attributes and adjusted ASM output expectations |
| test/e2e/fir/fir_kernel_vec.mlir | Updated test expectations to include local_register_id attributes and adjusted ASM output expectations |
| test/e2e/fir/fir_kernel.mlir | Updated test expectations to include local_register_id attributes and adjusted ASM output expectations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Collaborator
Author
|
I forgot I have added some conversion rules to the pass. Let me fix that. |
- Removed LlvmXOrToNeuraOr conversion rule - Removed LlvmAndToNeuraMul conversion rule - Removed LlvmFNegToNeuraFSub conversion rule - Removed LlvmLShrToNeuraShl conversion rule - Removed LlvmSelectToNeuraOps conversion rule - Removed corresponding pattern registrations These rules were added for FFT testing and are not needed in the main codebase.
tancheng
reviewed
Oct 23, 2025
- Add per_tile_register_id field to Register class - Update MappingState to output both global ID and per_tile_register_id - Modify GenerateCodePass to use local register IDs in ASM/YAML output - Add compiled_ii information to YAML and ASM output - Update test files to expect per_tile_register_id and local register IDs - Refactor Architecture.cpp to remove recreateRegisterFileCluster and enhance createRegisterFileCluster
13c1a0b to
d9d79e7
Compare
Remove commented-out FFT-related conversion rules from LlvmToNeuraPass.cpp to keep codebase clean
tancheng
approved these changes
Oct 23, 2025
tancheng
reviewed
Oct 23, 2025
tancheng
approved these changes
Oct 23, 2025
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.
This pull request introduces several improvements and extensions to the Neura architecture and code generation pipeline. The main changes are the addition of a
local_idproperty for registers to distinguish local register identifiers from global ones, updates to register creation and usage to support local IDs, enhancements to mapping and code generation to track and use local register IDs, and the addition of new LLVM-to-Neura operation conversion patterns. It also adds support for including the compiled initiation interval (compiled_ii) in array configuration outputs.Register ID improvements:
local_idproperty to theRegisterclass, updated its constructor, and provided getter/setter methods. Register creation now assigns both global and local IDs, making register identification more robust. (include/NeuraDialect/Architecture/Architecture.h,lib/NeuraDialect/Architecture/Architecture.cpp) [1] [2] [3] [4] [5]lib/NeuraDialect/Mapping/MappingState.cpp)Code generation and mapping updates:
local_register_idinstead of global IDs when collecting and mapping register steps, ensuring correct local register references in output. (lib/NeuraDialect/Transforms/GenerateCodePass.cpp) [1] [2]LLVM-to-Neura operation conversion:
lib/Conversion/LlvmToNeura/LlvmToNeuraPass.cpp) [1] [2]Array configuration and output enhancements:
compiled_iifield toArrayConfig, updated output routines to include it in YAML and ASM files if available, and provided a helper to extract it from function attributes. (lib/NeuraDialect/Transforms/GenerateCodePass.cpp) [1] [2] [3] [4] [5] [6]