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

Ryzen AI Examples #757

Merged
merged 172 commits into from
Dec 5, 2023
Merged

Ryzen AI Examples #757

merged 172 commits into from
Dec 5, 2023

Conversation

jgmelber
Copy link
Collaborator

No description provided.

from aie.dialects.func import *
from aie.dialects.scf import *
from aie.dialects.aie import *
from aie.dialects.aiex import *
Copy link
Member

@keryell keryell Nov 15, 2023

Choose a reason for hiding this comment

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

Since this is a teaching exercise, it might be better to avoid these wild-card imports to makes things clear.
Imagine a casual reader not knowing about AIE(X), MLIR, compilation... :-)
At least you could use some namespace shortcut if you dislike spelling aie.dialects.aie. and others all over the place.
For some context, https://peps.python.org/pep-0008

Wildcard imports (from <module> import *) should be avoided, as they make it unclear which names are present in the namespace, confusing both readers and many automated tools. There is one defensible use case for a wildcard import, which is to republish an internal interface as part of a public API (for example, overwriting a pure Python implementation of an interface with the definitions from an optional accelerator module and exactly which definitions will be overwritten isn’t known in advance).

When republishing names this way, the guidelines below regarding public and internal interfaces still apply.

@jgmelber jgmelber force-pushed the examples2 branch 2 times, most recently from 7c85558 to 3c5dfd2 Compare November 16, 2023 18:26
@stephenneuendorffer
Copy link
Collaborator

When this lands, please make sure that it gets squashed.

@jgmelber
Copy link
Collaborator Author

When this lands, please make sure that it gets squashed.

Of course

@denolf denolf mentioned this pull request Nov 22, 2023
@jgmelber
Copy link
Collaborator Author

jgmelber commented Dec 1, 2023

Looks close. We need a run.lit for log_hello_world and to finish up color detect with a python.

@jackl-xilinx
Copy link
Collaborator

Looks close. We need a run.lit for log_hello_world and to finish up color detect with a python.

Yeah, we're almost there. I added the remaining missing lit tests but color_threshold and passthrough still need a bit more work to get it working properly.

Comment on lines 30 to 31
//#define IMAGE_WIDTH_IN 128
//#define IMAGE_HEIGHT_IN 64
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
//#define IMAGE_WIDTH_IN 128
//#define IMAGE_HEIGHT_IN 64
// #define IMAGE_WIDTH_IN 128
// #define IMAGE_HEIGHT_IN 64

Comment on lines 35 to 36
//#define IMAGE_WIDTH_OUT IMAGE_WIDTH_IN
//#define IMAGE_HEIGHT_OUT IMAGE_HEIGHT_IN
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
//#define IMAGE_WIDTH_OUT IMAGE_WIDTH_IN
//#define IMAGE_HEIGHT_OUT IMAGE_HEIGHT_IN
// #define IMAGE_WIDTH_OUT IMAGE_WIDTH_IN
// #define IMAGE_HEIGHT_OUT IMAGE_HEIGHT_IN

Comment on lines 38 to 39
//#define IMAGE_AREA_IN (IMAGE_HEIGHT_IN * IMAGE_WIDTH_IN)
//#define IMAGE_AREA_OUT (IMAGE_HEIGHT_OUT * IMAGE_WIDTH_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
//#define IMAGE_AREA_IN (IMAGE_HEIGHT_IN * IMAGE_WIDTH_IN)
//#define IMAGE_AREA_OUT (IMAGE_HEIGHT_OUT * IMAGE_WIDTH_OUT)
// #define IMAGE_AREA_IN (IMAGE_HEIGHT_IN * IMAGE_WIDTH_IN)
// #define IMAGE_AREA_OUT (IMAGE_HEIGHT_OUT * IMAGE_WIDTH_OUT)

if (errors < max_errors)
std::cout << "Error: " << (uint8_t) * (bufOut + i) << " at " << i
<< " should be zero "
<< " : input " << std::dec << (uint8_t)srcVec[i] << std::endl;
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
<< " : input " << std::dec << (uint8_t)srcVec[i] << std::endl;
<< " : input " << std::dec << (uint8_t)srcVec[i]
<< std::endl;

Comment on lines 173 to 174
std::cout << "Below threshold: " << (uint8_t) * (bufOut + i) << " at " << i
<< " is correct "
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
std::cout << "Below threshold: " << (uint8_t) * (bufOut + i) << " at " << i
<< " is correct "
std::cout << "Below threshold: " << (uint8_t) * (bufOut + i) << " at "
<< i << " is correct "


