Project

General

Profile

Bug #441

Windows SSE build fails with both icc and MSVC

Added by Sander Pronk over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Erik Lindahl
Category:
mdrun
Target version:
Affected version - extra info:
Affected version:
Difficulty:
uncategorized
Close

Description

The current git version's SSE intrinsics work in neither MSVC nor icc. MSVC complains about alignment problems, for example:
C:\Users\Sander\git\gromacs-master\include\gmx_sse2_single.h(171) : error C2719: 't3': formal parameter with __declspec(align('16')) won't be aligned

In icc, the problem seems easier to fix, there the issue is with a single nb_kernel source file, for example:

C:\Users\Sander\git\gromacs-master\src\gmxlib\nonbonded\nb_kernel_sse2_single\nb_kernel430_sse2_single.c(37): error: cast to type "const __m128" is not allowed

I've attached build logs for both compilers.

MSVC.buildlog (56.3 KB) MSVC.buildlog build log for MSVC compiler Sander Pronk, 06/16/2010 11:28 AM
icc.buildlog (18.4 KB) icc.buildlog build log for icc Sander Pronk, 06/16/2010 11:29 AM
msvc-64.buildlog (14.4 KB) msvc-64.buildlog Build log for MSVC, 64 bit Sander Pronk, 06/17/2010 10:26 AM

History

#1 Updated by Sander Pronk over 9 years ago

Created an attachment (id=474)
build log for MSVC compiler

build log for MSVC compiler

#2 Updated by Sander Pronk over 9 years ago

Created an attachment (id=475)
build log for icc

#3 Updated by Peter Kasson over 9 years ago

The icc errors come from using typecasts instead of the macros we had defined. There must have been some new SSE code introduced that doesn't place nice with the macros.

The macros are in gmx_sse2_single.h:
#if (defined (MSC_VER) || defined(_INTEL_COMPILER))
  1. define gmx_mm_castsi128_ps(a) _mm_castsi128_ps(a)
  2. define gmx_mm_castps_si128(a) _mm_castps_si128(a)
  3. define gmx_mm_castps_ps128(a) (a)
    #elif defined(GNUC)
  4. define gmx_mm_castsi128_ps(a) ((__m128)(a))
  5. define gmx_mm_castps_si128(a) ((__m128i)(a))
  6. define gmx_mm_castps_ps128(a) ((_m128)(a))
    #else
    static __m128 gmx_mm_castsi128_ps(
    _m128i a) { return *(_m128 *) &a; }
    static __m128i gmx_mm_castps_si128(
    _m128 a) { return *(_m128i *) &a; }
    static __m128 gmx_mm_castps_ps128(
    _m128 a) { return *(__m128 *) &a; }
    #endif

I can go through and try to fix these, but it may be later today/tomorrow. Let me know.

For MSVC, can we pass those parameters as const's? From a google search on the error message, it seems that would fix the problem.

#4 Updated by Peter Kasson over 9 years ago

Committed a fix for the typecast errors in icc. I haven't tested Windows yet; let me know if this works.

#5 Updated by Sander Pronk over 9 years ago

That works; thanks! The resulting mdrun uses the SSE2 code.

#6 Updated by Rossen Apostolov over 9 years ago

Thanks Peter! Can we close this bug now?

#7 Updated by Sander Pronk over 9 years ago

MSVC still doesn't work - how important is MSVC right now?

#8 Updated by Erik Lindahl over 9 years ago

Hi,

We want it working while we still have Per Larsson around to fix it :-)

Is it the same issue that in the uploaded build log, or something new?

Cheers,

Erik

#9 Updated by Sander Pronk over 9 years ago

Same issue: it's a bunch of "formal parameter with __declspec(align('16')) won't be aligned" messages for all __m128 parameters of functions beyond the first three. The fix might be as simple as declaring all these functions 'static inline' instead of just 'inline'.

I'll test that when I have time.

#10 Updated by Erik Lindahl over 9 years ago

Check out http://www.kvraudio.com/forum/viewtopic.php?p=3806887

Does it work when you compile in 64 bits with MSVC?

In that case it's likely the stack alignment issue.

Cheers,

Erik

#11 Updated by Sander Pronk over 9 years ago

On MSVC for 64-bit builds I get different errors: casts from const __m128i to __m128 are not allowed. I've attached the build log.

#12 Updated by Sander Pronk over 9 years ago

Created an attachment (id=476)
Build log for MSVC, 64 bit

#13 Updated by Sander Pronk over 9 years ago

I've fixed this issue in the git master; SSE now works for everything but MSVC 32bit (which appears unfixable).

Also available in: Atom PDF