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

Vector softmax #1172

Merged
merged 3 commits into from
Apr 4, 2024
Merged

Vector softmax #1172

merged 3 commits into from
Apr 4, 2024

Conversation

jamesroxbypb
Copy link
Collaborator

A vector softmax operator with a sweep capability,

@jamesroxbypb jamesroxbypb merged commit 30d9392 into asplos Apr 4, 2024
53 of 54 checks passed
@jamesroxbypb jamesroxbypb deleted the vector_softmax branch April 4, 2024 18:52
Comment on lines +54 to +56
void exp_bf16_vector(bfloat16 *a_in, bfloat16 *c_out) {
dut(a_in, c_out);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

[clang-format] reported by reviewdog 🐶

Suggested change
void exp_bf16_vector(bfloat16 *a_in, bfloat16 *c_out) {
dut(a_in, c_out);
}
void exp_bf16_vector(bfloat16 *a_in, bfloat16 *c_out) { dut(a_in, c_out); }

#include <math.h>
>>>>>>> asplos
Copy link
Contributor

Choose a reason for hiding this comment

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

[clang-format] reported by reviewdog 🐶

Suggested change
>>>>>>> asplos
>>>>>>> asplos

#include <sstream>
#include <stdfloat>
#include <string>
#include <vector>
<<<<<<< HEAD
Copy link
Contributor

Choose a reason for hiding this comment

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

[clang-format] reported by reviewdog 🐶

Suggested change
<<<<<<< HEAD
<<<<<<< HEAD

#include <sstream>
#include <stdfloat>
#include <string>
#include <vector>
<<<<<<< HEAD
#include <math.h>
=======
Copy link
Contributor

Choose a reason for hiding this comment

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

[clang-format] reported by reviewdog 🐶

Suggested change
=======
=======

<<<<<<< HEAD
#include <math.h>
=======
>>>>>>> asplos

#include "xrt/xrt_bo.h"
#include "xrt/xrt_device.h"
#include "xrt/xrt_kernel.h"

constexpr bool VERIFY = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

[clang-format] reported by reviewdog 🐶

Suggested change
constexpr bool VERIFY = true;
constexpr bool VERIFY = true;

running += ez;
RefVec[t + i] = exp(AVec[t + i]);
RefVec[t+i] = exp(AVec[t+i]);
Copy link
Contributor

Choose a reason for hiding this comment

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

[clang-format] reported by reviewdog 🐶

Suggested change
RefVec[t+i] = exp(AVec[t+i]);
RefVec[t + i] = exp(AVec[t + i]);

}

Copy link
Contributor

Choose a reason for hiding this comment

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

[clang-format] reported by reviewdog 🐶

Suggested change

for (uint32_t i = 0; i < TILE_SIZE; i++) {
RefVec[t + i] /= running;
RefVec[t+i] /= running;
Copy link
Contributor

Choose a reason for hiding this comment

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

[clang-format] reported by reviewdog 🐶

Suggested change
RefVec[t+i] /= running;
RefVec[t + i] /= running;

}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

[clang-format] reported by reviewdog 🐶

Suggested change
}
}

Comment on lines +246 to +248
float cpu_time =
std::chrono::duration_cast<std::chrono::microseconds>(cpu_stop - cpu_start)
.count();
Copy link
Contributor

Choose a reason for hiding this comment

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

[clang-format] reported by reviewdog 🐶

Suggested change
float cpu_time =
std::chrono::duration_cast<std::chrono::microseconds>(cpu_stop - cpu_start)
.count();
float cpu_time = std::chrono::duration_cast<std::chrono::microseconds>(
cpu_stop - cpu_start)
.count();

@@ -16,7 +16,7 @@
def my_eltwise_add():

word_size_in = 2
N = 65536 # *1024
N = 262144 #*1024
Copy link
Contributor

Choose a reason for hiding this comment

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

[black] reported by reviewdog 🐶

