Add GEP RTL support for 1D and 2D address generation#280
Merged
ShangkunLi merged 3 commits intotancheng:masterfrom Mar 31, 2026
Merged
Add GEP RTL support for 1D and 2D address generation#280ShangkunLi merged 3 commits intotancheng:masterfrom
ShangkunLi merged 3 commits intotancheng:masterfrom
Conversation
tancheng
approved these changes
Mar 30, 2026
Collaborator
|
LGTM! Thank you so much Shangkun~ |
Jackcuii
approved these changes
Mar 30, 2026
tancheng
reviewed
Mar 30, 2026
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.
Thanks for the Claude Code!
Overview
Implements the
GepRTLfunctional unit for GetElementPtr (GEP) operations. 1D and 2D address generation are handled directly in RTL; decomposition of 3D/4D+ into basic 1D/2D with additionalmul/shiftis left to the compiler pass.Changes
lib/opt_type.py— 4 new opcodes:OPT_GEPresult = base(in0) + index(in1)OPT_GEP_CONSTresult = base(const) + index(in0)OPT_GEP_2Dresult = base(in0) + index0(in1) * stride + index1(in2)OPT_GEP_2D_CONSTresult = base(const) + index0(in0) * stride + index1(in1)lib/cmd_type.py— 1 new command:CMD_CONFIG_GEP_STRIDE(43): pre-configures the stride register in the GEP FU viarecv_from_ctrl_membefore execution, following the same CMD-based configuration pattern used inLoopCounterRTL.fu/single/GepRTL.py(new): implements all four GEP variants. The 2D stride is stored in a per-FU register latched onCMD_CONFIG_GEP_STRIDE. Theconst_queueis used for the base address in*_CONSTvariants.fu/single/test/GepRTL_test.py(new): 20 test cases covering:(base, index)combinations