-
Notifications
You must be signed in to change notification settings - Fork 88
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
make pybind compilation optional #2280
Changes from 1 commit
9c8e8ac
a8968d7
dd78c66
1a38cd6
f1bbd40
470c055
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,27 +22,25 @@ | |
# THE SOFTWARE. | ||
##################################################################################### | ||
|
||
option(MIGRAPHX_ENABLE_PYTHON "Enable python bindings" ON) | ||
add_compile_definitions($<$<COMPILE_LANGUAGE:CXX,C>:MIGRAPHX_ENABLE_PYTHON>) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should only be added to the driver: |
||
add_library(migraphx_py py_loader.cpp) | ||
migraphx_generate_export_header(migraphx_py) | ||
target_include_directories(migraphx_py PRIVATE include) | ||
target_link_libraries(migraphx_py PUBLIC migraphx) | ||
rocm_install_targets(TARGETS migraphx_py INCLUDE include) | ||
if(MIGRAPHX_ENABLE_PYTHON) | ||
include(PythonModules) | ||
|
||
include(PythonModules) | ||
|
||
foreach(PYTHON_VERSION ${PYTHON_VERSIONS}) | ||
py_add_module(migraphx_pybind_${PYTHON_VERSION} migraphx_py.cpp PYTHON_VERSION ${PYTHON_VERSION} PYTHON_MODULE migraphx) | ||
target_link_libraries(migraphx_pybind_${PYTHON_VERSION} PRIVATE migraphx migraphx_tf migraphx_onnx migraphx_all_targets) | ||
rocm_install_targets(TARGETS migraphx_pybind_${PYTHON_VERSION}) | ||
add_dependencies(migraphx_py migraphx_pybind_${PYTHON_VERSION}) | ||
|
||
add_library(migraphx_py_${PYTHON_VERSION} py.cpp) | ||
target_include_directories(migraphx_py_${PYTHON_VERSION} PRIVATE include) | ||
target_link_libraries(migraphx_py_${PYTHON_VERSION} PUBLIC migraphx) | ||
target_link_libraries(migraphx_py_${PYTHON_VERSION} PRIVATE pybind11::pybind11 python${PYTHON_VERSION}::runtime) | ||
rocm_install_targets(TARGETS migraphx_py_${PYTHON_VERSION}) | ||
add_dependencies(migraphx_py migraphx_py_${PYTHON_VERSION}) | ||
endforeach() | ||
endif() | ||
foreach(PYTHON_VERSION ${PYTHON_VERSIONS}) | ||
py_add_module(migraphx_pybind_${PYTHON_VERSION} migraphx_py.cpp PYTHON_VERSION ${PYTHON_VERSION} PYTHON_MODULE migraphx) | ||
target_link_libraries(migraphx_pybind_${PYTHON_VERSION} PRIVATE migraphx migraphx_tf migraphx_onnx migraphx_all_targets) | ||
rocm_install_targets(TARGETS migraphx_pybind_${PYTHON_VERSION}) | ||
add_dependencies(migraphx_py migraphx_pybind_${PYTHON_VERSION}) | ||
|
||
add_library(migraphx_py_${PYTHON_VERSION} py.cpp) | ||
target_include_directories(migraphx_py_${PYTHON_VERSION} PRIVATE include) | ||
target_link_libraries(migraphx_py_${PYTHON_VERSION} PUBLIC migraphx) | ||
target_link_libraries(migraphx_py_${PYTHON_VERSION} PRIVATE pybind11::pybind11 python${PYTHON_VERSION}::runtime) | ||
rocm_install_targets(TARGETS migraphx_py_${PYTHON_VERSION}) | ||
add_dependencies(migraphx_py migraphx_py_${PYTHON_VERSION}) | ||
endforeach() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you preserve the formatting? Its hard to tell what is changed here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I moved |
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.
Can we write this as:
Thats the way do other options.
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.
The library
migraphx_py
is not entirely compiling on Windows. I want to avoid issues reported about that fact by not exposing the option on Windows. That may change in the future as soon as complete support is introduced. However, at the moment, it is not our priority. Please let me know if you still want me to change it.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.
We would still want to have an option to enable it, otherwise we wont be able to test this without modifying the cmake.