extern "C" {

//#if BIT_WIDTH == 8
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
//#if BIT_WIDTH == 8
// #if BIT_WIDTH == 8

//
//===----------------------------------------------------------------------===//

//#define __AIENGINE__ 1
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
//#define __AIENGINE__ 1
// #define __AIENGINE__ 1

const int32_t height,
const int32_t width) {
//::aie::vector<int16_t, 16> WT(66, 129, 25, 128); //Y=0.299*R + 0.587*G +
//:0.114*B (BT.470) :aie::vector<int16_t, 16> WT(25, 129, 66, 128);
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
//:0.114*B (BT.470) :aie::vector<int16_t, 16> WT(25, 129, 66, 128);
//: 0.114*B (BT.470) :aie::vector<int16_t, 16> WT(25, 129, 66, 128);

//
//===----------------------------------------------------------------------===//

//#define __AIENGINE__ 1
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
//#define __AIENGINE__ 1
// #define __AIENGINE__ 1

XF_THRESHOLD_TYPE_TOZERO_INV = 4,
};

//#define THRESH_TYPE XF_THRESHOLD_TYPE_BINARY
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
//#define THRESH_TYPE XF_THRESHOLD_TYPE_BINARY
// #define THRESH_TYPE XF_THRESHOLD_TYPE_BINARY

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

black

reference_designs/ipu-xrt/matrix_multiplication/aie2.py|200 col 1|
reference_designs/ipu-xrt/passthrough_hardware/aie2.py|25|
reference_designs/ipu-xrt/passthrough_hardware/aie2.py|27 col 1|
reference_designs/ipu-xrt/passthrough_hardware/aie2.py|31|
reference_designs/ipu-xrt/passthrough_hardware/aie2.py|35|
reference_designs/ipu-xrt/passthrough_hardware/aie2.py|41|
reference_designs/ipu-xrt/passthrough_hardware/aie2.py|44|
reference_designs/ipu-xrt/passthrough_hardware/aie2.py|51|
reference_designs/ipu-xrt/passthrough_hardware/aie2.py|54|
reference_designs/ipu-xrt/passthrough_hardware/aie2.py|64 col 1|
reference_designs/ipu-xrt/vector_scalar/aie2.py|18 col 1|
reference_designs/ipu-xrt/vector_scalar/aie2.py|26|
reference_designs/ipu-xrt/vector_scalar/aie2.py|29|
reference_designs/ipu-xrt/vector_scalar/aie2.py|37|
reference_designs/ipu-xrt/vector_scalar/aie2.py|41|
reference_designs/ipu-xrt/vector_scalar/aie2.py|47|
reference_designs/ipu-xrt/vector_scalar/aie2.py|69 col 1|
reference_designs/ipu-xrt/vector_scalar/aie2.py|74|
reference_designs/ipu-xrt/vector_scalar/aie2.py|77 col 1|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|21|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|24|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|31|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|33 col 1|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|37|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|46|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|50|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|60|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|80|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|82|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|89|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|91|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|94|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|98|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|101|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|113|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|115|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|118|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|122|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|125|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|137|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|139|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|142|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|146|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|149|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|161|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|163|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|166|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|170|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|173|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|179|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|181|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|184 col 1|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|186|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|190|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|192|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|194|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|196|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|198|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|200|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|202|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|204|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|206|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|209|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|215|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|225 col 1|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|24|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|33|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|35 col 1|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|39|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|41|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|45|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|48|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|61|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|69|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|75|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|80|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|87|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|92|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|204|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|259|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|262|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|267|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|285|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|288 col 1|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|19|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|32|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|34 col 1|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|35|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|39|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|43|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|46|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|57|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|65|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|68|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|70|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|77|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|80|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|91|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|93|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|96|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|112|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|136|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|164|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|171|
reference_designs/lit.cfg.py|42|
reference_designs/lit.cfg.py|45|
reference_designs/lit.cfg.py|47|

from aie.dialects.extras import memref, arith
from aie.util import mlir_mod_ctx

def my_add_one_objFifo():
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
def my_add_one_objFifo():
def my_add_one_objFifo():

from aie.util import mlir_mod_ctx

def my_add_one_objFifo():

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

