Skip to content

Commit

Permalink
Create wrappers for GenXOpts passes
Browse files Browse the repository at this point in the history
.
  • Loading branch information
igorban-intel authored and igcbot committed Nov 12, 2024
1 parent 83f5c59 commit ed453f9
Show file tree
Hide file tree
Showing 48 changed files with 932 additions and 113 deletions.
43 changes: 43 additions & 0 deletions IGC/VectorCompiler/include/GenXPassRegistry.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*========================== begin_copyright_notice ============================

Copyright (C) 2024 Intel Corporation

SPDX-License-Identifier: MIT

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

// NOTE: NO INCLUDE GUARD DESIRED!

#ifndef MODULE_PASS
#define MODULE_PASS(NAME, CREATE_PASS)
#endif

MODULE_PASS("CMABIAnalysis", CMABIAnalysisPass())
MODULE_PASS("GenXPacketize", GenXPacketizePass())
MODULE_PASS("CMImpParam", CMImpParamPass())
MODULE_PASS("CMKernelArgOffset", CMKernelArgOffsetPass())
MODULE_PASS("GenXBIFFlagCtrlResolution", GenXBIFFlagCtrlResolutionPass())
MODULE_PASS("GenXBTIAssignment", GenXBTIAssignmentPass())
MODULE_PASS("GenXImportOCLBiF", GenXImportOCLBiFPass())
MODULE_PASS("GenXLinkageCorruptor", GenXLinkageCorruptorPass())
MODULE_PASS("GenXPrintfLegalization", GenXPrintfLegalizationPass())
MODULE_PASS("GenXPrintfPhiClonning", GenXPrintfPhiClonningPass())
MODULE_PASS("GenXPrintfResolution", GenXPrintfResolutionPass())
MODULE_PASS("GenXTrampolineInsertion", GenXTrampolineInsertionPass())
MODULE_PASS("GenXTranslateSPIRVBuiltins", GenXTranslateSPIRVBuiltinsPass())
MODULE_PASS("CMABI", CMABIPass())
MODULE_PASS("GenXCloneIndirectFunctions", GenXCloneIndirectFunctionsPass())

#undef MODULE_PASS

#ifndef FUNCTION_PASS
#define FUNCTION_PASS(NAME, CREATE_PASS)
#endif

FUNCTION_PASS("GenXSimplify", GenXSimplifyPass())
FUNCTION_PASS("GenXStatePointerFence", GenXStatePointerFencePass())
FUNCTION_PASS("CMLowerVLoadVStore", CMLowerVLoadVStorePass())
FUNCTION_PASS("GenXTypeLegalization", GenXTypeLegalizationPass())
FUNCTION_PASS("GenXTranslateIntrinsics", GenXTranslateIntrinsicsPass())

#undef FUNCTION_PASS
19 changes: 19 additions & 0 deletions IGC/VectorCompiler/include/vc/GenXOpts/CMABI.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*========================== begin_copyright_notice ============================
Copyright (C) 2024 Intel Corporation
SPDX-License-Identifier: MIT
============================= end_copyright_notice ===========================*/
#ifndef GENX_OPTS_CMABI
#define GENX_OPTS_CMABI

namespace llvm {
void initializeCMABIPass(PassRegistry &);
}

struct CMABIPass : public llvm::PassInfoMixin<CMABIPass> {
llvm::PreservedAnalyses run(llvm::Module &M, llvm::ModuleAnalysisManager &AM);
};

#endif // GENX_OPTS_CMABI
17 changes: 17 additions & 0 deletions IGC/VectorCompiler/include/vc/GenXOpts/CMABIAnalysis.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*========================== begin_copyright_notice ============================
Copyright (C) 2024 Intel Corporation
SPDX-License-Identifier: MIT
============================= end_copyright_notice ===========================*/
#ifndef GENX_OPTS_CMABIANALYSIS
#define GENX_OPTS_CMABIANALYSIS

// void initializeCMABIAnalysis(PassRegistry &);

struct CMABIAnalysisPass : public llvm::PassInfoMixin<CMABIAnalysisPass> {
llvm::PreservedAnalyses run(llvm::Module &M, llvm::ModuleAnalysisManager &AM);
};

#endif // GENX_OPTS_CMABIANALYSIS
19 changes: 19 additions & 0 deletions IGC/VectorCompiler/include/vc/GenXOpts/CMImpParam.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*========================== begin_copyright_notice ============================
Copyright (C) 2024 Intel Corporation
SPDX-License-Identifier: MIT
============================= end_copyright_notice ===========================*/
#ifndef GENX_OPTS_CMIMPLPARAM
#define GENX_OPTS_CMIMPLPARAM

namespace llvm {
void initializeCMImpParamPass(PassRegistry &);
}

struct CMImpParamPass : public llvm::PassInfoMixin<CMImpParamPass> {
llvm::PreservedAnalyses run(llvm::Module &M, llvm::ModuleAnalysisManager &AM);
};