Suggested change
N = 262144 #*1024
N = 262144 # *1024

@@ -0,0 +1,20 @@
import os;
Copy link
Contributor

Choose a reason for hiding this comment

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

[black] reported by reviewdog 🐶

Suggested change
import os;
import os

@@ -0,0 +1,20 @@
import os;

for action in ["rm -f","touch"]:
Copy link
Contributor

Choose a reason for hiding this comment

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

[black] reported by reviewdog 🐶

Suggested change
for action in ["rm -f","touch"]:
for action in ["rm -f", "touch"]:

Comment on lines +8 to +9
for s in [16384,32768,65536,131072,262144]:
for i in [64,128,256,512,1024]:
Copy link
Contributor

Choose a reason for hiding this comment

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

[black] reported by reviewdog 🐶

Suggested change
for s in [16384,32768,65536,131072,262144]:
for i in [64,128,256,512,1024]:
for s in [16384, 32768, 65536, 131072, 262144]:
for i in [64, 128, 256, 512, 1024]:

make_all = f"make all"
os.system(make_all)
make_profile = f"make profile"
os.system(make_profile)
Copy link
Contributor

Choose a reason for hiding this comment

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

[black] reported by reviewdog 🐶

Suggested change
os.system(make_profile)
os.system(make_profile)

Copy link
Contributor

github-actions bot commented Apr 4, 2024

Coverage Report

Created: 2024-04-04 19:05

Click here for information about interpreting this report.

FilenameFunction CoverageLine CoverageRegion CoverageBranch Coverage
Totals- - - -
Generated by llvm-cov -- llvm version 14.0.0

fifield pushed a commit to fifield/mlir-aie that referenced this pull request Apr 4, 2024
fifield pushed a commit to fifield/mlir-aie that referenced this pull request Apr 8, 2024
fifield pushed a commit to fifield/mlir-aie that referenced this pull request Apr 9, 2024
fifield pushed a commit to fifield/mlir-aie that referenced this pull request Apr 9, 2024
fifield pushed a commit to fifield/mlir-aie that referenced this pull request Apr 9, 2024
fifield pushed a commit to fifield/mlir-aie that referenced this pull request Apr 9, 2024
fifield pushed a commit to fifield/mlir-aie that referenced this pull request Apr 9, 2024
fifield pushed a commit to fifield/mlir-aie that referenced this pull request Apr 10, 2024
fifield pushed a commit to fifield/mlir-aie that referenced this pull request Apr 12, 2024
fifield pushed a commit to fifield/mlir-aie that referenced this pull request Apr 12, 2024
fifield pushed a commit to fifield/mlir-aie that referenced this pull request Apr 12, 2024
fifield pushed a commit to fifield/mlir-aie that referenced this pull request Apr 12, 2024
Signed-off-by: Abhishek Varma <[email protected]>
Co-authored-by: Javier Setoain <[email protected]>
Co-authored-by: James Newling <[email protected]>
Co-authored-by: Maksim Levental <[email protected]>
Co-authored-by: Joseph Melber <[email protected]>
Co-authored-by: Abhishek Varma <[email protected]>
Co-authored-by: erwei-xilinx <[email protected]>
Co-authored-by: AndraBisca <[email protected]>

Started writing the objfifo intro tutorial

