Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8625945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:54:08+00:00 2026-06-12T07:54:08+00:00

I need to optimize my matrix multiplication by using SIMD/Intel SSE. The example code

  • 0

I need to optimize my matrix multiplication by using SIMD/Intel SSE. The example code given looks like:

*x = (float*)memalign(16, size * sizeof(float));

However, I am using C++ and [found that][1] I instead of malloc (before doing SIMD), I should use new. Now, I’m further optimizing via SIMD/SSE, so I need aligned memory, so question is: do I need memalign/_aligned_malloc or is my array declared like

static float m1[SIZE][SIZE];

already aligned? (SIZE is an int)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:54:09+00:00Added an answer on June 12, 2026 at 7:54 am

    Typically, they would not be 16-byte aligned, although there is nothing in the C++ specification that would prevent your compiler from aligning such an array on a 16-byte boundary. Depending upon what compiler you’re using, there is usually a compiler-specific way to request that the array be aligned on a 16-byte boundary. For example, for gcc, you would use:

    static float m1[SIZE][SIZE] __attribute__((aligned(16)));
    

    Alternatively, you could use posix_memalign(), memalign(), or other aligned-allocation APIs available on your platform to get a block of memory with the desired alignment. As a worst case, you could even allocate memory using standard malloc() or operator new and then handle the alignment adjustment yourself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hei! I need to optimize some matrix multiplication code in c, and I'm doing
I need to optimize some code that sorts a vector<pair<int, float >> a where
I need to optimize some C code, which does lots of physics computations, using
I am have a lot of code that I need to optimize and make
I need to optimize some code where I multiply a vector of ints (32
How can I optimize this code ? I made IPFilter and I need to
I'm using JasperReporting engine, and i need to optimize reporting performance. Currently my application
I am trying to optimize some python code (to speed up some matrix operations),
I need to optimize a PL/SQL function that is currently like that: CREATE OR
I need to optimize code to get room for some new code. I do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.