↓ 跳过正文
  1. Tags/

Halide

2019

【施工中】 halide学习笔记

·1262 字·3 分钟
Halide is a programming language designed to make it easier to write high-performance image and array processing code on modern machines. halide有两个特性比较吸引人。一个是对于各种平台架构的支持。 CPU architectures: X86, ARM, MIPS, Hexagon, PowerPC Operating systems: Linux, Windows, macOS, Android, iOS, Qualcomm QuRT GPU Compute APIs: CUDA, OpenCL, OpenGL, OpenGL Compute Shaders, Apple Metal, Microsoft Direct X 12 另一个是把计算什么和怎么计算(何时计算)分离开来。

优化学习笔记(1):Loop unrolling

迫于生计,最近要学习halide 先去学习/复习一下常见的编译优化技巧。 loop unrolling,也就是循环展开,顾名思义,就是把循环展开来写。 1normal loop: 2int x; 3 for (x = 0; x < 100; x++) 4 { 5 delete(x); 6 } 7 8after loop unrolling: 9int x; 10 for (x = 0; x < 100; x += 5 ) 11 { 12 delete(x); 13 delete(x + 1); 14 delete(x + 2); 15 delete(x + 3); 16 delete(x + 4); 17 } 循环展开是一种优化,可以手动实现也可以编译器自动实现。