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

make pybind compilation optional #2280

Merged
merged 6 commits into from
Oct 11, 2023
Merged

make pybind compilation optional #2280

merged 6 commits into from
Oct 11, 2023

Conversation

apwojcik
Copy link
Collaborator

@apwojcik apwojcik commented Oct 3, 2023

UAI does not depend on PyBind, and there are no plans to port that part to Windows (at least at the moment).

@apwojcik apwojcik added the Windows Related changes for Windows Environments label Oct 3, 2023
@apwojcik apwojcik requested review from pfultz2 and turneram October 3, 2023 22:04
CMakeLists.txt Outdated
@@ -53,6 +53,9 @@ include(CTest)
find_package(ROCM REQUIRED)
find_package(Threads REQUIRED)

include(CMakeDependentOption)
cmake_dependent_option(MIGRAPHX_ENABLE_PYTHON "Enable python bindings" ON "WIN32" OFF)
Copy link
Collaborator

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:

if(WIN32)
option(MIGRAPHX_ENABLE_PYTHON "Enable python bindings" OFF)
else()
option(MIGRAPHX_ENABLE_PYTHON "Enable python bindings" ON)
endif()

Thats the way do other options.

Copy link
Collaborator Author

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.

Copy link
Collaborator

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.

@@ -22,27 +22,25 @@
# THE SOFTWARE.
#####################################################################################

option(MIGRAPHX_ENABLE_PYTHON "Enable python bindings" ON)
add_compile_definitions($<$<COMPILE_LANGUAGE:CXX,C>:MIGRAPHX_ENABLE_PYTHON>)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should only be added to the driver: target_compile_definitions(driver MIGRAPHX_ENABLE_PYTHON=1)

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()
Copy link
Collaborator

Choose a reason for hiding this comment

The 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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I moved if(MIGRAPHX_ENABLE_PYTHON) ... endif() from here to src/CMakeLists.txt. I wanted the file preamble to be guarded by that check, too (because of configuration issues on Windows). That is also why the indentation changed. Additionally, I moved option(MIGRAPHX_ENABLE_PYTHON...) to master CMakeLists.txt so test/CMakeLists.txt and test/py/CMakeLists.txt can see it and interpret it correctly - before the test/py/CMakeLists.txt could not see migraphx_pybind_3.8 target when Python was enabled.

@codecov
Copy link

codecov bot commented Oct 3, 2023

Codecov Report

Merging #2280 (dab6fdd) into develop (a3cf995) will not change coverage.
The diff coverage is n/a.

❗ Current head dab6fdd differs from pull request most recent head f1bbd40. Consider uploading reports for the commit f1bbd40 to get more accurate results

@@           Coverage Diff            @@
##           develop    #2280   +/-   ##
========================================
  Coverage    91.45%   91.45%           
========================================
  Files          433      433           
  Lines        16177    16177           
========================================
  Hits         14795    14795           
  Misses        1382     1382           

@apwojcik apwojcik requested a review from pfultz2 October 4, 2023 13:46
@migraphx-bot
Copy link
Collaborator

Test Batch Rate new
f1bbd4
Rate old
a3cf99
Diff Compare
torchvision-resnet50 64 2,325.10 2,322.40 0.12%
torchvision-resnet50_fp16 64 5,356.46 5,360.94 -0.08%
torchvision-densenet121 32 1,848.64 1,846.99 0.09%
torchvision-densenet121_fp16 32 3,421.88 3,410.65 0.33%
torchvision-inceptionv3 32 1,295.96 1,295.24 0.06%
torchvision-inceptionv3_fp16 32 2,540.45 2,536.02 0.17%
cadene-inceptionv4 16 620.39 619.80 0.10%
cadene-resnext64x4 16 589.52 588.66 0.15%
slim-mobilenet 64 7,200.00 7,207.48 -0.10%
slim-nasnetalarge 64 236.36 236.47 -0.05%
slim-resnet50v2 64 2,556.06 2,557.75 -0.07%
bert-mrpc-onnx 8 825.04 824.68 0.04%
bert-mrpc-tf 1 388.54 388.60 -0.02%
pytorch-examples-wlang-gru 1 298.87 300.03 -0.39%
pytorch-examples-wlang-lstm 1 317.32 317.68 -0.11%
torchvision-resnet50_1 1 547.61 551.05 -0.63%
torchvision-inceptionv3_1 1 304.26 303.30 0.32%
cadene-dpn92_1 1 356.18 356.34 -0.05%
cadene-resnext101_1 1 220.18 218.29 0.87%
slim-vgg16_1 1 223.87 223.99 -0.05%
slim-mobilenet_1 1 1,509.41 1,506.95 0.16%
slim-inceptionv4_1 1 215.39 214.27 0.52%
onnx-taau-downsample 1 304.73 306.46 -0.57%
dlrm-criteoterabyte 1 21.67 21.68 -0.02%
dlrm-criteoterabyte_fp16 1 40.69 40.75 -0.15%
agentmodel 1 5,823.16 5,812.37 0.19%
unet_fp16 2 55.14 55.12 0.04%
resnet50v1_fp16 1 770.11 757.48 1.67%
bert_base_cased_fp16 64 970.78 970.36 0.04%
bert_large_uncased_fp16 32 305.15 304.99 0.05%
bert_large_fp16 1 166.90 167.50 -0.36%
distilgpt2_fp16 16 1,351.23 1,351.60 -0.03%

This build is OK for merge ✅

@migraphx-bot
Copy link
Collaborator


    :white_check_mark:bert-mrpc-onnx: PASSED: MIGraphX meets tolerance

    :white_check_mark:bert-mrpc-tf: PASSED: MIGraphX meets tolerance

    :white_check_mark:pytorch-examples-wlang-gru: PASSED: MIGraphX meets tolerance

    :white_check_mark:pytorch-examples-wlang-lstm: PASSED: MIGraphX meets tolerance

    :white_check_mark:torchvision-resnet50_1: PASSED: MIGraphX meets tolerance

    :white_check_mark:torchvision-inceptionv3_1: PASSED: MIGraphX meets tolerance

    :white_check_mark:cadene-dpn92_1: PASSED: MIGraphX meets tolerance

    :white_check_mark:cadene-resnext101_1: PASSED: MIGraphX meets tolerance

    :white_check_mark:slim-vgg16_1: PASSED: MIGraphX meets tolerance

    :white_check_mark:slim-mobilenet_1: PASSED: MIGraphX meets tolerance

    :white_check_mark:slim-inceptionv4_1: PASSED: MIGraphX meets tolerance

    :white_check_mark:dlrm-criteoterabyte: PASSED: MIGraphX meets tolerance

    :white_check_mark:agentmodel: PASSED: MIGraphX meets tolerance

    :white_check_mark:unet: PASSED: MIGraphX meets tolerance

    :white_check_mark:resnet50v1: PASSED: MIGraphX meets tolerance

🔴bert_base_cased_fp16: FAILED: MIGraphX is not within tolerance - check verbose output


🔴bert_large_uncased_fp16: FAILED: MIGraphX is not within tolerance - check verbose output


    :white_check_mark:bert_large: PASSED: MIGraphX meets tolerance

🔴distilgpt2_fp16: FAILED: MIGraphX is not within tolerance - check verbose output

@causten causten merged commit 48afdca into develop Oct 11, 2023
8 of 9 checks passed
@causten causten deleted the make_pybind_optional branch October 11, 2023 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Windows Related changes for Windows Environments
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants