File: VectorProcess.hpp

package info (click to toggle)
intel-graphics-compiler 1.0.12504.6-1%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 83,912 kB
  • sloc: cpp: 910,147; lisp: 202,655; ansic: 15,197; python: 4,025; yacc: 2,241; lex: 1,570; pascal: 244; sh: 104; makefile: 25
file content (95 lines) | stat: -rw-r--r-- 3,070 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*========================== begin_copyright_notice ============================

Copyright (C) 2017-2021 Intel Corporation

SPDX-License-Identifier: MIT

============================= end_copyright_notice ===========================*/

#pragma once
#include "Compiler/CISACodeGen/CISACodeGen.h"
#include "Compiler/CodeGenContextWrapper.hpp"
#include "Compiler/CodeGenPublic.h"

namespace llvm
{
    class DataLayout;
    class Type;
    class FunctionPass;
}

namespace IGC
{
    llvm::FunctionPass* createVectorPreProcessPass();
    llvm::FunctionPass* createVectorProcessPass();

    class EmitPass;

    // Used to map vector to its corresponding messages
    class VectorMessage
    {
    public:
        enum MESSAGE_KIND
        {
            MESSAGE_A32_UNTYPED_SURFACE_RW,
            MESSAGE_A32_BYTE_SCATTERED_RW,
            MESSAGE_A64_UNTYPED_SURFACE_RW,
            MESSAGE_A64_SCATTERED_RW,
            MESSAGE_A32_QWORD_SCATTERED_RW,
            MESSAGE_A32_LSC_RW,
            MESSAGE_A64_LSC_RW
        };

        // VECMESSAGEINFO_MAX_LEN:
        //   VectorPreProcess splits larger vectors. After that, the
        //   max vector would be <8 x i32>, which would be 8 insts at
        //   most (when it is unaligned) using byte scattered messages.
        //   Therefore, using 16 would be enough.
        enum
        {
            VECMESSAGEINFO_MAX_LEN = 16,

            // SKL+
            // Exception
            //    BDW : use A64_BYTE_SCATTERED_MAX_BYTES_8B
            //    TGL : no 8DW scattered message.
            //          use A64_SCATTERED_MAX_BYTES_4DW
            A32_UNTYPED_MAX_BYTES = 16,
            A32_BYTE_SCATTERED_MAX_BYTES = 4,
            A64_UNTYPED_MAX_BYTES = 16,
            A64_SCATTERED_MAX_BYTES_8DW_SIMD8 = 32,
            A64_SCATTERED_MAX_BYTES_4DW = 16,
            A64_BYTE_SCATTERED_MAX_BYTES_8B = 8,
            A64_BYTE_SCATTERED_MAX_BYTES = 4,
            A32_A64_BYTE_LSC_LOAD_STORE_MAX_BYTES_SIMD32 = 16,
            A32_A64_BYTE_LSC_LOAD_STORE_MAX_BYTES_SIMD16 = 32,
            A32_A64_BYTE_LSC_LOAD_STORE_MAX_BYTES = 64,
            A32_A64_DATA_SIZE_LSC_LOAD_STORE_MAX_BYTES = 64
        };

        // Calculated by getInfo().
        struct
        {
            MESSAGE_KIND kind;
            uint16_t  startByte;
            VISA_Type blkType;      // type of a block (B, D, Q, etc)
            uint16_t  blkInBytes;   // the block size in bytes
            uint16_t  numBlks;      // the number of blocks
        } insts[VECMESSAGEINFO_MAX_LEN];
        uint16_t  numInsts;

        VectorMessage(EmitPass* emitter);
        VectorMessage(CShader* shader) : Shader(shader) {}
        void getInfo(llvm::Type* Ty, uint64_t Align, bool useA32,
            bool forceByteScatteredRW = false);


        void getLSCInfo(llvm::Type* Ty, uint64_t Align, CodeGenContext* ctx, bool useA32, bool transpose);

    private:
        const CShader *Shader;

        VectorMessage(const VectorMessage&);   // not implemented
        void operator=(const VectorMessage&);  // not implemented
    };
}