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

Export symbol from DLL in test_jit #2861

Merged
merged 18 commits into from
Jun 6, 2024
Merged

Export symbol from DLL in test_jit #2861

merged 18 commits into from
Jun 6, 2024

Conversation

apwojcik
Copy link
Collaborator

@apwojcik apwojcik commented Mar 6, 2024

On Windows, the symbol must be exported from the DLL for the test to see the function while dynamically loading the library.

@apwojcik apwojcik added the Windows Related changes for Windows Environments label Mar 6, 2024
@apwojcik apwojcik requested a review from pfultz2 March 6, 2024 17:08
@apwojcik apwojcik requested a review from causten as a code owner March 6, 2024 17:08
@migraphx-bot
Copy link
Collaborator

migraphx-bot commented Mar 6, 2024

Test Batch Rate new
4fa549
Rate old
206e0f
Diff Compare
torchvision-resnet50 64 1,750.65 1,750.99 -0.02%
torchvision-resnet50_fp16 64 4,084.89 4,085.88 -0.02%
torchvision-densenet121 32 1,465.83 1,465.87 -0.00%
torchvision-densenet121_fp16 32 2,530.14 2,524.65 0.22%
torchvision-inceptionv3 32 889.67 890.07 -0.04%
torchvision-inceptionv3_fp16 32 1,482.02 1,483.80 -0.12%
cadene-inceptionv4 16 412.15 412.53 -0.09%
cadene-resnext64x4 16 419.56 419.70 -0.03%
slim-mobilenet 64 4,007.04 4,007.04 0.00%
slim-nasnetalarge 64 101.02 101.00 0.02%
slim-resnet50v2 64 1,681.18 1,681.03 0.01%
bert-mrpc-onnx 8 616.10 615.98 0.02%
bert-mrpc-tf 1 279.51 279.26 0.09%
pytorch-examples-wlang-gru 1 320.19 324.15 -1.22%
pytorch-examples-wlang-lstm 1 290.40 327.92 -11.44% 🔴
torchvision-resnet50_1 1 469.23 469.45 -0.05%
cadene-dpn92_1 1 247.32 247.24 0.03%
cadene-resnext101_1 1 204.17 203.51 0.33%
onnx-taau-downsample 1 206.38 206.27 0.06%
dlrm-criteoterabyte 1 22.86 22.91 -0.23%
dlrm-criteoterabyte_fp16 1 42.69 42.74 -0.11%
agentmodel 1 6,310.18 6,392.31 -1.28%
unet_fp16 2 34.17 34.21 -0.12%
resnet50v1_fp16 1 603.10 597.26 0.98%
resnet50v1_int8 1 572.21 572.90 -0.12%
bert_base_cased_fp16 64 646.21 646.37 -0.03%
bert_large_uncased_fp16 32 199.02 199.03 -0.01%
bert_large_fp16 1 117.36 117.51 -0.12%
distilgpt2_fp16 16 1,210.84 1,211.72 -0.07%
yolov5s 1 302.09 302.25 -0.05%
tinyllama 1 23.32 23.34 -0.09%
vicuna-fastchat 1 132.91 134.18 -0.95%
whisper-tiny-encoder 1 244.63 244.17 0.19%
whisper-tiny-decoder 1 256.05 256.68 -0.25%

This build is not recommended to merge 🔴

@migraphx-bot
Copy link
Collaborator

migraphx-bot commented Mar 6, 2024


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

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

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

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

     ✅ torchvision-resnet50_1: PASSED: MIGraphX meets tolerance

     ✅ cadene-dpn92_1: PASSED: MIGraphX meets tolerance

     ✅ cadene-resnext101_1: PASSED: MIGraphX meets tolerance

     ✅ dlrm-criteoterabyte: PASSED: MIGraphX meets tolerance

     ✅ agentmodel: PASSED: MIGraphX meets tolerance

     ✅ unet: PASSED: MIGraphX meets tolerance

     ✅ resnet50v1: PASSED: MIGraphX meets tolerance

     ✅ bert_base_cased_fp16: PASSED: MIGraphX meets tolerance

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


     ✅ bert_large: PASSED: MIGraphX meets tolerance

     ✅ yolov5s: PASSED: MIGraphX meets tolerance

     ✅ tinyllama: PASSED: MIGraphX meets tolerance

     ✅ vicuna-fastchat: PASSED: MIGraphX meets tolerance

     ✅ whisper-tiny-encoder: PASSED: MIGraphX meets tolerance

     ✅ whisper-tiny-decoder: PASSED: MIGraphX meets tolerance

     ✅ distilgpt2_fp16: PASSED: MIGraphX meets tolerance

Copy link

codecov bot commented Mar 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.97%. Comparing base (354bc02) to head (4fa5499).
Report is 141 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2861   +/-   ##
========================================
  Coverage    91.97%   91.97%           
========================================
  Files          489      489           
  Lines        19390    19390           
========================================
  Hits         17833    17833           
  Misses        1557     1557           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

test/jit.cpp Outdated
// NOLINTNEXTLINE
const std::string_view add_42_src = R"migraphx(
const std::string_view add_42_src = EXPORT_SYMBOL R"migraphx(
Copy link
Collaborator

@pfultz2 pfultz2 Apr 24, 2024

Choose a reason for hiding this comment

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

Instead, I would add a -DEXPORT=... define when compiling the test(they all use the compile_function so can be added there. And then in the string you can just do EXPORT extern.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@apwojcik apwojcik requested a review from pfultz2 May 8, 2024 16:20
test/jit.cpp Outdated
{
migraphx::src_compiler compiler;
compiler.flags.emplace_back("-std=c++14");
#ifndef _WIN32
compiler.flags.emplace_back("-fPIC");
compiler.flags.emplace_back("-DEXPORT=\"\"");
#else
compiler.flags.emplace_back("-DEXPORT=\"__declspec(dllexport)\"");
Copy link
Collaborator

Choose a reason for hiding this comment

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

I dont think quotes is needed for these flags.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It fails execution on Linux if "" is missing.

59/302 Test  #36: test_jit ...........................................................Subprocess aborted***Exception:   0.22 sec
[   RUN    ] simple_run
<command-line>: error: expected unqualified-id before numeric constant
main.cpp:2:1: note: in expansion of macro ‘EXPORT’
    2 | EXPORT extern "C" int add(int x)
      | ^~~~~~
terminate called after throwing an instance of 'migraphx::version_1::exception'
  what():  ../../src/process.cpp:358: check_exec: Command cd /tmp/migraphx-compile-31108-7f4a714a0b80-8fa304c59fe-cTPCBnqDd3c5VKGi; /usr/bin/c++ -std=c++14 -fPIC -DEXPORT -shared -I. main.cpp -o libsimple.so exited with status 1

@apwojcik apwojcik added the UAI label May 27, 2024
@apwojcik apwojcik requested a review from pfultz2 May 27, 2024 21:41
@causten causten requested a review from umangyadav June 6, 2024 13:43
@causten causten requested a review from ahsan-ca June 6, 2024 13:43
@causten causten merged commit cd23385 into develop Jun 6, 2024
45 checks passed
@causten causten deleted the export_symbols branch June 6, 2024 20:19
causten pushed a commit that referenced this pull request Jun 26, 2024
lajagapp pushed a commit to lajagapp/AMDMIGraphX that referenced this pull request Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
UAI Windows Related changes for Windows Environments
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants