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][Docs] Update Vitis HLS host code to support load/store data from/to files #220

Merged
merged 7 commits into from
Oct 7, 2024

Conversation

chhzh123
Copy link
Member

@chhzh123 chhzh123 commented Oct 7, 2024

Description

This PR fixes #162. It adds support to streamline the bitstream execution process from Python. Now users can directly pass in Numpy array and call the module/bitstream just like what they do for software testing.

This PR also fixes a bug of passing in scalars in the host code (related to #219).

Examples

import allo
from allo.ir.types import bool, int32
import numpy as np

def test_scalar_not_array():
    def top(inst: bool, C: int32[3]):
        flag: bool = inst[0]
        if flag:
            C[0] = C[0] + 1

    s = allo.customize(top)
    mod = s.build(target="vitis_hls", mode="hw", project="test_scalar.prj")
    C = np.array([1, 2, 3], dtype=np.int32)
    # execute the bitstream
    mod(1, C)
    np.testing.assert_allclose(C, [2, 2, 3], rtol=1e-5)
    print("Passed!")

test_scalar_not_array()

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 5d4351b into main Oct 7, 2024
2 checks passed
@chhzh123 chhzh123 deleted the fix_vitis_host branch November 6, 2024 15:58
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.

[Feature] Test HW on board using allo to generate the input
1 participant