Skip to content

VLEN32 Support - #88

Open
gregdavill wants to merge 4 commits into
chipsalliance:mainfrom
gregdavill:vlen32-support
Open

gregdavill wants to merge 4 commits into
chipsalliance:mainfrom
gregdavill:vlen32-support

Conversation

@gregdavill

Copy link
Copy Markdown

The vector spec defines Zve32x with minimum VLEN of 32.

It would be good for this generator to support this configuration.
The main change is just using .word rather than .quad for testdata.

Then a small adjustment to the patch code to not match .word within testdata.

@nadime15

nadime15 commented May 6, 2026

Copy link
Copy Markdown
Contributor

@gregdavill could you update CI to run a few tests with VLEN=32? See

@nadime15 nadime15 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.

General observation:

This will likely break test generation for some cases when VLEN == 32. The issue is that combinations currently uses XLEN to filter invalid SEW values. However, some configurations are constrained by XLEN (e.g. vslide1up), while many others are actually constrained by VLEN as well (or rather by Zve32x, Zve64x, etc.). As a result, filtering based on XLEN is not enough.

Example:

func (i *Insn) combinations(lmuls []LMUL, sews []SEW, masks []bool, rms []RM) []combination {
	res := make([]combination, 0)
	for _, lmul := range lmuls {
		if i.EGW > 0 && int(float64(lmul)*float64(i.Option.VLEN)) < i.EGW {
			continue
		}
		for _, sew := range sews {
			if int(i.Option.XLEN) < int(sew) {
				continue
			}

The same issue likely exists in vsetvlicombinations().

The current test generation approach feels fragile. It is easy to miss edge cases because constraints are scattered across multiple parameters (XLEN, VLEN, instruction specific rules, etc.).

One possible improvement would be to define constraints per instruction which explicitly declares SEWs, LMULs, etc., (for rather for a given instruction and extension) and then a single generator that applies them. it would make correctness much easier to reason about, especially when validating configurations across different extension sets (Zve32x, Zve64x, V, etc.). The cool thing about this is that someone could intentionally generate invalid combinations as well, to test their vector engine further.

@gregdavill

Copy link
Copy Markdown
Author

I've added this config to the CI.
The run looks clean: https://github.com/gregdavill/riscv-vector-tests/actions/runs/26074365858

I can see that brittleness becoming an issue. I guess I've sidestepped many of these by excluding the XLEN==64,VLEN==32 in the configuration matrix.

This seems like a sensible stepping stone to add this config, while constraining the scope of this PR.

@gregdavill

Copy link
Copy Markdown
Author

Are there specific issues open that should be fixed before this can be considered?
Or other changes specifically on this PR I should do?

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.

2 participants