果粉是什么意思| 花儿乐队为什么解散| 射手座是什么性格| 身上出冷汗是什么原因| 居住证是什么| 十月五号是什么星座| 食之无味什么意思| 阴毛的作用是什么| 长期大便不成形是什么原因造成的| bkg是什么意思| aa是什么病| 什么是宫寒| 30年的婚姻是什么婚| 女娲是一个什么样的人| 十全十美是什么生肖| 买房要看什么| 神机妙算是什么意思| 独角仙生活在什么地方| 学位证是什么| 什么样的天山| nova是什么牌子| 陶氏腔积液是什么意思| 红红的苹果像什么| 脚心痒是什么预兆| 炖汤用什么鸡| 梦见床上有蛇什么预兆| 咖啡有什么作用| 澳门的货币叫什么| 体液是指什么| 梦见捡钱了是什么预兆| 什么生花| m 是什么单位| 非诚勿扰什么意思| 肚子容易胀气是什么原因| 44岁月经量少是什么原因| 郑州有什么大学| 男人断眉代表什么| 尽兴而归什么意思| 公主病是什么意思| 8月15号是什么星座| 桃字五行属什么| 网拍是什么意思| 月字旁与什么有关| 腿血栓什么症状| 郭靖黄蓉是什么电视剧| 什么克金| 阴虚火旺吃什么水果| 鹅和什么一起炖最好吃| 没什么好怕| 空调吹感冒吃什么药| 父亲节做什么手工| 男头发稀少适合什么发型| 指甲发白是什么原因| 粉尘螨是什么东西| 芦荟有什么功效| tf是什么| 法院庭长是什么级别| 梦见蛇是什么征兆| 男占258女占369什么意思| 纳豆是什么东西| 骨外科是看什么病的| 心阳虚吃什么药| 什么的老师| 甲减是什么原因引起的| 吃什么可以补胶原蛋白| 乙肝两对半阴性是什么意思| 下葬下雨是什么兆头| 茶油是什么油| 梦见自己请客吃饭是什么意思| 斛是什么意思| 喝酒后吃什么解酒最快| 跑水是什么意思| 考幼师证需要什么条件| 骶管囊肿是什么意思| 手指麻木什么原因| 鸡毛信是什么意思| 论是什么意思| 空调开不了机是什么原因| 打什么| EE什么意思| 冠冕是什么意思| 做梦是什么原因| 接龙是什么意思| 夜阑珊是什么意思| 胆囊炎是什么症状| 经血逆流的症状是什么| 8月初是什么星座| 心衰的症状是什么| 为什么会中暑| 八月八日是什么星座| 血常规血红蛋白偏高是什么原因| 天真是什么意思| 提上日程是什么意思| 苔藓是什么意思| 福建为什么叫八闽| 鲍鱼什么意思| 为什么不敢挖雍正陵墓| 什么是出轨| 甲状腺在人体什么位置| 周长是什么意思| 手机root后有什么好处和坏处| 十二月十八号是什么星座| 什么都不是| 豆腐吃多了有什么坏处| 轻贱是什么意思| 小便带血什么原因| 玛咖是什么| 金黄的什么| 做病理意味着什么| 2月出生是什么星座| 摧枯拉朽什么意思| 为什么要做包皮手术| 经常打哈欠是什么原因| 运钞车是什么车| 牙齿发炎吃什么消炎药| 山东人为什么那么高| 女的什么时候退休| 双飞是什么生肖| 艾灸能治什么| 肾阴阳两虚吃什么药| 枕秃是什么意思| 阳历7月15日是什么星座| 三尖瓣少量反流是什么意思| 观音婢是什么意思| 腹泻肚子疼吃什么药| 抑郁症吃什么药| 看甲状腺挂什么科| rpr阴性是什么意思| 蒲瓜是什么瓜| 紫砂壶什么泥料最好| 六月二十四是什么星座| 妇科假丝酵母菌是什么病| e-mail什么意思| 龋齿是什么| 18度穿什么衣服合适| 高什么远什么| 脚心烧是什么原因| 梦见下雪是什么意思| 动脉导管未闭对宝宝有什么影响| 肝什么相照| 野生刺猬吃什么食物| 秋葵不适宜什么人吃| 肚子经常疼是什么原因| 肛塞有什么用| 1月23号什么星座| 勉铃是什么| 新西兰移民需要什么条件| 什么叫阈值| peb是什么意思| 牛鞭是什么| 粘鞋子用什么胶水最好| 五常是什么| 玉竹长什么样子| pda是什么| dpm值是什么意思| 有两把刷子是什么意思| acth是什么| 世袭罔替什么意思| 手掌发红是什么病| loves是什么意思| fda什么意思| kw是什么单位| 落枕挂什么科| 淋巴结炎挂什么科| 七个月宝宝可以吃什么辅食| 什么是孝顺| 拉脱水是什么症状| 毛豆是什么豆| 物心念什么| 小孩体质差吃什么能增强抵抗力| leg是什么意思| uranus是什么星球| 满月打什么疫苗| 给男人补身体煲什么汤| 防空警报是什么| cp感什么意思| 做雪糕需要什么材料| 序五行属什么| 纳氏囊肿是什么意思| 北极贝长什么样| 小孩磨牙是什么原因引起的| 脚背疼挂什么科| cpc是什么意思啊| 咽喉炎挂什么科| 补充电解质是什么意思| 什么人容易得梦游症| hpv什么病毒| 10月3号是什么星座| 嫔妃是什么意思| 什么是答题卡| 孕激素高是什么原因| 胬肉是什么意思| eca是什么意思| 专场是什么意思| 破卵针是什么| 山炮是什么意思| 露酒是什么酒| 一拃是什么意思| 俄罗斯人是什么人种| 晚上总是睡不着觉是什么原因| 棉涤是什么面料| 骶髂关节在什么位置| 京酱肉丝用什么肉| 葡萄糖高是什么意思| 对牛弹琴是什么意思| 尿酸高看什么科室最好| 口腔溃疡是什么| 治甲沟炎用什么药膏好| 佳什么意思| 四月是什么星座| 朋友是什么意思| 穆字五行属什么| 10月11是什么星座| 切糕为什么这么贵| 付诸东流是什么意思| 额头容易出汗是什么原因| 男生下体痒是什么原因| 猪蹄子炖什么好吃| 英语四级是什么水平| 胃息肉有什么症状| 牒是什么意思| 割包皮有什么影响| tb是什么意思| 一什么桥| 浅紫色配什么颜色好看| 白配什么颜色好看| 淋漓不尽是什么意思| 钰字五行属什么| 芥菜是什么菜| 头上出汗是什么原因| 新生儿痤疮是什么引起的| 诚字属于五行属什么| 中药学是干什么的| 儿童乘坐飞机需要什么证件| 常流鼻血是什么原因| 龙和什么属相相克| 香蕉什么时候吃最好| 胆红素偏高有什么危害| 胃疼做什么检查| 财迷是什么意思| 脸上长湿疹是什么原因| 翊字是什么意思| 什么是乙肝| 会厌炎吃什么药最有效| 附属国是什么意思| 早期教育是什么专业| 饮鸩止渴是什么意思| 井代表什么生肖| nt什么时候做| 锁骨疼是什么原因| 脚冰凉吃什么药| 非农业户口是什么意思| 瓜婆娘四川话是什么意思| 明哲保身是什么生肖| 桂圆龙眼有什么区别| 子宫内膜厚是什么原因引起的| 加拿大用什么货币| pdl是什么意思| 身份证x代表什么意思| 意守丹田是什么意思| 门特是什么意思| 腰椎退行性变什么意思| 梦见掉了三颗牙齿是什么意思| 雍正是什么星座| 百度Jump to content