Comment on lines 23 to 24
memRef_16_ty = T.memref(16, T.i32())
memRef_8_ty = T.memref(8, T.i32())
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
memRef_16_ty = T.memref(16, T.i32())
memRef_8_ty = T.memref(8, T.i32())
memRef_16_ty = T.memref(16, T.i32())
memRef_8_ty = T.memref(8, T.i32())

memRef_16_ty = T.memref(16, T.i32())
memRef_8_ty = T.memref(8, T.i32())
ofifo_memRef_16_ty = TypeAttr.get(ObjectFifoType.get(memRef_16_ty))
ofifo_memRef_8_ty = TypeAttr.get(ObjectFifoType.get(memRef_8_ty))
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
ofifo_memRef_8_ty = TypeAttr.get(ObjectFifoType.get(memRef_8_ty))
ofifo_memRef_8_ty = TypeAttr.get(ObjectFifoType.get(memRef_8_ty))

Comment on lines 29 to 30
ShimTile = tile(0, 0)
MemTile = tile(0, 1)
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
ShimTile = tile(0, 0)
MemTile = tile(0, 1)
ShimTile = tile(0, 0)
MemTile = tile(0, 1)

Comment on lines 79 to 80
ShimTile = tile(0, 0)
MemTile = tile(0, 1)
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
ShimTile = tile(0, 0)
MemTile = tile(0, 1)
ShimTile = tile(0, 0)
MemTile = tile(0, 1)

