1 /*========================== begin_copyright_notice ============================ 2 3 Copyright (C) 2017-2021 Intel Corporation 4 5 SPDX-License-Identifier: MIT 6 7 ============================= end_copyright_notice ===========================*/ 8 9 #pragma once 10 #include "Compiler/CISACodeGen/CISACodeGen.h" 11 #include "Compiler/CodeGenContextWrapper.hpp" 12 #include "Compiler/CodeGenPublic.h" 13 14 namespace llvm 15 { 16 class DataLayout; 17 class Type; 18 class FunctionPass; 19 } 20 21 namespace IGC 22 { 23 llvm::FunctionPass* createVectorPreProcessPass(); 24 llvm::FunctionPass* createVectorProcessPass(); 25 26 class EmitPass; 27 28 // Used to map vector to its corresponding messages 29 class VectorMessage 30 { 31 public: 32 enum MESSAGE_KIND 33 { 34 MESSAGE_A32_UNTYPED_SURFACE_RW, 35 MESSAGE_A32_BYTE_SCATTERED_RW, 36 MESSAGE_A64_UNTYPED_SURFACE_RW, 37 MESSAGE_A64_SCATTERED_RW, 38 }; 39 40 // VECMESSAGEINFO_MAX_LEN: 41 // VectorPreProcess splits larger vectors. After that, the 42 // max vector would be <8 x i32>, which would be 8 insts at 43 // most (when it is unaligned) using byte scattered messages. 44 // Therefore, using 16 would be enough. 45 enum 46 { 47 VECMESSAGEINFO_MAX_LEN = 16, 48 49 // SKL+ 50 // Exception 51 // BDW : use A64_BYTE_SCATTERED_MAX_BYTES_8B 52 A32_UNTYPED_MAX_BYTES = 16, 53 A32_BYTE_SCATTERED_MAX_BYTES = 4, 54 A64_UNTYPED_MAX_BYTES = 16, 55 A64_SCATTERED_MAX_BYTES_8DW_SIMD8 = 32, 56 A64_SCATTERED_MAX_BYTES_4DW = 16, 57 A64_BYTE_SCATTERED_MAX_BYTES_8B = 8, 58 A64_BYTE_SCATTERED_MAX_BYTES = 4, 59 }; 60 61 // Calculated by getInfo(). 62 struct 63 { 64 MESSAGE_KIND kind; 65 uint16_t startByte; 66 VISA_Type blkType; // type of a block (B, D, Q, etc) 67 uint16_t blkInBytes; // the block size in bytes 68 uint16_t numBlks; // the number of blocks 69 } insts[VECMESSAGEINFO_MAX_LEN]; 70 uint16_t numInsts; 71 VectorMessage(EmitPass * emitter)72 VectorMessage(EmitPass* emitter) : m_emitter(emitter) {} 73 void getInfo(llvm::Type* Ty, uint32_t Align, bool useA32, 74 bool forceByteScatteredRW = false); 75 76 77 78 private: 79 const EmitPass* m_emitter; 80 81 VectorMessage(const VectorMessage&); // not implemented 82 void operator=(const VectorMessage&); // not implemented 83 }; 84 } 85