Skip to content

Support for eew!=sew cases for unitstride/strided load instructions#73

Open
akifejaz wants to merge 12 commits intochipsalliance:mainfrom
akifejaz:main
Open

Support for eew!=sew cases for unitstride/strided load instructions#73
akifejaz wants to merge 12 commits intochipsalliance:mainfrom
akifejaz:main

Conversation

@akifejaz
Copy link

@akifejaz akifejaz commented Jun 21, 2025

This MR includes Unit Stride/Stride Load templates fixes for generating EEW!=SEW test cases as discussed in #72

This is my first PR & I've tried my best to follow the flow of code to match with rest of the templates. In case of any issues please let me know, I'll be happy to assist.

Best,
Akif

@ksco
Copy link
Collaborator

ksco commented Jun 23, 2025

CI is not happy.

@akifejaz
Copy link
Author

CI is not happy.

Let me fix this separately in another PR, updating this PR for only load instructions.

@akifejaz akifejaz changed the title Support for eew!=sew cases for unitstride/strided load/store instructions Support for eew!=sew cases for unitstride/strided load instructions Jun 24, 2025
@akifejaz
Copy link
Author

Hi @ksco, This PR is ready please review.

if int(sew) > int(float64(i.Option.XLEN)*float64(c.LMUL)) {
continue
}
emul := (float64(c.SEW) / float64(sew)) * float64(c.LMUL) * float64(nfields)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not emul.

if emul > 8 || emul < 1./8 {
continue
}
emul = math.Max(emul, 1) // offset lmul
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not used.

builder.WriteString(i.gLoadDataIntoRegisterGroup(vd+(nf*int(c.LMUL1)), c.LMUL1, c.SEW))
}
builder.WriteString(i.gWriteIntegerTestData(c.LMUL1*LMUL(nfields), c.SEW, 0))
var sew SEW = 8 // sew is data width, c.SEW is offset width
Copy link
Collaborator

Choose a reason for hiding this comment

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

there is no offset width in unit-stride and constant-stride instructions.

builder.WriteString(i.gWriteRandomData(LMUL(1)))
builder.WriteString(i.gLoadDataIntoRegisterGroup(0, LMUL(1), SEW(32)))

vd := int(c.LMUL1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't understand why there are so many changes in the following code. When SEW != EEW, there is only 1 thing changed, which is the EMUL.

for nf := 0; nf < nfields; nf++ {
builder.WriteString(i.gStoreRegisterGroupIntoResultData(vd+(nf*int(c.LMUL1)), c.LMUL1, c.SEW))
builder.WriteString(i.gMagicInsn(vd+(nf*int(c.LMUL1)), c.LMUL1))
var sew SEW = 8 // sew is data width, c.SEW is offset width
Copy link
Collaborator

Choose a reason for hiding this comment

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

there is no offset width in unit-stride and constant-stride instructions.

if int(sew) > int(float64(i.Option.XLEN)*float64(c.LMUL)) {
continue
}
emul := (float64(c.SEW) / float64(sew)) * float64(c.LMUL) * float64(nfields)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not emul.

if emul > 8 || emul < 1./8 {
continue
}
emul = math.Max(emul, 1) // offset lmul
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not used.

builder.WriteString(i.gWriteRandomData(LMUL(1)))
builder.WriteString(i.gLoadDataIntoRegisterGroup(0, LMUL(1), SEW(32)))

vd := int(c.LMUL1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't understand why there are so many changes in the following code. When SEW != EEW, there is only 1 thing changed, which is the EMUL.

@akifejaz
Copy link
Author

Thanks for review, let me fix these.

@ksco
Copy link
Collaborator

ksco commented Aug 6, 2025

ping

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