1 /* -*- c++ -*- */ 2 /* 3 * Copyright © 2020 Intel Corporation 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining a 6 * copy of this software and associated documentation files (the "Software"), 7 * to deal in the Software without restriction, including without limitation 8 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * and/or sell copies of the Software, and to permit persons to whom the 10 * Software is furnished to do so, subject to the following conditions: 11 * 12 * The above copyright notice and this permission notice (including the next 13 * paragraph) shall be included in all copies or substantial portions of the 14 * Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 22 * IN THE SOFTWARE. 23 */ 24 25 #ifndef BRW_IR_PERFORMANCE_H 26 #define BRW_IR_PERFORMANCE_H 27 28 #include "brw_ir_analysis.h" 29 30 struct fs_visitor; 31 32 namespace brw { 33 /** 34 * Various estimates of the performance of a shader based on static 35 * analysis. 36 */ 37 struct performance { 38 performance(const fs_visitor *v); 39 ~performance(); 40 41 analysis_dependency_class dependency_classperformance42 dependency_class() const 43 { 44 return (DEPENDENCY_INSTRUCTIONS | 45 DEPENDENCY_BLOCKS); 46 } 47 48 bool validateperformance49 validate(const fs_visitor *) const 50 { 51 return true; 52 } 53 54 /** 55 * Array containing estimates of the runtime of each basic block of the 56 * program in cycle units. 57 */ 58 unsigned *block_latency; 59 60 /** 61 * Estimate of the runtime of the whole program in cycle units assuming 62 * uncontended execution. 63 */ 64 unsigned latency; 65 66 /** 67 * Estimate of the throughput of the whole program in 68 * invocations-per-cycle units. 69 * 70 * Note that this might be lower than the ratio between the dispatch 71 * width of the program and its latency estimate in cases where 72 * performance doesn't scale without limits as a function of its thread 73 * parallelism, e.g. due to the existence of a bottleneck in a shared 74 * function. 75 */ 76 float throughput; 77 78 private: 79 performance(const performance &perf); 80 performance & 81 operator=(performance u); 82 }; 83 } 84 85 #endif 86