Comment on lines 86 to 90
objectfifo("memA", MemTile, [ComputeTile2], 2, ofifo_memRef_A_ty,
[(m//r, r*k*word_size_in//4),
(k//s, s*word_size_in//4),
(r, k*word_size_in//4),
(s*word_size_in//4, 1)], [])
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
objectfifo("memA", MemTile, [ComputeTile2], 2, ofifo_memRef_A_ty,
[(m//r, r*k*word_size_in//4),
(k//s, s*word_size_in//4),
(r, k*word_size_in//4),
(s*word_size_in//4, 1)], [])
objectfifo(
"memA",
MemTile,
[ComputeTile2],
2,
ofifo_memRef_A_ty,
[
(m // r, r * k * word_size_in // 4),
(k // s, s * word_size_in // 4),
(r, k * word_size_in // 4),
(s * word_size_in // 4, 1),
],
[],
)

Comment on lines 95 to 99
objectfifo("memB", MemTile, [ComputeTile2], 2, ofifo_memRef_B_ty,
[(k//s, s*n*word_size_in//4),
(n//t, t*word_size_in//4),
(s, n*word_size_in//4),
(t*word_size_in//4, 1)], [])
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
objectfifo("memB", MemTile, [ComputeTile2], 2, ofifo_memRef_B_ty,
[(k//s, s*n*word_size_in//4),
(n//t, t*word_size_in//4),
(s, n*word_size_in//4),
(t*word_size_in//4, 1)], [])
objectfifo(
"memB",
MemTile,
[ComputeTile2],
2,
ofifo_memRef_B_ty,
[
(k // s, s * n * word_size_in // 4),
(n // t, t * word_size_in // 4),
(s, n * word_size_in // 4),
(t * word_size_in // 4, 1),
],
[],
)

Comment on lines 104 to 108
objectfifo("outC", MemTile, [ShimTile], 2, ofifo_memRef_C_ty,
[(m//r, r*n*word_size_out//4),
(r, t*word_size_out//4),
(n//t, r*t*word_size_out//4),
(t*word_size_out//4, 1)], [])
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
objectfifo("outC", MemTile, [ShimTile], 2, ofifo_memRef_C_ty,
[(m//r, r*n*word_size_out//4),
(r, t*word_size_out//4),
(n//t, r*t*word_size_out//4),
(t*word_size_out//4, 1)], [])
objectfifo(
"outC",
MemTile,
[ShimTile],
2,
ofifo_memRef_C_ty,
[
(m // r, r * n * word_size_out // 4),
(r, t * word_size_out // 4),
(n // t, r * t * word_size_out // 4),
(t * word_size_out // 4, 1),
],
[],
)

objectfifo_link(["memC"], ["outC"])

# Set up compute tiles

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

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

black

reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|91|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|94|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|98|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|101|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|113|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|115|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|118|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|122|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|125|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|137|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|139|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|142|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|146|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|149|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|161|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|163|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|166|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|170|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|173|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|179|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|181|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|184 col 1|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|186|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|190|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|192|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|194|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|196|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|198|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|200|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|202|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|204|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|206|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|209|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|215|
reference_designs/ipu-xrt/vision_pipelines/color_threshold/aie2_colorThreshold.py|225 col 1|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|24|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|33|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|35 col 1|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|39|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|41|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|45|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|48|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|61|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|69|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|75|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|80|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|87|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|92|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|204|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|259|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|262|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|267|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|285|
reference_designs/ipu-xrt/vision_pipelines/edge_detect/aie2_edgeDetect.py|288 col 1|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|19|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|32|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|34 col 1|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|35|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|39|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|43|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|46|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|57|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|65|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|68|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|70|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|77|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|80|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|91|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|93|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|96|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|112|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|136|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|164|
reference_designs/ipu-xrt/vision_pipelines/passthrough/aie2.py|171|
reference_designs/lit.cfg.py|42|
reference_designs/lit.cfg.py|45|
reference_designs/lit.cfg.py|47|


print(ctx.module)

my_matmul()
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
my_matmul()
my_matmul()

if len(sys.argv) == 2:
N = int(sys.argv[1])

def my_passthrough():
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
def my_passthrough():


def my_passthrough():

with mlir_mod_ctx() as ctx:
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
with mlir_mod_ctx() as ctx:
def my_passthrough():
with mlir_mod_ctx() as ctx:


@device(AIEDevice.ipu)
def device_body():
memRef_ty = T.memref(1024, T.i32())
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
memRef_ty = T.memref(1024, T.i32())
memRef_ty = T.memref(1024, T.i32())

ofifo_memRef_ty = TypeAttr.get(ObjectFifoType.get(memRef_ty))

# Tile declarations
ShimTile = tile(0, 0)
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
ShimTile = tile(0, 0)
ShimTile = tile(0, 0)

Comment on lines 50 to 51
ShimTile = tile(0, 0)
MemTile = tile(0, 1)
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
ShimTile = tile(0, 0)
MemTile = tile(0, 1)
ShimTile = tile(0, 0)
MemTile = tile(0, 1)

Comment on lines 60 to 73
objectfifo("inOOB_L3L2", ShimTile, [MemTile], 2, ofifo_line_channels_ty, [], [])
objectfifo("inOOB_L2L1_0", MemTile, [ComputeTile2], 2, ofifo_line_ty, [], [])
objectfifo("inOOB_L2L1_1", MemTile, [ComputeTile3], 2, ofifo_line_ty, [], [])
objectfifo("inOOB_L2L1_2", MemTile, [ComputeTile4], 2, ofifo_line_ty, [], [])
objectfifo("inOOB_L2L1_3", MemTile, [ComputeTile5], 2, ofifo_line_ty, [], [])
objectfifo_link(["inOOB_L3L2"], ["inOOB_L2L1_0", "inOOB_L2L1_1", "inOOB_L2L1_2", "inOOB_L2L1_3"])

# Output RGBA
objectfifo("outOOB_L2L3", MemTile, [ShimTile], 2, ofifo_line_channels_ty, [], [])
objectfifo("outOOB_L1L2_0", ComputeTile2, [MemTile], 2, ofifo_line_ty, [], [])
objectfifo("outOOB_L1L2_1", ComputeTile3, [MemTile], 2, ofifo_line_ty, [], [])
objectfifo("outOOB_L1L2_2", ComputeTile4, [MemTile], 2, ofifo_line_ty, [], [])
objectfifo("outOOB_L1L2_3", ComputeTile5, [MemTile], 2, ofifo_line_ty, [], [])
objectfifo_link(["outOOB_L1L2_0", "outOOB_L1L2_1", "outOOB_L1L2_2", "outOOB_L1L2_3"], ["outOOB_L2L3"])
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
objectfifo("inOOB_L3L2", ShimTile, [MemTile], 2, ofifo_line_channels_ty, [], [])
objectfifo("inOOB_L2L1_0", MemTile, [ComputeTile2], 2, ofifo_line_ty, [], [])
objectfifo("inOOB_L2L1_1", MemTile, [ComputeTile3], 2, ofifo_line_ty, [], [])
objectfifo("inOOB_L2L1_2", MemTile, [ComputeTile4], 2, ofifo_line_ty, [], [])
objectfifo("inOOB_L2L1_3", MemTile, [ComputeTile5], 2, ofifo_line_ty, [], [])
objectfifo_link(["inOOB_L3L2"], ["inOOB_L2L1_0", "inOOB_L2L1_1", "inOOB_L2L1_2", "inOOB_L2L1_3"])
# Output RGBA
objectfifo("outOOB_L2L3", MemTile, [ShimTile], 2, ofifo_line_channels_ty, [], [])
objectfifo("outOOB_L1L2_0", ComputeTile2, [MemTile], 2, ofifo_line_ty, [], [])
objectfifo("outOOB_L1L2_1", ComputeTile3, [MemTile], 2, ofifo_line_ty, [], [])
objectfifo("outOOB_L1L2_2", ComputeTile4, [MemTile], 2, ofifo_line_ty, [], [])
objectfifo("outOOB_L1L2_3", ComputeTile5, [MemTile], 2, ofifo_line_ty, [], [])
objectfifo_link(["outOOB_L1L2_0", "outOOB_L1L2_1", "outOOB_L1L2_2", "outOOB_L1L2_3"], ["outOOB_L2L3"])
objectfifo(
"inOOB_L3L2", ShimTile, [MemTile], 2, ofifo_line_channels_ty, [], []
)
objectfifo(
"inOOB_L2L1_0", MemTile, [ComputeTile2], 2, ofifo_line_ty, [], []
)
objectfifo(
"inOOB_L2L1_1", MemTile, [ComputeTile3], 2, ofifo_line_ty, [], []
)
objectfifo(
"inOOB_L2L1_2", MemTile, [ComputeTile4], 2, ofifo_line_ty, [], []
)
objectfifo(
"inOOB_L2L1_3", MemTile, [ComputeTile5], 2, ofifo_line_ty, [], []
)
objectfifo_link(
["inOOB_L3L2"],
["inOOB_L2L1_0", "inOOB_L2L1_1", "inOOB_L2L1_2", "inOOB_L2L1_3"],
)
# Output RGBA
objectfifo(
"outOOB_L2L3", MemTile, [ShimTile], 2, ofifo_line_channels_ty, [], []
)
objectfifo(
"outOOB_L1L2_0", ComputeTile2, [MemTile], 2, ofifo_line_ty, [], []
)
objectfifo(
"outOOB_L1L2_1", ComputeTile3, [MemTile], 2, ofifo_line_ty, [], []
)
objectfifo(
"outOOB_L1L2_2", ComputeTile4, [MemTile], 2, ofifo_line_ty, [], []
)
objectfifo(
"outOOB_L1L2_3", ComputeTile5, [MemTile], 2, ofifo_line_ty, [], []
)
objectfifo_link(
["outOOB_L1L2_0", "outOOB_L1L2_1", "outOOB_L1L2_2", "outOOB_L1L2_3"],
["outOOB_L2L3"],
)

rtpComputeTile3 = Buffer(ComputeTile3, [16], T.i32(), "rtpComputeTile3")
rtpComputeTile4 = Buffer(ComputeTile4, [16], T.i32(), "rtpComputeTile4")
rtpComputeTile5 = Buffer(ComputeTile5, [16], T.i32(), "rtpComputeTile5")

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

rtpComputeTile5 = Buffer(ComputeTile5, [16], T.i32(), "rtpComputeTile5")

# Set up compute tiles

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

# thresholdValue = arith.trunci(T.i16(), memref.load(rtpComputeTile2, [0]))
# maxValue = arith.trunci(T.i16(), memref.load(rtpComputeTile2, [1]))
# thresholdType = arith.trunci(T.i8(), memref.load(rtpComputeTile2, [2]))
maxValue = arith.constant(255, T.i16())
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
maxValue = arith.constant(255, T.i16())
maxValue = arith.constant(255, T.i16())

@makslevental
Copy link
Contributor

makslevental commented Dec 5, 2023

@jackl-xilinx you need to run black formatter on all of the python files (pip install black && black reference_designs).

@jackl-xilinx jackl-xilinx marked this pull request as ready for review December 5, 2023 00:49
Copy link
Collaborator

@denolf denolf left a comment

Choose a reason for hiding this comment

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

Thanks for wrapping this up @jackl-xilinx.

@jgmelber
Copy link
Collaborator Author

jgmelber commented Dec 5, 2023

@makslevental can we ignore this directory in the clang-tidy check: reference_designs/ipu-xrt/vision_pipelines/vision_kernels ?

@jackl-xilinx jackl-xilinx merged commit b6016fd into main Dec 5, 2023
6 of 7 checks passed
@makslevental makslevental deleted the examples2 branch December 7, 2023 17:08
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.

9 participants