This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 1096 - MSVC 2015 CTP1 Internal compiler errors on Matrix mul
Summary: MSVC 2015 CTP1 Internal compiler errors on Matrix mul
Status: RESOLVED FIXED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - matrix products (show other bugs)
Version: 3.3 (current stable)
Hardware: x86 - 32-bit Windows
: Normal Crash
Assignee: Nobody
URL:
Whiteboard:
Keywords:
: 1125 1131 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-10-21 13:17 UTC by Retornaz Thomas
Modified: 2019-12-04 15:05 UTC (History)
6 users (show)



Attachments

Description Retornaz Thomas 2015-10-21 13:17:35 UTC
Internal compiler occurs with MSVC2015 CTP1 on below code

Note:
 * ctp1 could be found at https://www.visualstudio.com/news/vs2015-update1-vs
 * The code run gracefully on MSVC2013 and MSVC2015
 * Test done on 3.3* stable branch and 3.4 Alpha


Code to reproduce:


void test_crashmsvc2015cpt1()
{
   typedef Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic > Matrix;
   typedef Eigen::Matrix< Real, Eigen::Dynamic, 1 > Vector;

   int nbInputPlanes = 1, int nbOutputPlanes = 32, int width = 32, int height=32, int kernelSizeX = 5, int kernelSizeY = 5, int shiftX = 1, int shiftY = 1;
   const unsigned int nbRows = nbInputPlanes*height;
   const unsigned int nbCols = width;

   Matrix inputContiguous(nbRows, nbCols);
   Matrix kernels(nbInputPlanes, 3*3*nbOutputPlanes)
   Vector bias(nbOutputPlanes);


   const int outWidth = (width - 3) / 1+ 1;
   const int outHeight = (height - 3) / 1+ 1;

   Matrix result(nbOutputPlanes * outHeight, outWidth);

   int outputRow = 0; //Invariant outputRow = y*nbOutputPlanes
                      //For each Y-output row
   for (int y = 0; y < outHeight; ++y)
   {

      const Matrix intermediate = kernels.transpose() * input.middleRows(
         nbInputPlanes * shiftY * y,
         nbInputPlanes * kernelSizeY);

      const float * intermediateData = intermediate.data(); 

      for (int k = 0; k < nbOutputPlanes; ++k)
      {
         result.row(outputRow + k).setConstant(bias(k));
         result.row(outputRow + k) += intermediate.Map(
            intermediateData, kernelSizeX, outWidth,
            Stride(intermediate.rows(), 1 + intermediate.rows())).colwise().sum();
         intermediateData += kernelSizeX;
      }
      outputRow += nbOutputPlanes;
   }
}

Error from MSVC

\eigen\src\core\products\generalmatrixmatrix.h(62): fatal error C1001: An internal error has occurred in the compiler.
1>  (compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c', line 246)

Regards
TR
Comment 1 Gael Guennebaud 2015-10-22 19:50:56 UTC
This issue has to be reported to MSVC team, especially if MSVC2015 does not trigger the ICE as this mean they introduced a regression.
Comment 2 Retornaz Thomas 2015-10-23 08:47:39 UTC
Thanks for your quick answer
I forward the bug to MSVC team
Regards
TR
Comment 3 Janick Martinez Esturo 2015-12-01 16:58:54 UTC
Do you have a reference on the MSVC bug?
Comment 4 Nikolai 2015-12-03 14:33:11 UTC
Same problem. It can be fixed by changing in generalmatrixmatrix.h:
151   #pragma omp atomic
152      --(info[i].users);
to
151   #pragma omp atomic
152      info[i].users -= 1;
Comment 5 Gael Guennebaud 2015-12-04 08:30:03 UTC
*** Bug 1125 has been marked as a duplicate of this bug. ***
Comment 7 Gael Guennebaud 2015-12-04 08:39:31 UTC
btw, thanks Nikolai for the workaround, and Benoit for pushing it.
Comment 8 Gael Guennebaud 2015-12-10 15:12:33 UTC
*** Bug 1131 has been marked as a duplicate of this bug. ***
Comment 9 Nobody 2019-12-04 15:05:46 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1096.

Note You need to log in before you can comment on or make changes to this bug.