#endif // GENX_OPTS_CMIMPLPARAM
20 changes: 20 additions & 0 deletions IGC/VectorCompiler/include/vc/GenXOpts/CMKernelArgOffset.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*========================== begin_copyright_notice ============================
Copyright (C) 2024 Intel Corporation
SPDX-License-Identifier: MIT
============================= end_copyright_notice ===========================*/
#ifndef GENX_OPTS_CM_KERNEL_ARG_OFFSET
#define GENX_OPTS_CM_KERNEL_ARG_OFFSET

namespace llvm {
void initializeCMKernelArgOffsetPass(PassRegistry &);
}

struct CMKernelArgOffsetPass
: public llvm::PassInfoMixin<CMKernelArgOffsetPass> {
llvm::PreservedAnalyses run(llvm::Module &M, llvm::ModuleAnalysisManager &AM);
};

#endif // GENX_OPTS_CM_KERNEL_ARG_OFFSET
21 changes: 21 additions & 0 deletions IGC/VectorCompiler/include/vc/GenXOpts/CMLowerVLoadVStore.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*========================== begin_copyright_notice ============================
Copyright (C) 2024 Intel Corporation
SPDX-License-Identifier: MIT
============================= end_copyright_notice ===========================*/
#ifndef GENX_OPTS_CM_LOWER_VLOAD_VSTORE
#define GENX_OPTS_CM_LOWER_VLOAD_VSTORE

namespace llvm {
void initializeCMLowerVLoadVStorePass(PassRegistry &);
}

struct CMLowerVLoadVStorePass
: public llvm::PassInfoMixin<CMLowerVLoadVStorePass> {
llvm::PreservedAnalyses run(llvm::Function &F,
llvm::FunctionAnalysisManager &AM);
};

#endif // GENX_OPTS_CM_LOWER_VLOAD_VSTORE
20 changes: 20 additions & 0 deletions IGC/VectorCompiler/include/vc/GenXOpts/GenXBIFFlagCtrlResolution.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*========================== begin_copyright_notice ============================
Copyright (C) 2024 Intel Corporation
SPDX-License-Identifier: MIT
============================= end_copyright_notice ===========================*/
#ifndef GENX_OPTS_GENX_BIF_FLAG_CTRL_RESOLUTION
#define GENX_OPTS_GENX_BIF_FLAG_CTRL_RESOLUTION

namespace llvm {
void initializeGenXBIFFlagCtrlResolutionPass(PassRegistry &);
}

struct GenXBIFFlagCtrlResolutionPass
: public llvm::PassInfoMixin<GenXBIFFlagCtrlResolutionPass> {
llvm::PreservedAnalyses run(llvm::Module &M, llvm::ModuleAnalysisManager &AM);
};

#endif // GENX_OPTS_GENX_BIF_FLAG_CTRL_RESOLUTION
20 changes: 20 additions & 0 deletions IGC/VectorCompiler/include/vc/GenXOpts/GenXBTIAssignment.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*========================== begin_copyright_notice ============================
Copyright (C) 2024 Intel Corporation
SPDX-License-Identifier: MIT
============================= end_copyright_notice ===========================*/
#ifndef GENX_OPTS_GENX_BTI_ASSIGNMENT
#define GENX_OPTS_GENX_BTI_ASSIGNMENT

namespace llvm {
void initializeGenXBTIAssignmentPass(PassRegistry &);
}

struct GenXBTIAssignmentPass
: public llvm::PassInfoMixin<GenXBTIAssignmentPass> {
llvm::PreservedAnalyses run(llvm::Module &M, llvm::ModuleAnalysisManager &AM);
};

#endif // GENX_OPTS_GENX_BTI_ASSIGNMENT
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*========================== begin_copyright_notice ============================
Copyright (C) 2024 Intel Corporation
SPDX-License-Identifier: MIT
============================= end_copyright_notice ===========================*/
#ifndef GENX_OPTS_GENX_CLONE_INDERECT_FUNCTIONS
#define GENX_OPTS_GENX_CLONE_INDERECT_FUNCTIONS

namespace llvm {
void initializeGenXCloneIndirectFunctionsPass(PassRegistry &);
}

struct GenXCloneIndirectFunctionsPass
: public llvm::PassInfoMixin<GenXCloneIndirectFunctionsPass> {
llvm::PreservedAnalyses run(llvm::Module &M, llvm::ModuleAnalysisManager &AM);
};

#endif // GENX_OPTS_GENX_CLONE_INDERECT_FUNCTIONS
19 changes: 19 additions & 0 deletions IGC/VectorCompiler/include/vc/GenXOpts/GenXImportOCLBiF.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*========================== begin_copyright_notice ============================
Copyright (C) 2024 Intel Corporation
SPDX-License-Identifier: MIT
============================= end_copyright_notice ===========================*/
#ifndef GENX_OPTS_GENX_IMPORT_OCL_BIF
#define GENX_OPTS_GENX_IMPORT_OCL_BIF

namespace llvm {
void initializeGenXImportOCLBiFPass(PassRegistry &);
}

