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

cpu: make local zero_val const, to avoid internal compiler error vs2019 #805

Merged
merged 1 commit into from
Aug 13, 2020

Conversation

N-Dekker
Copy link
Contributor

Declared the local variable zero_val within the function body of
im2col const, to avoid the following error from a Release build of
Visual Studio 2019 version 16.7.1 (compiler version 19.27.29111 for x64):

D:\oneDNN\src\cpu\gemm_convolution_utils.cpp(401): fatal error C1001: Internal compiler error.
(compiler file 'd:\agent_work\7\s\src\vctools\Compiler\Utc\src\p2\main.c', line 195)
To work around this problem, try simplifying or changing the program near the locations listed above.
If possible please provide a repro here: https://developercommunity.visualstudio.com
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
CL!RaiseException()+0x69
CL!RaiseException()+0x69
CL!CloseTypeServerPDB()+0x22e6b
CL!CloseTypeServerPDB()+0xcd30a
Done building project "dnnl_cpu.vcxproj" -- FAILED.

Related compiler problem report: "VS2019 Internal compiler error using
__restrict keyword in Release build"
https://developercommunity.visualstudio.com/content/problem/1145942/vs2019-internal-compiler-error-using-restrict-keyw.html

Declared the local variable `zero_val` within the function body of
`im2col` const, to avoid the following error from a Release build of
Visual Studio 2019 version 16.7.1 (compiler version 19.27.29111 for x64):

> D:\oneDNN\src\cpu\gemm_convolution_utils.cpp(401): fatal error C1001: Internal compiler error.
> (compiler file 'd:\agent\_work\7\s\src\vctools\Compiler\Utc\src\p2\main.c', line 195)
>  To work around this problem, try simplifying or changing the program near the locations listed above.
> If possible please provide a repro here: https://developercommunity.visualstudio.com
> Please choose the Technical Support command on the Visual C++
>  Help menu, or open the Technical Support help file for more information
>   CL!RaiseException()+0x69
>   CL!RaiseException()+0x69
>   CL!CloseTypeServerPDB()+0x22e6b
>   CL!CloseTypeServerPDB()+0xcd30a
> Done building project "dnnl_cpu.vcxproj" -- FAILED.

Related compiler problem report: "VS2019 Internal compiler error using
__restrict keyword in Release build"
https://developercommunity.visualstudio.com/content/problem/1145942/vs2019-internal-compiler-error-using-restrict-keyw.html
@N-Dekker N-Dekker marked this pull request as ready for review August 12, 2020 00:37
Copy link

@emfomenk emfomenk left a comment

Choose a reason for hiding this comment

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

LGTM. Not sure why GitHub CI is unhappy.
Will check and merge this PR along with the changes from #580

Thank you!

@emfomenk emfomenk self-assigned this Aug 12, 2020
@N-Dekker
Copy link
Contributor Author

N-Dekker commented Aug 12, 2020

LGTM. Not sure why GitHub CI is unhappy.
Will check and merge this PR along with the changes from #580

Thanks @emfomenk ! The changes from #580? I guess you mean #801 😃

Did you or anyone else also get this internal compiler error in gemm_convolution_utils.cpp? It seems to me that it is a compiler bug introduced with a very recent update of VS2019 (Version 16.7 or 16.7.1, Compiler Version 19.27.29110 or 19.27.29111)

The compiler error could also be avoided by removing the __restrict keywords, but I guess that isn't what you would want!

@emfomenk
Copy link

Thanks @emfomenk ! The changes from #580? I guess you mean #801 😃

Oops, yeah, you are right.

Did you or anyone else also get this internal compiler error in gemm_convolution_utils.cpp? It seems to me that it is a compiler bug introduced with a very recent update of VS2019 (Version 16.7 or 16.7.1, Compiler Version 19.27.29110 or 19.27.29111)

No, we haven't seen such issue. But maybe we would once updated the version of cl. Currently we use 19.25.28612.

The compiler error could also be avoided by removing the __restrict keywords, but I guess that isn't what you would want!

Yeah, restrict helps with performance a bit. Let's keep it!

@N-Dekker
Copy link
Contributor Author

By the way, this PR might even improve the runtime performance, as zero_val may not need to be captured anymore by the lambda's that access the variable, once it is declared const! As can be seen in the following example:

int main()
{
    const int zero_int = 0;
    // Empty capture list!
    return []{ return zero_int; }();
}

https://godbolt.org/z/7q1T7x

@emfomenk emfomenk merged commit 6df1a36 into oneapi-src:master Aug 13, 2020
@emfomenk
Copy link

Merged!
Thank you for preventing us and out users to face the issue with VS 2019 :)

@N-Dekker
Copy link
Contributor Author

N-Dekker commented Aug 13, 2020

Thank you for preventing us and our users to face the issue with VS 2019 :)

You're welcome @emfomenk! By the way, the current vs2019 version also gets an internal compiler error on the latest oneDNN release, v.1.6.1. If you're intending to still maintain oneDNN 1.6.x for a while, you might as well cherry-pick this very little commit onto your rls-v1.6 branch :)

And of course, if you agree that this is a serious compiler bug, you may vote or leave a comment at Visual Studio problem 1145942 - VS2019 Internal compiler error using __restrict keyword in Release build

@emfomenk
Copy link

If you're intending to still maintain oneDNN 1.6.x for a while, you might as well cherry-pick this very little commit onto your rls-v1.6 branch :)

Yeah, will do (I am currently working on some other fix for master and v1.6, so will cherry-pick your fix along with mine).
Thanks for the heads-up!

@N-Dekker
Copy link
Contributor Author

As far as I can see, the compiler bug Visual Studio problem 1145942 - VS2019 Internal compiler error using __restrict keyword in Release build is fixed now, with VS2019 version 16.8.0, released on November 10, 2020.

I think so, because I just did a successful Release build of oneDNN-1.6.1 by VS2019 version 16.8.0. 😃 oneDNN-1.6.1 did not yet include this pull request, so it got an internal compiler error from VS2019 version 16.7.x.

Note that the compiler bug fix is not yet officially confirmed by Microsoft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants