-
Notifications
You must be signed in to change notification settings - Fork 32
Add Python Programming Example #590
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
Conversation
WIP: First steps toward build/run on npu for python example. Builds but does not run yet. test.ccp is not correct but it is now running on the device. Also removed lit files for now while I debug wip: small progress test is running now, but does not check values in a meaningful way 'make run' now passes with a meaningful check!
|
||
## Run and test with AIR utility functions | ||
|
||
This is the cleanest and simplest method of running MLIR-AIR code on NPUs, and uses code in the [run.py](run.py) file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be a little generic, it doesn't really describe what is happening: compile + run/verify
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! I elaborated quite a bit in a recent commit. Can you double check that what I wrote is precise/correct/understandable?
I wasn't sure how much to put for explanation, as I think this is just an example and not part of a programming guide. But maybe that thinking is wrong?
@fifield is the |
if (NOT WSL) | ||
set(CMAKE_C_COMPILER gcc-13) | ||
set(CMAKE_CXX_COMPILER g++-13) | ||
set(BOOST_ROOT /usr/include/boost CACHE STRING "Path to Boost install") | ||
set(XRT_INC_DIR /opt/xilinx/xrt/include CACHE STRING "Path to XRT cloned repo") | ||
set(XRT_LIB_DIR /opt/xilinx/xrt/lib CACHE STRING "Path to xrt_coreutil.lib") | ||
else() | ||
set(BOOST_ROOT C:/Technical/thirdParty/boost_1_83_0 CACHE STRING "Path to Boost install") | ||
set(XRT_INC_DIR C:/Technical/XRT/src/runtime_src/core/include CACHE STRING "Path to XRT cloned repo") | ||
set(XRT_LIB_DIR C:/Technical/xrtNPUfromDLL CACHE STRING "Path to xrt_coreutil.lib") | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is cut and paste, and probably useful, but I'll note we don't really have any windows support in mlir-air.
Yup. However I would like it to become not experimental and have the pass pipeline work with all the examples and tests. |
Add a python programming example that is checked end-to-end by the CI workflow. This example includes multiple workflows for how to run the code (defined using AIR python bindings) on an NPU.
To support some of the additional passes used in test/xrt (including those for dependencies), I added a new argument,
--experimental
, toaircc.py
, which will run those additional passes. It works on my example but I suspect that this will need to be changed/updated as more examples are made but I believe what I have is a reasonable starting point.To simplify the example, I also added a wrapper around the python
dma_memcpy_nd
function to supply default values and allow the caller to use python integers.