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

[examples] Add Gemmini-baremetal examples and more conv2d examples. #451

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shirohasuki
Copy link

  1. Add Gemmini-baremetal examples for spike and verilator evaluation.
  2. Add more gemmini conv2d operation examples (like conv-2d-nhwc-fhwc).

…evaluation.

2. Add more gemmini conv2d operation examples.
Copy link
Member

@zhanghb97 zhanghb97 left a comment

Choose a reason for hiding this comment

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

Giving some quick feedback:

  • Missing empty line at the end of the files.
  • Please use our pre-commit tools:
$ cd buddy-mlir
$ pip install pre-commit
$ pre-commit install


GEMMINI_EXAMPLE_DIR := ${BUDDY_MLIR_DIR}/examples/GemminiDialect/

ELF_CC := riscv64-unknown-elf-gcc
Copy link
Member

Choose a reason for hiding this comment

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

Have not seen the E2E example.
Is the remaining E2E C++ error ('_start_main_argv') related to using riscv64-unknown-elf-gcc (expecting riscv64-unknown-elf-g++) for end-to-end?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, E2E example still block points at compiling with riscv64-unknown-elf-g++.
I will try to fix it and follow up with a full version commit.

Copy link
Member

@linuxlonelyeagle linuxlonelyeagle left a comment

Choose a reason for hiding this comment

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

There are a few nits to note.Finally, thank you for your contribution.

-relocation-model=pic \
-o log.o
@${ELF_CC} -O2 -static -specs=htif_nano.specs log.o -o conv-2d-nhwc-fhwc-i8-baremetal
@spike --extension=gemmini conv-2d-nhwc-fhwc-i8-baremetal
Copy link
Member

Choose a reason for hiding this comment

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

add endline.

outs(%output : memref<1x3x3x1xi8>)
gemmini.print %output : memref<1x3x3x1xi8>
return %0 : i8
}
Copy link
Member

Choose a reason for hiding this comment

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

add endline

outs(%output : memref<1x5x5x1xi8>)
gemmini.print %output : memref<1x5x5x1xi8>
return %0 : i8
}
Copy link
Member

Choose a reason for hiding this comment

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

add endline.

outs(%output : memref<1x3x3x1xi8>)
gemmini.print %output : memref<1x3x3x1xi8>
return %0 : i8
}
Copy link
Member

Choose a reason for hiding this comment

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

add endline.

-relocation-model=pic \
-o log.o
@riscv64-unknown-linux-gnu-gcc -O2 -static log.o -o a.out
@spike --extension=gemmini pk a.out
Copy link
Member

Choose a reason for hiding this comment

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

add endline.

[[1],[1],[1],[1],[1],[1],[1]]]]>

memref.global "private" @kernel : memref<5x5x1x1xi8> = dense<[[[[1]], [[1]], [[1]], [[1]], [[1]]],
[[[1]], [[1]], [[1]], [[1]], [[1]]],
Copy link
Member

Choose a reason for hiding this comment

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

The [ on each line should align with the [ on the previous line.
This looks better.

[[[[1]], [[1]], [[1]], [[1]], [[1]]], 
 [[[1]], [[1]], [[1]], [[1]], [[1]]],

This pr other examples also have this problem, you need to look at it again, thank you.


ELF_CC := riscv64-unknown-elf-gcc
PK_CC := riscv64-unknown-linux-gnu-gcc

Copy link
Member

Choose a reason for hiding this comment

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

PK_CC or ELF_CC Is there a better name?

### Hardware Evaluation
Step 1. Execute `make <workload>-run-baremetal` in this folder to generate the baremetal test case.

Step 2. Copy the generated test case `<workload>-baremetal` to the gemmini workload storage path in the chipyard folder (`chipyard/generators/software/gemmini-rocc-tests/build/`)
Copy link
Member

Choose a reason for hiding this comment

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

I think maybe copy is not necessary? I'm not sure anymore.

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.

3 participants