Skip to content

Add histogram testbench files#161

Closed
n0thingNoob wants to merge 1 commit intomainfrom
testbench
Closed

Add histogram testbench files#161
n0thingNoob wants to merge 1 commit intomainfrom
testbench

Conversation

@n0thingNoob
Copy link
Copy Markdown
Collaborator

@n0thingNoob n0thingNoob commented Oct 17, 2025

I am currently working on compiling the testbench file. Here is one I just uploaded:

  • histogram.cpp: Main test program with test data
  • histogram_kernel.cpp: Kernel implementation
  • histogram_kernel.ll: LLVM IR generated from kernel
  • histogram_kernel.mlir: MLIR representation from LLVM IR
  • histogram_kernel_neura.mlir: Neura dialect with compilation issues

We have an issue with this transfer. I attached it to the issues #160
There is a problem that we might need to solve:
%13 = llvm.fdiv %12, %3 : f32
%14 = llvm.fptosi %13 : f32 to i32

There are two ops that are not transferred into the neura operation. I think we might need to add more conversion rules for these Ops.
For fdiv:
I got the error message: 'llvm.fdiv' op operand #0 must be floating point LLVM type or LLVM dialect-compatible vector of floating point LLVM type, but got '!neura.data<f32, i1>'
For fptosi:
We don't have the conversion rules.

- histogram.cpp: Main test program with test data
- histogram_kernel.cpp: Kernel implementation
- histogram_kernel.ll: LLVM IR generated from kernel
- histogram_kernel.mlir: MLIR representation from LLVM IR
- histogram_kernel_neura.mlir: Neura dialect with compilation issues
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds testbench files for a histogram computation kernel to the dataflow project. The primary purpose is to provide comprehensive test infrastructure for a histogram kernel implementation across multiple compilation stages.

  • Introduces 5 testbench files covering C++ source, LLVM IR, MLIR, and Neura dialect representations
  • Highlights compilation issues with LLVM dialect to Neura dialect conversion for fdiv and fptosi operations
  • Provides a complete test case with input data and expected histogram computation workflow

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
histogram.cpp Main test program with input data and kernel invocation
histogram_kernel.cpp Simplified kernel implementation for compilation
histogram_kernel.ll LLVM IR representation of the kernel
histogram_kernel.mlir MLIR with LLVM dialect from IR conversion
histogram_kernel_neura.mlir Neura dialect with incomplete conversion showing compilation issues

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +17 to +18
%13 = llvm.fdiv %12, %3 : f32
%14 = llvm.fptosi %13 : f32 to i32
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

These LLVM dialect operations should be converted to Neura dialect operations. The llvm.fdiv should be neura.fdiv and llvm.fptosi should be neura.fptosi to maintain consistency with the rest of the converted code.

Copilot uses AI. Check for mistakes.
Comment on lines +29 to +30
%24 = llvm.fdiv %23, %3 : f32
%25 = llvm.fptosi %24 : f32 to i32
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

These LLVM dialect operations should be converted to Neura dialect operations. The llvm.fdiv should be neura.fdiv and llvm.fptosi should be neura.fptosi to maintain consistency with the rest of the converted code.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why upload this? You already upload the entire CGRA-Bench in last PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You only need to have a histogram_test.mlir in this folder and include the command starting with // RUN: , and check whatever you wanna check. WDYT?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I thought we should have the entire cpp code. So just the kernel's mlir file would be fine?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You already have that, right?

Screenshot 2025-10-17 at 4 37 26 PM

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

You already have that, right?

Screenshot 2025-10-17 at 4 37 26 PM

Yes, but I have some other testbenches that are not included in this repo. Should I upload those c++ files?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

So only mlir file?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • For other .cc not included in the CGRA-Bench, you can create another folder like benchmarks, and then put them inside it, you can also put CGRA-Bench inside it. So it would look like:
    • dataflow/test/benchmarks/a.cpp
    • dataflow/test/benchmarks/b.cpp
    • dataflow/test/benchmarks/CGRA-Bench
  • for testing, you can create another folder, e.g., e2e, then mimic testhttps://github.com/coredac/dataflow/blob/main/test/neura/for_loop/relu_test.mlir, and provide your testing_a.mlir inside the test/e2e

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rename your testbench as e2e

@n0thingNoob n0thingNoob deleted the testbench branch October 17, 2025 23:36
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