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

Packet switch example #2032

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

Packet switch example #2032

wants to merge 6 commits into from

Conversation

ngdymx
Copy link

@ngdymx ngdymx commented Jan 31, 2025

Packet Switch Example

A simple design that shows how to use the packet switch feature of the AIE. It uses two cores, one to multiply and one to add two vectors together. The dataflow diagram is shown below:

image

There are three data paths in the design:

  1. Data path from the shim tile to the memory tile. It is assigned with two possible packet IDs: 0 and 1.
  2. Data path from the memory tile to the add compute tile (CT0). It is assigned with packet ID: 0
  3. Data path from the memory tile to the multiply compute tile (CT1). It is assigned with packet ID: 1

The initial packet ID is generated by the shim tile (runtime_sequence part) and the packet ID is passed to the memory tile. The packet id is kept in the memory tile therefore the total packet length is increased by 4 bytes. Then the packet is read out from the memory tile the AIE automatically uses the first 4 bytes as the packet ID. Therefore, the packet ID initiated by the shim tile is used again to determine where the packet should be sent (CT0 or CT1). Finally, the processed data is sent back to the host for verification.

During the compilation, only one xclbin is generated and is shared by both add and multiply operations. Two instruction files are generated with respect to the add and multiply configurations in the shim tile.

Copy link
Collaborator

@fifield fifield left a comment

Choose a reason for hiding this comment

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

This example needs a lit script so that it runs in the automated testing. See the other programming examples for example .lit scripts.

Copy link
Member

@keryell keryell left a comment

Choose a reason for hiding this comment

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

Cool!

# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# Copyright (C) 2024, Advanced Micro Devices, Inc.
# Modified by Alfred
Copy link
Member

Choose a reason for hiding this comment

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

Is Alfred an AMD copyright lawyer? 🤔

LDFLAGS += -lxrt_coreutil
LDFLAGS += -lboost_program_options -lboost_filesystem
else ifeq ($(DEVICE),npu2)
CXXFLAGS += -c
Copy link
Member

Choose a reason for hiding this comment

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

No need to repeat the common lines in the if blocks.

Comment on lines 24 to 25
#define IN_DATATYPE int8_t
#define OUT_DATATYPE int8_t
Copy link
Member

Choose a reason for hiding this comment

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

No need for macros

Suggested change
#define IN_DATATYPE int8_t
#define OUT_DATATYPE int8_t
using IN_DATATYPE = int8_t;
using OUT_DATATYPE = int8_t;

@fifield fifield self-requested a review January 31, 2025 23:57
Copy link
Collaborator

@fifield fifield 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 making the I requested. The dates on the copyrights are perhaps a bit off, unless the files were copied from 2023 :)

@jgmelber
Copy link
Collaborator

jgmelber commented Feb 7, 2025

@AndraBisca would it be possible to assist in upgrading their example from MLIR to the IRON Python API?

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.

4 participants