Vectorize vec scalar (Xilinx#1135)

Added new programming guide section placedholders (Xilinx#1138)

[EXAMPLE] An element-wise add example (Xilinx#1148)

Co-authored-by: pjr <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jack Lo <[email protected]>

Moved objfifo design example 1 to programming_guide sections 3.

Started objectFifo programming guide

Continue section 3 guide.

ObjFifo guide: access patterns

Add example to objFifo guide

Update objfifo guide

Separate section 3 of the guide into 3 subsections

[ASPLOS] Weight expand asplos (Xilinx#1158)

Co-authored-by: pjr <[email protected]>
Co-authored-by: Phil James-Roxby <[email protected]>

Reorganize subsections in section 3 of the guide.

Updated sections 3a and 3b

Pjr vector exp (Xilinx#1166)

Co-authored-by: pjr <[email protected]>
Co-authored-by: Joseph Melber <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

[SOFTMAX] Single column rapid test (Xilinx#1168)

Co-authored-by: pjr <[email protected]>
Co-authored-by: Joseph Melber <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

Vector softmax (Xilinx#1172)

Co-authored-by: pjr <[email protected]>

[MERGE] This has gone horribly wrong, so fixing up in place

Update exp.cc

Merge resolved

Added new programming guide section placedholders (Xilinx#1174)

Swapped section-2 and section-3 (Xilinx#1177)

Update section-1 and section-3 examples (Xilinx#1179)

Update section-3 (Xilinx#1181)

Reorganize tutorials and reference_designs to programming_examples (Xilinx#1182)

Fix for mmult lit (Xilinx#1187)

Revert "Fix for mmult lit" (Xilinx#1188)

[ASPLOS][WIP] python host code example (Xilinx#1185)

Extract arg parse from test.py (Xilinx#1192)

Add finished write-up for sections 2a and 2b

Add objectfifo bindings to quick references

Update section2 subsection list

[ASPLOS][WIP] initial version of asplos24 tutorial description (Xilinx#1184)

Co-authored-by: Jack Lo <[email protected]>

Fix for lit tests (Xilinx#1189)

Rename tutorials folder (Xilinx#1190) (Xilinx#1197)

Co-authored-by: AndraBisca <[email protected]>
Co-authored-by: Jack Lo <[email protected]>

[ASPLOS] Rename directories (Xilinx#1196)

Co-authored-by: Jeff Fifield <[email protected]>
Co-authored-by: AndraBisca <[email protected]>
Co-authored-by: Jack Lo <[email protected]>

Add section 2c. Update tiles in sections 2a and 2b.

Add generic aie array description paragraph (Xilinx#1191)

Co-authored-by: Joseph Melber <[email protected]>
Co-authored-by: Jack Lo <[email protected]>

ReLU with tracing (Xilinx#1204)

ReLU example with tracing

Co-authored-by: pjr <[email protected]>
Co-authored-by: Joseph Melber <[email protected]>

Ml eltwise add and mul (Xilinx#1207)

Move around of the eltwise add (put it in ml) and a new eltwise mul kernel

Co-authored-by: pjr <[email protected]>
Co-authored-by: Jeff Fifield <[email protected]>

Moved test_lib to runtime_lib/test_lib for now

Pjr reduce (Xilinx#1222) Reduce programming examples

Co-authored-by: pjr <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

[ASPLOS][WIP] Passthrough kernel in basic examples (Xilinx#1216)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

fix paths run.lit passthrough _kernel (Xilinx#1225)

Fixed CMakeLists.txt reference to test_utils.h (Xilinx#1223)

Minor CMakeLists.txt and Makefile fixes for programming_examples (Xilinx#1227)
fifield pushed a commit to fifield/mlir-aie that referenced this pull request Apr 12, 2024
Signed-off-by: Abhishek Varma <[email protected]>
Co-authored-by: Javier Setoain <[email protected]>
Co-authored-by: James Newling <[email protected]>
Co-authored-by: Maksim Levental <[email protected]>
Co-authored-by: Joseph Melber <[email protected]>
Co-authored-by: Abhishek Varma <[email protected]>
Co-authored-by: erwei-xilinx <[email protected]>
Co-authored-by: AndraBisca <[email protected]>

Started writing the objfifo intro tutorial

Vectorize vec scalar (Xilinx#1135)

Added new programming guide section placedholders (Xilinx#1138)

[EXAMPLE] An element-wise add example (Xilinx#1148)

Co-authored-by: pjr <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jack Lo <[email protected]>

Moved objfifo design example 1 to programming_guide sections 3.

Started objectFifo programming guide

Continue section 3 guide.

ObjFifo guide: access patterns

Add example to objFifo guide

Update objfifo guide

Separate section 3 of the guide into 3 subsections

[ASPLOS] Weight expand asplos (Xilinx#1158)

Co-authored-by: pjr <[email protected]>
Co-authored-by: Phil James-Roxby <[email protected]>

Reorganize subsections in section 3 of the guide.

Updated sections 3a and 3b

Pjr vector exp (Xilinx#1166)

Co-authored-by: pjr <[email protected]>
Co-authored-by: Joseph Melber <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

[SOFTMAX] Single column rapid test (Xilinx#1168)

Co-authored-by: pjr <[email protected]>
Co-authored-by: Joseph Melber <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

Vector softmax (Xilinx#1172)

Co-authored-by: pjr <[email protected]>

[MERGE] This has gone horribly wrong, so fixing up in place

Update exp.cc

Merge resolved

Added new programming guide section placedholders (Xilinx#1174)

Swapped section-2 and section-3 (Xilinx#1177)

Update section-1 and section-3 examples (Xilinx#1179)

Update section-3 (Xilinx#1181)

Reorganize tutorials and reference_designs to programming_examples (Xilinx#1182)

Fix for mmult lit (Xilinx#1187)

Revert "Fix for mmult lit" (Xilinx#1188)

[ASPLOS][WIP] python host code example (Xilinx#1185)

Extract arg parse from test.py (Xilinx#1192)

Add finished write-up for sections 2a and 2b

Add objectfifo bindings to quick references

Update section2 subsection list

[ASPLOS][WIP] initial version of asplos24 tutorial description (Xilinx#1184)

Co-authored-by: Jack Lo <[email protected]>

Fix for lit tests (Xilinx#1189)

Rename tutorials folder (Xilinx#1190) (Xilinx#1197)

Co-authored-by: AndraBisca <[email protected]>
Co-authored-by: Jack Lo <[email protected]>

[ASPLOS] Rename directories (Xilinx#1196)

Co-authored-by: Jeff Fifield <[email protected]>
Co-authored-by: AndraBisca <[email protected]>
Co-authored-by: Jack Lo <[email protected]>

Add section 2c. Update tiles in sections 2a and 2b.

Add generic aie array description paragraph (Xilinx#1191)

Co-authored-by: Joseph Melber <[email protected]>
Co-authored-by: Jack Lo <[email protected]>

ReLU with tracing (Xilinx#1204)

ReLU example with tracing

Co-authored-by: pjr <[email protected]>
Co-authored-by: Joseph Melber <[email protected]>

Ml eltwise add and mul (Xilinx#1207)

Move around of the eltwise add (put it in ml) and a new eltwise mul kernel

Co-authored-by: pjr <[email protected]>
Co-authored-by: Jeff Fifield <[email protected]>

Moved test_lib to runtime_lib/test_lib for now

Pjr reduce (Xilinx#1222) Reduce programming examples

Co-authored-by: pjr <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

[ASPLOS][WIP] Passthrough kernel in basic examples (Xilinx#1216)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

fix paths run.lit passthrough _kernel (Xilinx#1225)

Fixed CMakeLists.txt reference to test_utils.h (Xilinx#1223)

Minor CMakeLists.txt and Makefile fixes for programming_examples (Xilinx#1227)
fifield pushed a commit to fifield/mlir-aie that referenced this pull request Apr 12, 2024
Signed-off-by: Abhishek Varma <[email protected]>
Co-authored-by: Javier Setoain <[email protected]>
Co-authored-by: James Newling <[email protected]>
Co-authored-by: Maksim Levental <[email protected]>
Co-authored-by: Joseph Melber <[email protected]>
Co-authored-by: Abhishek Varma <[email protected]>
Co-authored-by: erwei-xilinx <[email protected]>
Co-authored-by: AndraBisca <[email protected]>

Started writing the objfifo intro tutorial

Vectorize vec scalar (Xilinx#1135)

Added new programming guide section placedholders (Xilinx#1138)

[EXAMPLE] An element-wise add example (Xilinx#1148)

Co-authored-by: pjr <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jack Lo <[email protected]>

Moved objfifo design example 1 to programming_guide sections 3.

Started objectFifo programming guide

Continue section 3 guide.

ObjFifo guide: access patterns

Add example to objFifo guide

Update objfifo guide

Separate section 3 of the guide into 3 subsections

[ASPLOS] Weight expand asplos (Xilinx#1158)

Co-authored-by: pjr <[email protected]>
Co-authored-by: Phil James-Roxby <[email protected]>

Reorganize subsections in section 3 of the guide.

Updated sections 3a and 3b

Pjr vector exp (Xilinx#1166)

Co-authored-by: pjr <[email protected]>
Co-authored-by: Joseph Melber <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

[SOFTMAX] Single column rapid test (Xilinx#1168)

Co-authored-by: pjr <[email protected]>
Co-authored-by: Joseph Melber <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

Vector softmax (Xilinx#1172)

Co-authored-by: pjr <[email protected]>

[MERGE] This has gone horribly wrong, so fixing up in place

Update exp.cc

Merge resolved

Added new programming guide section placedholders (Xilinx#1174)

Swapped section-2 and section-3 (Xilinx#1177)

Update section-1 and section-3 examples (Xilinx#1179)

Update section-3 (Xilinx#1181)

Reorganize tutorials and reference_designs to programming_examples (Xilinx#1182)

Fix for mmult lit (Xilinx#1187)

Revert "Fix for mmult lit" (Xilinx#1188)

[ASPLOS][WIP] python host code example (Xilinx#1185)

Extract arg parse from test.py (Xilinx#1192)

Add finished write-up for sections 2a and 2b

Add objectfifo bindings to quick references

Update section2 subsection list

[ASPLOS][WIP] initial version of asplos24 tutorial description (Xilinx#1184)

Co-authored-by: Jack Lo <[email protected]>

Fix for lit tests (Xilinx#1189)

Rename tutorials folder (Xilinx#1190) (Xilinx#1197)

Co-authored-by: AndraBisca <[email protected]>
Co-authored-by: Jack Lo <[email protected]>

[ASPLOS] Rename directories (Xilinx#1196)

Co-authored-by: Jeff Fifield <[email protected]>
Co-authored-by: AndraBisca <[email protected]>
Co-authored-by: Jack Lo <[email protected]>

Add section 2c. Update tiles in sections 2a and 2b.

Add generic aie array description paragraph (Xilinx#1191)

Co-authored-by: Joseph Melber <[email protected]>
Co-authored-by: Jack Lo <[email protected]>

ReLU with tracing (Xilinx#1204)

ReLU example with tracing

Co-authored-by: pjr <[email protected]>
Co-authored-by: Joseph Melber <[email protected]>

Ml eltwise add and mul (Xilinx#1207)

Move around of the eltwise add (put it in ml) and a new eltwise mul kernel

Co-authored-by: pjr <[email protected]>
Co-authored-by: Jeff Fifield <[email protected]>

Moved test_lib to runtime_lib/test_lib for now

Pjr reduce (Xilinx#1222) Reduce programming examples

Co-authored-by: pjr <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

[ASPLOS][WIP] Passthrough kernel in basic examples (Xilinx#1216)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

fix paths run.lit passthrough _kernel (Xilinx#1225)

Fixed CMakeLists.txt reference to test_utils.h (Xilinx#1223)

Minor CMakeLists.txt and Makefile fixes for programming_examples (Xilinx#1227)
efurst pushed a commit to efurst/mlir-aie that referenced this pull request Apr 25, 2024
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.

1 participant