cpu-optimization-x64

Optimizes C++ x86_64 CPU code with SIMD vectorization and cache-friendly layouts.

258|48|Updated Jun 22, 2020
One-click install
npx skills add https://github.com/mindspore-ai/akg --skill cpu-optimization-x64-mindspore-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpu-optimization-x64
Source: https://github.com/mindspore-ai/akg/tree/main/akg_agents/python/akg_agents/op/resources/skills/cpp/guides/cpu-optimization-x64
Command: npx skills add https://github.com/mindspore-ai/akg --skill cpu-optimization-x64-mindspore-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide helps developers maximize x64 CPU performance by leveraging SIMD/AVX vectorization, cache-friendly layouts, and numerically stable techniques to deliver faster, more reliable kernels.

Core Features & Use Cases

  • SIMD/AVX vectorization guidance for float32 and float64 workloads.
  • Cache-friendly data layouts, loop tiling, and memory alignment strategies.
  • Compiler flags and coding patterns (loop unrolling, safe reductions, numerical stability) for portable performance improvements.

Quick Start

Provide a C++ kernel you want to optimize, and I will deliver a SIMD-enabled, cache-friendly version.

Frequently Asked Questions about cpu-optimization-x64

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize C++ compute kernels for x64 CPU performance?

To optimize C++ compute kernels for x64 CPU performance, apply SIMD/AVX vectorization, cache-friendly data layouts, and compiler flags like -O3 and -march=native to accelerate data-intensive inner loops.

What is SIMD vectorization and when do I need it for float32 workloads?

SIMD vectorization processes multiple data points simultaneously using AVX instructions. You need it for float32 and float64 workloads when compute kernels or inner loops become bottlenecks on x86_64 hardware.

What's the best way to improve cache locality in data-intensive C++ operations?

The best way to improve cache locality is implementing cache-friendly data layouts, loop tiling, and memory alignment strategies. These techniques minimize cache misses and accelerate data-intensive C++ operations.

Which compiler flags should I use for AVX vectorization in C++?

For AVX vectorization in C++, use compiler flags -O3, -march=native, and -ftree-vectorize. These enable loop unrolling and automatic vectorization to maximize x64 CPU kernel performance.

Does this SIMD optimization approach work with existing C++ projects?

Yes, this SIMD optimization approach works with existing C++ projects targeting x86_64 hardware. You provide a C++ kernel, and it delivers a SIMD-enabled, cache-friendly version with portable performance improvements.

Why do my numerically unstable reductions fail during loop unrolling?

Numerically unstable reductions fail during loop unrolling due to floating-point reordering. Applying safe reduction coding patterns and numerically stable techniques ensures reliable results while maintaining vectorization performance gains.