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

详细解释homework4 #17

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

jiayaozhang
Copy link

@jiayaozhang jiayaozhang commented Jan 11, 2022

  1. size_t 在 64 位系统上相当于 uint64_t size_t 在 32 位系统上相当于 uint32_t 从而不需要用 movslq 从 32 位符号扩展到 64 位,更高效。而且也能处理数组大小超过 INT_MAX 的情况,推荐始终用 size_t 表示数组大小和索引
  2. 开启优化:-O3
  3. 浮点作为参数和返回:xmm系列寄存器 xmm寄存器有128位宽, 可以容纳4个float,或2个double
  4. SIMD(single-instruction multiple-data)称为单个指令处理多个数据的技术,他可以大大增加计算密集型程序的吞吐量
  5. AOS:紧凑存储多个属性. 符合一般面向对象编程(OOP)的习惯,但常常不利于性能
  6. SOA:分离存储多个属性. 不符合面向对象编程(OOP)的习惯,但常常有利于性能。又称之为面向数据编程 (DOP)
  7. AOSOA: SOA便于SIMD优化;AOS便于存储在传统容器;AOSOA两者得兼!
  8. 对齐到 16 或 64 字节
  9. 试试看 #pragma omp simd
  10. 循环中不变的常量挪到外面来
  11. 对小循环体用 #pragma unroll
  12. -ffast-math 和 -march=native

homework4 对我来说难度有点大 ,因为我汇编基础很差,只能结合视频把homework理解并吃透了

@archibate
Copy link
Contributor

archibate commented Jan 11, 2022 via email

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