肖战是什么星座

From Wikipedia, the free encyclopedia
百度 ”(文/本报记者李铁柱)+1

In computer science, instruction scheduling is a compiler optimization used to improve instruction-level parallelism, which improves performance on machines with instruction pipelines. Put more simply, it tries to do the following without changing the meaning of the code:

  • Avoid pipeline stalls by rearranging the order of instructions.[1]
  • Avoid illegal or semantically ambiguous operations (typically involving subtle instruction pipeline timing issues or non-interlocked resources).

The pipeline stalls can be caused by structural hazards (processor resource limit), data hazards (output of one instruction needed by another instruction) and control hazards (branching).

Data hazards

[edit]

Instruction scheduling is typically done on a single basic block. In order to determine whether rearranging the block's instructions in a certain way preserves the behavior of that block, we need the concept of a data dependency. There are three types of dependencies, which also happen to be the three data hazards:

  1. Read after Write (RAW or "True"): Instruction 1 writes a value used later by Instruction 2. Instruction 1 must come first, or Instruction 2 will read the old value instead of the new.
  2. Write after Read (WAR or "Anti"): Instruction 1 reads a location that is later overwritten by Instruction 2. Instruction 1 must come first, or it will read the new value instead of the old.
  3. Write after Write (WAW or "Output"): Two instructions both write the same location. They must occur in their original order.