struct GenXImportOCLBiFPass : public llvm::PassInfoMixin<GenXImportOCLBiFPass> {
llvm::PreservedAnalyses run(llvm::Module &M, llvm::ModuleAnalysisManager &AM);
};

#endif // GENX_OPTS_GENX_IMPORT_OCL_BIF
20 changes: 20 additions & 0 deletions IGC/VectorCompiler/include/vc/GenXOpts/GenXLinkageCorruptor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*========================== begin_copyright_notice ============================
Copyright (C) 2024 Intel Corporation
SPDX-License-Identifier: MIT
============================= end_copyright_notice ===========================*/
#ifndef GENX_OPTS_GENX_LINKAGE_CORRUPTOR
#define GENX_OPTS_GENX_LINKAGE_CORRUPTOR

namespace llvm {
void initializeGenXLinkageCorruptorPass(PassRegistry &);
}

struct GenXLinkageCorruptorPass
: public llvm::PassInfoMixin<GenXLinkageCorruptorPass> {
llvm::PreservedAnalyses run(llvm::Module &M, llvm::ModuleAnalysisManager &AM);
};

#endif // GENX_OPTS_GENX_LINKAGE_CORRUPTOR
93 changes: 6 additions & 87 deletions IGC/VectorCompiler/include/vc/GenXOpts/GenXOpts.h
Original file line number Diff line number Diff line change
@@ -1,99 +1,18 @@
/*========================== begin_copyright_notice ============================
Copyright (C) 2019-2024 Intel Corporation
Copyright (C) 2024 Intel Corporation
SPDX-License-Identifier: MIT
============================= end_copyright_notice ===========================*/

//
// This header file defines prototypes for accessor functions that expose passes
// in the GenX transformations library.
//
//===----------------------------------------------------------------------===//

#ifndef VC_GENXOPTS_GENXOPTS_H
#define VC_GENXOPTS_GENXOPTS_H

namespace llvm {

class FunctionPass;
class ModulePass;
class Pass;
class PassRegistry;

//===----------------------------------------------------------------------===//
//
// CMImpParam - Transforms to enable implicit parameters
//
Pass *createCMImpParamPass(bool);

//===----------------------------------------------------------------------===//
//
// CMKernelArgOffset - Determine offset of each CM kernel argument
//
Pass *createCMKernelArgOffsetPass(unsigned GrfByteSize, bool UseBindlessImages);

//===----------------------------------------------------------------------===//
//
// CMABI - Fix ABI issues for the genx backend.
//
Pass *createCMABIPass();

//===----------------------------------------------------------------------===//
//
// CMLowerVLoadVStore - Lower CM reference loads and stores.
//
Pass *createCMLowerVLoadVStorePass();

FunctionPass *createGenXReduceIntSizePass();
FunctionPass *createGenXRegionCollapsingPass();
FunctionPass *createGenXSimplifyPass();
FunctionPass *createGenXLowerAggrCopiesPass();

ModulePass *createGenXPacketizePass();

void initializeGenXSimplifyPass(PassRegistry &);
void initializeCMABIPass(PassRegistry &);
void initializeCMImpParamPass(PassRegistry &);
void initializeCMKernelArgOffsetPass(PassRegistry &);

ModulePass *createGenXPrintfResolutionPass();
void initializeGenXPrintfResolutionPass(PassRegistry &);

ModulePass *createGenXPrintfPhiClonningPass();
void initializeGenXPrintfPhiClonningPass(PassRegistry &);

ModulePass *createGenXPrintfLegalizationPass();
void initializeGenXPrintfLegalizationPass(PassRegistry &);

ModulePass *createGenXImportOCLBiFPass();
void initializeGenXImportOCLBiFPass(PassRegistry &);

ModulePass *createGenXBIFFlagCtrlResolutionPass();
void initializeGenXBIFFlagCtrlResolutionPass(PassRegistry &);

ModulePass *createGenXBTIAssignmentPass();
void initializeGenXBTIAssignmentPass(PassRegistry &);

ModulePass *createGenXTranslateSPIRVBuiltinsPass();
void initializeGenXTranslateSPIRVBuiltinsPass(PassRegistry &);

ModulePass *createGenXCloneIndirectFunctionsPass();
void initializeGenXCloneIndirectFunctionsPass(PassRegistry &);

ModulePass *createGenXTrampolineInsertionPass();
void initializeGenXTrampolineInsertionPass(PassRegistry &);

ModulePass *createGenXLinkageCorruptorPass();
void initializeGenXLinkageCorruptorPass(PassRegistry &);

FunctionPass *createGenXTranslateIntrinsicsPass();
void initializeGenXTranslateIntrinsicsPass(PassRegistry &);

FunctionPass *createGenXTypeLegalizationPass();
void initializeGenXTypeLegalizationPass(PassRegistry &);

} // End llvm namespace
#if LLVM_VERSION_MAJOR < 16
#include "GenXOptsLegacyPM.h"
#else
#include "GenXOptsNewPM.h"
#endif

#endif // VC_GENXOPTS_GENXOPTS_H
Loading

0 comments on commit ed453f9

Please sign in to comment.