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

BLAS compatibility library #7

Open
wants to merge 74 commits into
base: main
Choose a base branch
from
Open

BLAS compatibility library #7

wants to merge 74 commits into from

Conversation

ChrisPattison
Copy link
Collaborator

We will want some integration tests for this, but it's probably more important to not have a huge diff piling up

@ChrisPattison
Copy link
Collaborator Author

ChrisPattison commented Dec 20, 2021

I've just added a unit test (currently failing) for SYRK although we probably don't want to run it with the regular unit tests because it requires a hardware kernel. Do you have any suggestions here?

@definelicht
Copy link
Contributor

You can see what I did for GEMM, it's a test but not a unit test

@ChrisPattison
Copy link
Collaborator Author

There's a nice routine to search for the kernel at Apfp::FindKernel. It might be useful to reuse elsewhere, but I left it where it is for now

Copy link
Contributor

@definelicht definelicht 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 still several unaddressed comments from last review. Did you miss them, or is it stuff you want to postpone?

interface/Apfp.h Outdated Show resolved Hide resolved
interface/ApfpBlas.cpp Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
interface/Apfp.cpp Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
interface/ApfpBlas.h Outdated Show resolved Hide resolved
CMakeLists.txt Show resolved Hide resolved
const int k) {
#pragma HLS INLINE
ReadA_N:
for (int n1 = 0; n1 < kTileSizeN; ++n1) {
#pragma HLS PIPELINE II = 1
#pragma HLS LOOP_FLATTEN
DramLine num[1];
num[0] = mem[(n0 * kTileSizeN + n1) * size_k + k];
num[0] = mem[((n0 * kTileSizeN + n1) + k * size_n) * kLinesPerNumber];
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
num[0] = mem[((n0 * kTileSizeN + n1) + k * size_n) * kLinesPerNumber];
num[0] = mem[k * size_n + n0 * kTileSizeN + n1];

@@ -19,7 +24,7 @@ void ReadAInner(DramLine const *const mem, hlslib::Stream<PackedFloat> &a_to_fee
for (int i = 0; i < kLinesPerNumber; ++i) {
#pragma HLS PIPELINE II = 1
#pragma HLS LOOP_FLATTEN
num[i] = mem[((n0 * kTileSizeN + n1) * size_k + k) * kLinesPerNumber + i];
num[i] = mem[((n0 * kTileSizeN + n1) + k * size_n) * kLinesPerNumber + i];
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
num[i] = mem[((n0 * kTileSizeN + n1) + k * size_n) * kLinesPerNumber + i];
num[i] = mem[(k * size_n + n0 * kTileSizeN + n1) * kLinesPerNumber + i];

@@ -100,7 +105,7 @@ void ReadBInner(DramLine const *const mem, hlslib::Stream<PackedFloat> &b_to_fee
for (int i = 0; i < kLinesPerNumber; ++i) {
#pragma HLS PIPELINE II = 1
#pragma HLS LOOP_FLATTEN
num[i] = mem[(k * size_m + m0 * kTileSizeM + m1) * kLinesPerNumber + i];
num[i] = mem[(k + (m0 * kTileSizeM + m1) * size_k) * kLinesPerNumber + i];
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
num[i] = mem[(k + (m0 * kTileSizeM + m1) * size_k) * kLinesPerNumber + i];
num[i] = mem[((m0 * kTileSizeM + m1) * size_k + k) * kLinesPerNumber + i];

const int k) {
#pragma HLS INLINE
ReadB_M:
for (int m1 = 0; m1 < kTileSizeM; ++m1) {
#pragma HLS PIPELINE II = 1
#pragma HLS LOOP_FLATTEN
DramLine num[1];
num[0] = mem[k * size_m + m0 * kTileSizeM + m1];
num[0] = mem[(k + (m0 * kTileSizeM + m1) * size_k) * kLinesPerNumber];
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
num[0] = mem[(k + (m0 * kTileSizeM + m1) * size_k) * kLinesPerNumber];
num[0] = mem[(m0 * kTileSizeM + m1) * size_k + k];

host/TestProgram.cpp Show resolved Hide resolved
host/TestProgram.cpp Show resolved Hide resolved
host/TestProgram.cpp Show resolved Hide resolved
host/TestProgram.cpp Show resolved Hide resolved
interface/Apfp.cpp Show resolved Hide resolved
@definelicht definelicht force-pushed the main branch 6 times, most recently from 43d8a88 to 3860e6e Compare May 17, 2022 03:27
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.

2 participants