Technically, there is a fourth type, Read after Read (RAR or "Input"): Both instructions read the same location. Input dependence does not constrain the execution order of two statements, but it is useful in scalar replacement of array elements.

To make sure we respect the three types of dependencies, we construct a dependency graph, which is a directed graph where each vertex is an instruction and there is an edge from I1 to I2 if I1 must come before I2 due to a dependency. If loop-carried dependencies are left out, the dependency graph is a directed acyclic graph. Then, any topological sort of this graph is a valid instruction schedule. The edges of the graph are usually labelled with the latency of the dependence. This is the number of clock cycles that needs to elapse before the pipeline can proceed with the target instruction without stalling.

Algorithms

[edit]

The simplest algorithm to find a topological sort is frequently used and is known as list scheduling. Conceptually, it repeatedly selects a source of the dependency graph, appends it to the current instruction schedule and removes it from the graph. This may cause other vertices to be sources, which will then also be considered for scheduling. The algorithm terminates if the graph is empty.

To arrive at a good schedule, stalls should be prevented. This is determined by the choice of the next instruction to be scheduled. A number of heuristics are in common use:

  • The processor resources used by the already scheduled instructions are recorded. If a candidate uses a resource that is occupied, its priority will drop.
  • If a candidate is scheduled closer to its predecessors than the associated latency, its priority will drop.
  • If a candidate lies on the critical path of the graph, its priority will rise. This heuristic provides some form of look-ahead in an otherwise local decision process.
  • If choosing a candidate will create many new sources, its priority will rise. This heuristic tends to generate more freedom for the scheduler.

Phase order

[edit]

Instruction scheduling may be done either before or after register allocation or both before and after it. The advantage of doing it before register allocation is that this results in maximum parallelism. The disadvantage of doing it before register allocation is that this can result in the register allocator needing to use a number of registers exceeding those available. This will cause spill/fill code to be introduced, which will reduce the performance of the section of code in question.

If the architecture being scheduled has instruction sequences that have potentially illegal combinations (due to a lack of instruction interlocks), the instructions must be scheduled after register allocation. This second scheduling pass will also improve the placement of the spill/fill code.

If scheduling is only done after register allocation, then there will be false dependencies introduced by the register allocation that will limit the amount of instruction motion possible by the scheduler.

Types

[edit]

There are several types of instruction scheduling:

  1. Local (basic block) scheduling: instructions can't move across basic block boundaries.
  2. Global scheduling: instructions can move across basic block boundaries.
  3. Modulo scheduling: an algorithm for generating software pipelining, which is a way of increasing instruction level parallelism by interleaving different iterations of an inner loop.
  4. Trace scheduling: the first practical approach for global scheduling, trace scheduling tries to optimize the control flow path that is executed most often.
  5. Superblock scheduling: a simplified form of trace scheduling which does not attempt to merge control flow paths at trace "side entrances". Instead, code can be implemented by more than one schedule, vastly simplifying the code generator.

Compiler examples

[edit]

The GNU Compiler Collection is one compiler known to perform instruction scheduling, using the -march (both instruction set and scheduling) or -mtune (only scheduling) flags. It uses descriptions of instruction latencies and what instructions can be run in parallel (or equivalently, which "port" each use) for each microarchitecture to perform the task. This feature is available to almost all architectures that GCC supports.[2]

