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

[Backend][AIE] Add initial compilation support for Ryzen AI NPU/AIE #244

Merged
merged 17 commits into from
Nov 4, 2024

Conversation

chhzh123
Copy link
Member

@chhzh123 chhzh123 commented Nov 4, 2024

Description

This PR adds initial compilation support for Ryzen AI NPU/AIE, which contains the following parts:

  1. MLIR-AIE codegen. We directly generate the source MLIR-AIE code (in MLIR) without calling the Python binding, which avoids environment conflicts. Currently, no automatic tile sizing is supported.
  2. Ryzen AI NPU host codegen. Leverage the xrt_bo library.
  3. End-to-end compilation flow from Python to AIE bitstream/execution.
  4. Pure Python testing with Numpy. Input/output data are dumped into files. Also changed the Vitis HLS flow to directly read data from files instead of setting constant headers.

Examples

def _test_vector_scalar_add():
    Ty = int32
    M = 1024

    @df.kernel(mapping=[1])
    def core(A: Ty[M], B: Ty[M]):
        for i in range(M):
            B[i] = A[i] + 1

    top = df.build(core, target="aie")
    A = np.random.randint(0, 100, M).astype(np.int32)
    B = np.zeros(M).astype(np.int32)
    top(A, B)
    np.testing.assert_allclose(B, A + 1)
    print("PASSED!")

Checklist

  • PR's title starts with a category (e.g. [Bugfix], [IR], [Builder], etc)
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage (It would be better to provide ~2 different test cases to test the robustness of your code)
  • Code is well-documented

@chhzh123 chhzh123 merged commit f01598b into cornell-zhang:main Nov 4, 2024
1 check passed
@chhzh123 chhzh123 deleted the aie_init branch November 4, 2024 04:48
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