Hi everyone,
For my project, I need to add a custom instruction to RISCV in Gem5 that
loads 2 sets of 128 elements (32-bit float) from the memory, computes the
dot product, and stores them back to the memory. A starting point is using
the RISCV vector instructions, but I want to reduce the instruction count
and have only one instruction doing all these operations. So I was checking
the vector .isa (decoder, memory, arith) files to get an idea of how to
merge vle32, vadd_vv, vredsum.vs, and vse32 into a single instruction, but
it looks a bit complicated to me and still couldn't figure out how I should
modify it.
I would appreciate it if anyone could give me some pointers on starting
this or which files I need to check and modify.
Thank you!
Hi,
These are a few pointers on how to start modifying the RVV implementation.
The previous gem5 bootcamp has details on how to implement instructions
in gem5, and examples of implementing RISCV P extension,
https://youtube.com/watch?v=Z5B02jkNpck&list=PL_hVbFs_loVSaSDPr1RJXP5RRFWjBMqq3&index=11&pp=iAQB
.
The .isa files you're looking at contain the templates for generating the
actual instruction. The instruction will be compiled to a couple of .cc and
.hh files before being compiled and linked to the gem5.opt executable. In
the case of riscv, you can find those generated files in
build/RISCV/arch/riscv/generated/.
Typically, implementing an instruction will require implementing the
decoder method, and execute method; and for memory instructions, you'll
need to implement initiateAcc and completeAcc methods.
There are a few RVV memory instructions that are more complicated than
other instructions (e.g. those scatter store/ gather load instructions).
Those instructions act as a macro instructions spawning more micro
instructions to perform loads/stores, which is necessary as the elements
can be in different cache blocks. If you'd like to start with a simple
implementation, I think you can start from by mimicking the implementation
of simpler instructions in gem5's rvv implementation, like vadd_vv.
Regards,
Hoa Nguyen
On Sat, Dec 23, 2023, 10:05 zahra butool via gem5-users gem5-users@gem5.org
wrote:
Hi everyone,
For my project, I need to add a custom instruction to RISCV in Gem5 that
loads 2 sets of 128 elements (32-bit float) from the memory, computes the
dot product, and stores them back to the memory. A starting point is using
the RISCV vector instructions, but I want to reduce the instruction count
and have only one instruction doing all these operations. So I was checking
the vector .isa (decoder, memory, arith) files to get an idea of how to
merge vle32, vadd_vv, vredsum.vs, and vse32 into a single instruction, but
it looks a bit complicated to me and still couldn't figure out how I should
modify it.
I would appreciate it if anyone could give me some pointers on starting
this or which files I need to check and modify.
Thank you!
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-leave@gem5.org