Until version 12.0.0, the instruction scheduling in LLVM/Clang could only accept a -march (called target-cpu in LLVM parlance) switch for both instruction set and scheduling. Version 12 adds support for -mtune (tune-cpu) for x86 only.[3]

Sources of information on latency and port usage include:

  • GCC and LLVM;
  • Agner Fog, who compiles extensive data for the x86 architecture;[4]
  • InstLatx64, which uses AIDA64 to collect data on x86 CPUs.[5]
  • uops.info, which provides latency, throughput, and port usage information for x86 microarchitectures.[6][7]

LLVM's llvm-exegesis should be usable on all machines, especially to gather information on non-x86 ones.[8]

See also

[edit]

References

[edit]
  1. ^ Su, Ching-Long; Tsui, Chi-Ying; Despain, Alvin M. (1994). Low Power Architecture Design and Compilation Techniques for High-Performance Processors (PDF) (Report). Advanced Computer Architecture Laboratory. ACAL-TR-94-01. (Cold scheduling)
  2. ^ "x86 Options". Using the GNU Compiler Collection (GCC).
  3. ^ "? D85384 [X86] Add basic support for -mtune command line option in clang". reviews.llvm.org.
  4. ^ "Software optimization resources. C++ and assembly. Windows, Linux, BSD, Mac OS X". Agner Fog.
  5. ^ "x86, x64 Instruction Latency, Memory Latency and CPUID dumps". instlatx64.atw.hu. See also the "Comments" link on the page.
  6. ^ uops.info
  7. ^ Abel, Andreas; Reineke, Jan (2019). "uops.info: Characterizing Latency, Throughput, and Port Usage of Instructions on Intel Microarchitectures". ASPLOS '19: Proceedings of the Twenty-Fourth International Conference on Architectural Support for Programming Languages and Operating Systems. International Conference on Architectural Support for Programming Languages and Operating Systems, Providence, RI, USA, April 13–17, 2019. New York, NY, USA: ACM (published April 2019). pp. 673–686. arXiv:1810.04610. doi:10.1145/3297858.3304062. ISBN 978-1-4503-6240-5.
  8. ^ "llvm-exegesis - LLVM Machine Instruction Benchmark". LLVM 12 Documentation.

Further reading

[edit]
总胆固醇低是什么原因 输卵管堵塞吃什么药能打通 峦是什么意思 荔枝可以做什么菜 打边炉是什么意思
艾滋病窗口期是什么意思 怀孕几天后有什么反应 胃大是什么原因造成的 养猫的人容易得什么病 幼儿急疹为什么不能碰水
尿频尿急小腹胀痛吃什么药 指甲上有竖纹是什么原因 手指甲看什么科室 处女座男和什么座最配对 长口腔溃疡是什么原因
老妹是什么意思 言字五行属什么 为什么一喝阿胶睡眠就好了 什么叫打卡 思想包袱是什么意思
单硬脂酸甘油酯是什么hanqikai.com 右腿麻木是什么原因hcv8jop9ns7r.cn 经常流鼻血是什么病hcv9jop5ns9r.cn 白虎女是什么意思hcv8jop2ns9r.cn 做什么生意挣钱hcv9jop1ns4r.cn
担心是什么意思youbangsi.com 月经推迟是什么原因hcv8jop1ns0r.cn 润色是什么意思hcv8jop1ns7r.cn 红血丝用什么护肤品修复比较好hcv8jop6ns7r.cn 全蛋液是什么意思hcv8jop8ns6r.cn
风起云涌是什么生肖hcv9jop1ns7r.cn 眼前发黑是什么原因hcv8jop7ns8r.cn 抽筋是什么原因引起的hcv8jop6ns8r.cn 隔离和防晒有什么区别hcv8jop6ns6r.cn 什么东西越剪越大hcv9jop7ns0r.cn
燕窝是补什么的hcv8jop6ns4r.cn 教师节送什么礼物好liaochangning.com 梦见恐龙是什么预兆hcv8jop0ns1r.cn 34属什么cj623037.com 拉肚子是什么原因引起的hcv8jop3ns5r.cn
百度