Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are P* extensions supported ? #1291

Closed
manju1205 opened this issue Jul 10, 2023 · 16 comments
Closed

Are P* extensions supported ? #1291

manju1205 opened this issue Jul 10, 2023 · 16 comments

Comments

@manju1205
Copy link

I am getting below error ::

Assembler messages:
Error: cannot find default versions of the ISA extension p' /tmp/ccKNSLNd.s:3: Error: cannot find default versions of the ISA extension p'

I have used below build commands::

./configure --prefix=$RISCV --with-arch=rv32gp --with-abi=ilp32
make

@TommyMurphyTM1234
Copy link
Collaborator

I'm not sure if anything has changed since this?

@kito-cheng
Copy link
Collaborator

Not supported, this repo are using upstream GNU toolchain source tree, and upstream GNU toolchain not supported yet since it never get ratified, but you could use external GCC and binutils source tree from PLCT or Andes https://github.com/andestech/gcc.

@TommyMurphyTM1234
Copy link
Collaborator

I'm not sure if anything has changed since this?

In case it helps this worked for me:

git clone https://github.com/riscv-collab/riscv-gnu-toolchain issue-1291
cd issue-1291
git clone https://github.com/plctlab/riscv-gcc -b riscv-gcc-p-ext riscv-gcc-p-ext
git clone https://github.com/plctlab/riscv-binutils-gdb -b riscv-binutils-p-ext riscv-binutils-p-ext
./configure --prefix=`pwd`/installed-tools --with-arch=rv64imafd_zpn --with-abi=lp64d --with-gcc-src=`pwd`/riscv-gcc-p-ext --with-binutils-src=`pwd`/riscv-binutils-p-ext
make

And I was able to compile and disassemble the simple example code here:

@TommyMurphyTM1234
Copy link
Collaborator

Closing the issue since P extension support will be available when (a) the specification is ratified and (b) support is upstreamed to the master GCC and binutils projects.

@manju1205
Copy link
Author

Hi,
I could compile the toolchain successfully.
I could run below command and generate only intermediate files with lot of warnings.
riscv64-unknown-elf-gcc -O2 test.c -save-temps -o Test

test.s, test.i, test.o are generated but not the output file "Test"

I am able to see objdump showing all the P-ext instructions. :: riscv64-unknown-elf-objdump -d test.o

Why I am getting below warnings and why output file is not generated?
Since there are no errors I am not sure how to proceed further.

I am seeing below warnings on compilation.

/home/manjub/work/riscv_install/riscvtools/lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: warning: /home/manjub/work/riscv_install/riscvtools/lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-errno.o): mis-matched ISA version 2.0 for 'f' extension, the output version is 2.2
/home/manjub/work/riscv_install/riscvtools/lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: warning: /home/manjub/work/riscv_install/riscvtools/lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-errno.o): mis-matched ISA version 2.0 for 'd' extension, the output version is 2.2
/home/manjub/work/riscv_install/riscvtools/lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: warning: /home/manjub/work/riscv_install/riscvtools/lib/gcc/riscv64-unknown-elf/10.2.0/crtend.o: mis-matched ISA version 2.0 for 'i' extension, the output version is 2.1
/home/manjub/work/riscv_install/riscvtools/lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: warning: /home/manjub/work/riscv_install/riscvtools/lib/gcc/riscv64-unknown-elf/10.2.0/crtend.o: mis-matched ISA version 2.0 for 'a' extension, the output version is 2.1
/home/manjub/work/riscv_install/riscvtools/lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: warning: /home/manjub/work/riscv_install/riscvtools/lib/gcc/riscv64-unknown-elf/10.2.0/crtend.o: mis-matched ISA version 2.0 for 'f' extension, the output version is 2.2
/home/manjub/work/riscv_install/riscvtools/lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: warning: /home/manjub/work/riscv_install/riscvtools/lib/gcc/riscv64-unknown-elf/10.2.0/crtend.o: mis-matched ISA version 2.0 for 'd' extension, the output version is 2.2

@TommyMurphyTM1234
Copy link
Collaborator

