Skip to content

Check-in some changes to run the kernels correctly - #323

Open
Jackcuii wants to merge 50 commits into
masterfrom
kernel-submit
Open

Check-in some changes to run the kernels correctly#323
Jackcuii wants to merge 50 commits into
masterfrom
kernel-submit

Conversation

@Jackcuii

Copy link
Copy Markdown
Collaborator

No description provided.

Jackcuii and others added 30 commits March 29, 2026 09:05
- Add CgraRTL_relu4x4_test_from_yaml.py: ReLU kernel test on 4x4 Mesh CGRA
  using relu.yaml compiled kernel config (II=5, 32 iterations)
- Fix script_generator.py: swap STORE src_operands to match MemUnitRTL
  hardware expectation (in0=address, in1=data vs YAML order [data, addr])
…flag

Bug #1 - CrossbarRTL all-or-nothing: Stale prologued data blocked entire crossbar
- Mask recv_valid_vector, exclude prologued from send/recv_required_vector
- Gate changed: recv_valid_or_prologue_allowing_vector

Bug #2 - PhiRTL shared first flag: Multiple PHI_START on same tile failed
- Detect iteration wrap via ctrl_addr, clear s.first only at boundaries
- Added prev_ctrl_addr tracking

Tests: ReLU 379 cycles (pass), SpMV 759 cycles (pass)
@Jackcuii

Copy link
Copy Markdown
Collaborator Author

Update: The reason of CI test fail is the invalid var that Verilog not support

what is the invalid var you are referring to?

Oh sorry It is a typo, I mean char😂

@tancheng

Copy link
Copy Markdown
Owner

Hi @Jackcuii, can you resolve the comments if you have bandwidth? I would like to merge some register bank related fixes after yours: #322

Hi Sir Tan, I was working on it~ However I caught a fever yesterday 🥵. Hopefully I will be better and back tomorrow.

Ah, take care, get better soon!

Comment on lines +95 to +99
s.recv_data_from_routing_crossbar[i].rdy @= \
(s.inport_opt.operation == OPT_NAH) | \
(s.inport_opt.fu_in[i] == 0) | \
reg_towards_fu | \
s.send_data_to_fu[i].rdy

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yyan7223 does this make sense to you?

Comment thread noc/CrossbarRTL.py

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yyan7223 can you plz take a look at this change?

Comment thread mem/register_cluster/RegisterClusterRTL.py Outdated
Comment thread noc/CrossbarRTL.py Outdated
Comment thread noc/CrossbarRTL.py Outdated
Comment thread noc/CrossbarRTL.py Outdated
Comment thread noc/CrossbarRTL.py Outdated
Comment thread mem/register_cluster/RegisterClusterRTL.py Outdated
@tancheng

Copy link
Copy Markdown
Owner

Hi @Jackcuii, as long as you can resolve my comments, it should be okay to check in. Plz try to resolve them ASAP. Thanks!

@Jackcuii

Copy link
Copy Markdown
Collaborator Author

Hi @Jackcuii, as long as you can resolve my comments, it should be okay to check in. Plz try to resolve them ASAP. Thanks!

Okay~ I am checking in the logics the comments mentioned in the branch one by one to make sure all the yaml tests can still pass. It is somehow black-boxed😂

@tancheng

Copy link
Copy Markdown
Owner

Hi @Jackcuii, as long as you can resolve my comments, it should be okay to check in. Plz try to resolve them ASAP. Thanks!

Okay~ I am checking in the logics the comments mentioned in the branch one by one to make sure all the yaml tests can still pass. It is somehow black-boxed😂

I understand that. Can you then ask your agent to apply my suggestions to see whether it works?

@Jackcuii

Copy link
Copy Markdown
Collaborator Author

Sadly some comments will cause some tests to fail, I am working on it

@Jackcuii

Copy link
Copy Markdown
Collaborator Author

new TODO: merge #322 to this branch after folks' reviews

@tancheng

Copy link
Copy Markdown
Owner

new TODO: merge #322 to this branch after folks' reviews

I just merged it

@tancheng

tancheng commented Aug 8, 2026

Copy link
Copy Markdown
Owner

@Jackcuii I remember you mentioned that you would update the tests, and double-check the last one finished or not?

So then we can review again and merge this?

@Jackcuii

Jackcuii commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator Author

@Jackcuii I remember you mentioned that you would update the tests, and double-check the last one finished or not?

So then we can review again and merge this?

omg I just found I did not push all the commits 🤣 here they come.

Some logics have been changed to merge with main 🫠

Comment thread mem/register_cluster/RegisterBankRTL.py Outdated
@tancheng

Copy link
Copy Markdown
Owner

Hi @Jackcuii, #330 is merged, plz sync :-)

@tancheng

Copy link
Copy Markdown
Owner

Hi @Jackcuii, any update :-) ?

@Jackcuii

Jackcuii commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator Author

Hi @Jackcuii, any update :-) ?

Hi Sir Tan, the hacky logics are removed and tests are passed. But Yosys seems to fail this time ... checking

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to touch this folder?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me check it out, seems related to the Yosys check

Comment thread lib/messages.py
field_dict[kAttrReadRegIdx] = [RegIdxType for _ in range(num_fu_inports)]
# One means the next scheduled access to this register needs a live version.
# A feedback write replaces it; a predicated-away write leaves it unchanged.
field_dict[kAttrReadRegRetain] = [mk_bits(1) for _ in range(num_fu_inports)]

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new filed of read_reg_retain is suspicious... What is it used for? Can we avoid adding it?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any update on this @Jackcuii?

@Jackcuii Jackcuii Aug 24, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry Sir Tan I am moving to Swizterland these days... 🫠

It seems to be necessary:

read_reg_retain marks whether the register version read by the current ctrl
step has another scheduled reader before the next write. The register bank
only sees the current ctrl word, so without this information it cannot
distinguish a non-final read from the final read. Clearing on every read
breaks values shared by multiple ctrl steps, while never clearing blocks the
next write. The script generator computes this bit from the cyclic per-
register read/write order; it is not kernel-specific. We could avoid
exposing the field only by adding control-memory lookahead/reference
counting in hardware or by rewriting the schedule, both of which are
substantially more complex.

🤔 maybe need to dive into the register?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get what it wants to achieve. "Clearing on every read breaks values shared by multiple ctrl steps"...

in which scenario/kernel it needs this "fix"? We already and skid buffer in master and enable holding reg's consumption if current ctrl has other consumers..

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jackcuii Can we revert the register related change, and exclude the failed test? We can investigate the register related issue in a standalone PR. How does this sound?

@Jackcuii Jackcuii Aug 30, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It breaks GEMM and GEMV, others are good
#326
(To make sure we still have a all-pass version for AE, this old branch is kept)
I somehow know the reason (bad habit x_x, did not record it carefully when I debugged a few month ago)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, I still see _retain in #336. For #326, my intention is you can check in all changes from this PR except the changes related to the _retain...

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any update on #336 (review)?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Sir Tan I think the left _retains are leftover and not function at all. I just remove them :)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks! Can you also sync that PR with master for submission?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants