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

port class 'dynamic_loader' to Windows #2278

Merged
merged 7 commits into from
Oct 11, 2023
Merged

Conversation

apwojcik
Copy link
Collaborator

@apwojcik apwojcik commented Oct 3, 2023

No description provided.

@apwojcik apwojcik added the Windows Related changes for Windows Environments label Oct 3, 2023
@apwojcik apwojcik requested a review from pfultz2 October 3, 2023 21:28
@@ -104,6 +103,11 @@ add_library(migraphx
value.cpp
verify_args.cpp
)
if(WIN32)
target_sources(migraphx PRIVATE dynamic_loader_win32.cpp)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Put this in the same file.

@codecov
Copy link

codecov bot commented Oct 3, 2023

Codecov Report

Merging #2278 (ce3f487) into develop (a50cb30) will not change coverage.
The diff coverage is n/a.

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

@@           Coverage Diff            @@
##           develop    #2278   +/-   ##
========================================
  Coverage    91.45%   91.45%           
========================================
  Files          433      433           
  Lines        16174    16174           
========================================
  Hits         14792    14792           
  Misses        1382     1382           
Files Coverage Δ
src/dynamic_loader.cpp 70.27% <ø> (ø)
src/include/migraphx/dynamic_loader.hpp 100.00% <ø> (ø)
src/include/migraphx/instruction_ref.hpp 100.00% <ø> (ø)

std::to_string(GetLastError()) + ")");
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

You need to add a move constructor and delete the copy constructor, and add an assignment operator.

}

HMODULE handle = nullptr;
std::shared_ptr<tmp_dir> temp = nullptr;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since the class is not copyable, then there is no reason to use shared_ptr here.

@@ -46,6 +47,7 @@ struct MIGRAPHX_EXPORT dynamic_loader
static fs::path path(void* address);

static optional<dynamic_loader> try_load(const fs::path& p);
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this disabled on windows?

Copy link
Collaborator Author

@apwojcik apwojcik Oct 9, 2023

Choose a reason for hiding this comment

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

For some reason, on Windows, static analysis is showing the catch part of the function is unreachable code. I made it available on Windows because it looks like a false-positive case.

@migraphx-bot
Copy link
Collaborator

migraphx-bot commented Oct 4, 2023

Test Batch Rate new
1826c7
Rate old
a3cf99
Diff Compare
torchvision-resnet50 64 2,323.50 2,324.01 -0.02%
torchvision-resnet50_fp16 64 5,349.20 5,360.36 -0.21%
torchvision-densenet121 32 1,848.22 1,849.40 -0.06%
torchvision-densenet121_fp16 32 3,411.59 3,416.34 -0.14%
torchvision-inceptionv3 32 1,295.52 1,295.53 -0.00%
torchvision-inceptionv3_fp16 32 2,541.03 2,542.43 -0.05%
cadene-inceptionv4 16 620.45 620.07 0.06%
cadene-resnext64x4 16 589.39 588.76 0.11%
slim-mobilenet 64 7,207.95 7,202.96 0.07%
slim-nasnetalarge 64 236.33 236.42 -0.04%
slim-resnet50v2 64 2,558.57 2,557.15 0.06%
bert-mrpc-onnx 8 825.14 825.82 -0.08%
bert-mrpc-tf 1 389.43 388.06 0.35%
pytorch-examples-wlang-gru 1 300.07 298.74 0.45%
pytorch-examples-wlang-lstm 1 317.39 316.37 0.32%
torchvision-resnet50_1 1 547.45 551.75 -0.78%
torchvision-inceptionv3_1 1 301.83 303.60 -0.58%
cadene-dpn92_1 1 361.26 355.10 1.73%
cadene-resnext101_1 1 220.25 220.42 -0.08%
slim-vgg16_1 1 223.93 224.28 -0.16%
slim-mobilenet_1 1 1,507.36 1,527.30 -1.31%
slim-inceptionv4_1 1 215.96 214.59 0.64%
onnx-taau-downsample 1 306.95 306.04 0.30%
dlrm-criteoterabyte 1 21.68 21.68 -0.00%
dlrm-criteoterabyte_fp16 1 40.74 40.72 0.06%
agentmodel 1 5,852.85 5,878.03 -0.43%
unet_fp16 2 55.17 55.19 -0.05%
resnet50v1_fp16 1 752.06 764.94 -1.68%
bert_base_cased_fp16 64 970.84 970.80 0.00%
bert_large_uncased_fp16 32 305.09 305.06 0.01%
bert_large_fp16 1 167.22 166.95 0.16%
distilgpt2_fp16 16 1,352.59 1,352.32 0.02%

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

@apwojcik apwojcik requested a review from pfultz2 October 8, 2023 20:31
std::to_string(GetLastError()) + ")");
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Make sure to delete the copy constructor and add a an assignment operator.

@apwojcik apwojcik requested a review from pfultz2 October 9, 2023 13:03
Copy link
Collaborator

@causten causten left a comment

Choose a reason for hiding this comment

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

There is a cpp check failure that needs to be addressed

@causten causten merged commit df5f8c9 into develop Oct 11, 2023
14 of 15 checks passed
@causten causten deleted the port_dynamic_loader_windows branch October 11, 2023 17:48
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