Skip to content

Rgiunti/nkunhi/fix indexed instructions - #121

Merged
rgiunti merged 20 commits into
pulp-platform:mainfrom
FondazioneChipsIT:rgiunti/nkunhi/fix-indexed_instruct
Jul 30, 2026
Merged

Rgiunti/nkunhi/fix indexed instructions#121
rgiunti merged 20 commits into
pulp-platform:mainfrom
FondazioneChipsIT:rgiunti/nkunhi/fix-indexed_instruct

Conversation

@rgiunti

@rgiunti rgiunti commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Problem

  • Index mismatch (indexed instructions) in fft kernel (indexed instructions) main not recognized by the benchmark test which does not return a failure

  • New indexed instructions test cases have been added to trigger more corner cases:

    • eew_dest != eew_indexes data are managed in multiple VRF words while indexes in just a single word and viceversa
    • for doublebw configuration: cases in which interfaces have to deal with different number of bytes

Since adding these new kinds of test cases on top of the modifications required for fixing the fft kernel issue produced errors, a proper refactor and fix of the VLSU is proposed in this PR.

Main changes

These new or refactored signals manage the memory address generation and load/store cycle:

  • idx_gbyte: each memory port/FU now computes the global byte position of its next index inside the index vector. It is needed for deriving needed VRF word, the offset inside that word, and the per-port index budget. Before, these were computed by separate arithmetics (global consumed-bytes counter, MAXEW-based shifts, round-robin budget split).
  • mem_idx_word: computes the necessary VRF word given the idx_gbyte. Memory requests are issued only when the needed word is the one that is currently fetched. Before, a port could issue with the wrong word fetched and read another port's index.
  • mem_idx_word_ok: comparison between the needed VRF word mem_idx_word and vs2_elem_id which is the currently fetched VRF word.
  • word_index: offset inside the fetched VRF word.
  • mem_idx_vrf_fetch_pending: bytes of indexes that still have to be consumed by a specific port.
  • vs2_elem_id advance: the fetched index word advances only when at least one port still has indexes to consume and no pending port needs the current word.

For doublebw configuration, the same changes have been applied to the spatz_doublebw_vlsu with some differences to remark:

  • Interface split of bytes: the total number of bytes to be processed are splitted among the 2 interfaces. Memory-side counters, commit-side counters and address generation now use the same consistent split. This replaces messy inline expressions.
  • idx_split_bytes: byte offset of interface 1's first index, computed correctly in both directions (eew_idx < eew_dest and eew_idx > eew_dest). The old code only right-shifted by vsew - ew, which is a negative shift when the index is wider than the data.
  • Shared-word borrow: when the two interfaces need the same index word, interface 1 never wins arbitration. mem_idx_word_ok lets interface 1 consume indexes from interface 0's fetched word, use_upper_fu (select idx_stream half) becomes per-FU and derived from the address match instead of a static comparison.

Other changes

  • fix for sa_gemv tests
  • removal of tests spatzBenchmarks-rtl-hp-fmatmul_M128_N128_K128 and spatzBenchmarks-rtl-sdotp-hp-fmatmul_M128_N128_K128 from spatzbenchmark CmakeList

@rgiunti
rgiunti force-pushed the rgiunti/nkunhi/fix-indexed_instruct branch 4 times, most recently from 1707f6f to f67f84d Compare July 24, 2026 08:15
@Navaneeth-KunhiPurayil

Copy link
Copy Markdown
Contributor

So this is the only test that is failing in the double bw config -
spatzBenchmarks-rtl-hp-sa-gemv_M128_N4096_K512 rest all seems to be fine.

@rgiunti
rgiunti force-pushed the rgiunti/nkunhi/fix-indexed_instruct branch from edc3c07 to a724deb Compare July 30, 2026 07:39

@Navaneeth-KunhiPurayil Navaneeth-KunhiPurayil left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

With the chaining fix commit the sa-gemv kernel can also pass.
Also the fconv2d bug in existing main also can pass now in questasim.

@DiyouS

DiyouS commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Is PR 108 contained in this PR? Or we are just fixing the problems exposed by PR 108 here? If so we can close PR108 after this one is merged

@Navaneeth-KunhiPurayil

Copy link
Copy Markdown
Contributor

Yeah PR 108 can be deleted

Comment thread hw/ip/spatz/src/spatz_vlsu.sv
DiyouS
DiyouS previously approved these changes Jul 30, 2026
Comment thread hw/ip/spatz/src/spatz_vlsu.sv Outdated
Comment thread hw/ip/spatz/src/spatz_vlsu.sv
@rgiunti
rgiunti dismissed stale reviews from DiyouS and Navaneeth-KunhiPurayil via cac2e90 July 30, 2026 09:49

@Navaneeth-KunhiPurayil Navaneeth-KunhiPurayil left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@DiyouS DiyouS left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@rgiunti
rgiunti merged commit 95f2e11 into pulp-platform:main Jul 30, 2026
3 checks passed
@DiyouS DiyouS mentioned this pull request Jul 31, 2026
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.

4 participants