Please clarify and provide...

  1. Details of how you're building your toolchain
  2. Your example code and details of how you're compiling it - ideally a small self-contained source file and associated Makefile

@manju1205
Copy link
Author

My sincere apologies. Test output is generated, "ll" command was not listing it.
I am getting below error with spike simulator ::
spike pk Test
error: bad --isa option 'rv64imafd_zpn'. unsupported extension: zpn

Please suggest me how to add "zpn" to spike?

@TommyMurphyTM1234
Copy link
Collaborator

TommyMurphyTM1234 commented Jul 12, 2023

My sincere apologies. Test output is generated, "ll" command was not listing it.

Do you mean that your previous post can be ignored after all?

I am getting below error with spike simulator :: spike pk Test error: bad --isa option 'rv64imafd_zpn'. unsupported extension: zpn

I suspect that Spike only supports ratified extensions.
Certainly Zp* is not listed here and I don't see any branch that might be prototyping support:

I don't know if the PLCT fork of Spike might support Zp* like their GCC and binutils forks?

If not and there is no other Spike fork that implements Zp* support then you'll probably have to ask over at the Spike repo or on the RISC-V mailing lists about how to approach implementing support yourself:

@manju1205
Copy link
Author

yes, my post wrt output not generated can be ignored.
"P extension, v0.9.2" is listed among supported ISA in https://github.com/riscv-software-src/riscv-isa-sim.
If not spike can I try any other simulator?

@TommyMurphyTM1234
Copy link
Collaborator

"P extension, v0.9.2" is listed among supported ISA in https://github.com/riscv-software-src/riscv-isa-sim.

You'll have to ask about this and why your attempt to use it fails over at the Spike and/or P extension pages:

If not spike can I try any other simulator?

Sorry - I've no idea myself.
Maybe check with some of the other RISC-V simulator projects to see if they offer what you're looking for?

@TommyMurphyTM1234
Copy link
Collaborator

Looks to me like Zpn should be supported by Spike:

How exactly did you build it?
Maybe you need to pass the requested ISA string in a different form to Spike?

@TommyMurphyTM1234
Copy link
Collaborator

TommyMurphyTM1234 commented Jul 12, 2023

I am getting below error with spike simulator ::

spike pk Test 
error: bad --isa option 'rv64imafd_zpn'. unsupported extension: zpn

Please suggest me how to add "zpn" to spike?

Looks like you need to do this:

spike --isa=rv64imafdp ...

Enabling the P extension enables a set of "sub-"extensions including ZPn as per the table here:

This is the relevant Spike code:

    switch (*p) {
      case 'p': extension_table[EXT_ZBPBO] = true;
                extension_table[EXT_ZPN] = true;
                extension_table[EXT_ZPSFOPERAND] = true;
                extension_table[EXT_ZMMUL] = true; break;

@manju1205
Copy link
Author

Thanks, with "--isa" option I could get spike recognizing the "zpn" sub-ext.
Below branch do they support zbpbo and zpsfoperand extns?

git clone https://github.com/plctlab/riscv-gcc -b riscv-gcc-p-ext riscv-gcc-p-ext
git clone https://github.com/plctlab/riscv-binutils-gdb -b riscv-binutils-p-ext riscv-binutils-p-ext

@TommyMurphyTM1234
Copy link
Collaborator

TommyMurphyTM1234 commented Jul 16, 2023

Thanks, with "--isa" option I could get spike recognizing the "zpn" sub-ext.

How? You said earlier that you got this:

error: bad --isa option 'rv64imafd_zpn'. unsupported extension: zpn

Below branch do they support zbpbo and zpsfoperand extns?

Yes - as I said here, if you use --isa=rvXX...p:

@manju1205
Copy link
Author

I used to get error on running below command without --isa option::

spike pk Test --- error
spike --isa=rv64imafdp pk Test -- NO error...

@TommyMurphyTM1234
Copy link
Collaborator

I used to get error on running below command without --isa option::

spike pk Test --- error spike --isa=rv64imafdp pk Test -- NO error...

Yes, that's basically what I said above:

Yes - as I said here, if you use --isa=rvXX...p:

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

No branches or pull requests

3 participants