camel-cdr / rvv-bench

A collection of RISC-V Vector (RVV) benchmarks to help developers write portably performant RVV code
MIT License
88 stars 12 forks source link

Testing on Canaan K230 #6

Closed gasbytes closed 1 year ago

gasbytes commented 1 year ago

Hi i really like your project, i'm writing some benchmarks myself to test the rvv capabilities of the K230 for a project.

First of all i wanted to just compile the memcpy example that is provided by the spec, and while running it using the instructions described by the k230 docs it doesn't find for some reason the functions even though i'm running using the riscv64 option in the crosscompiler, and the v flag too.

This is the error for more context: image

gasbytes commented 1 year ago

probably if you can just share what setup did you use, it would be amazing, since there is a pretty big lack of documentation in the sdk.

i would really appreciate it. <3

camel-cdr commented 1 year ago

See https://github.com/camel-cdr/rvv-bench/issues/4#issuecomment-1806002420 (i'll respond properly later)

gasbytes commented 1 year ago

sure, i will wait for an update, i appreciate it

camel-cdr commented 1 year ago

First of all i wanted to just compile the memcpy example that is provided by the spec, […] it doesn't find for some reason the functions even though i'm running using the riscv64 option in the crosscompiler, and the v flag too.

Are you using the xuantie or an older toolchain? They might have non-standard rvv intrinsics.

probably if you can just share what setup did you use, it would be amazing, since there is a pretty big lack of documentation in the sdk. i would really appreciate it. <3

I'm using this fork of the sdk, which only runs linux on the single rvv capable core with the entire memory.

I currently just crossompile with the latest clang (without crosscompiler toolchain) since rvv-bench supports freestanding builds. Then I use screen to connect to the serial port, and sz/rz to transfer file to and from the device.

Btw, since rvv-bench supports freestanding builds there is no usual printf, but rather a print macro (see nolibc.h) e.g.: print("string")(n,"raw data")(u,12)(fn,3,1.123)(f,3.1415);

i'm writing some benchmarks myself to test the rvv capabilities of the K230 for a project.

Good luck with your project. :-) It would be cool if you could share the benchmark once it's done and if it might be useful for others.

gasbytes commented 1 year ago

Are you using the xuantie or an older toolchain? They might have non-standard rvv intrinsics.

i'm using the last toolchain available on the sdk, so since i'm trying to compile for the big core, i guess i'm using the riscv64-linux-musleabi cross compiler

I'm using this fork of the sdk, which only runs linux on the single rvv capable core with the entire memory. I currently just crossompile with the latest clang (without crosscompiler toolchain) since rvv-bench supports freestanding builds. Then I use screen to connect to the serial port, and sz/rz to transfer file to and from the device. Btw, since rvv-bench supports freestanding builds there is no usual printf, but rather a print macro (see nolibc.h) e.g.: print("string")(n,"raw data")(u,12)(fn,3,1.123)(f,3.1415);

yeah the thing is that i'm trying to just compile the examples from the spec, and then modify myself to suit my needs. The thing is that when using your config (that i read from your config.mk file), there are some missing libraries, like the math.h etc... (memcpy example). I would guess that it has something to do with the flags that you pass.

Good luck with your project. :-) It would be cool if you could share the benchmark once it's done and if it might be useful for others.

thank you i really appreciate it, it's just a research project for my bachelor thesis about the RVV extension, which consists of explaining it, experimenting with it, and doing research with it, leaning on the embedded side of it (AIoT), experimenting with the board capabilities etc... And the board that i'm experimenting with is the k230, since it's the first board with a processor rvv1.0, that the research group i'm working in received, so yeah that's basically it hahah. Btw do you have an email or an equivalent way of contacting you that's it's easier than the github issues? In case i have more questions for you (which yes, probably will happen hahah). Again i really appreciate your kindness and availability.

EDIT: I think they might have non-standard instrisics, since this simple main compiles:

#include <riscv_vector.h>
#include <stdio.h>

int main() {
  int avl = 70;
  int vl = vsetvl_e32m2(avl);
  printf("vl: %d\n", vl);

  return 0;
}
camel-cdr commented 1 year ago

i'm using the last toolchain available on the sdk, so since i'm trying to compile for the big core, i guess i'm using the riscv64-linux-musleabi cross compiler

Did you manage to get it to work?

The thing is that when using your config (that i read from your config.mk file), there are some missing libraries, like the math.h

Exactly, my default config builds in freestanding mode, which works with any clang build, but doesn't link a libc, so those functions aren't available. There is a commented out config for a full cross-compiler toolchain.

it's just a research project for my bachelor thesis about the RVV extension, which consists of explaining it, experimenting with it, and doing research with it, leaning on the embedded side of it (AIoT), experimenting with the board capabilities etc...

Sounds fun.

Btw do you have an email or an equivalent way of contacting you that's it's easier than the github issues

You can contact me at camel-cdr@protonmail.com, I'm happy to help.

gasbytes commented 1 year ago

You can contact me at camel-cdr@protonmail.com, I'm happy to help.

okay i will contact you there, will close this issue.