4663600f35
ECR #333753 - Compiler Lib: Added Phases info print to stdout [Reason]: unobviousness when running on different stacks with different options. As a result the reported error logs will always contain this missing info. Works only for !OPENCL_MAINLINE. Works on online & offline paths. [Example]: aoc2 -march=hsail -mdevice=Bonaire -cl-std=CL2.0 HelloWorld_Kernel_cl.cl Advanced Micro Devices Inc. OpenCL Compiler Compiler Version: 3 size: 320 Architecture: hsail Family: CI Device: Bonaire Compiling CL Source: HelloWorld_Kernel_cl.cl Input: HelloWorld_Kernel_cl.cl Output: HelloWorld_Kernel_cl.bin Options: -cl-std=CL2.0 //// added with the change: Phase: OCLFEToSPIR, FE: ClangOCLFrontend, Arch: hsail, OpenCL version: CL2.0 Phase: OCLLinkPhase, Arch: hsail, OpenCL version: CL2.0 Phase: GPUOptPhase, Arch: hsail, OpenCL version: CL2.0 Phase: CodegenPhase, Arch: hsail, OpenCL version: CL2.0 Phase: HSAILAsmPhase, Arch: hsail, OpenCL version: CL2.0 //// The binary was compiled for {hsail-CI-Bonaire}. Compiler log: Saving binary to HelloWorld_Kernel_cl.bin. [Testing]: smoke, smoke_clang, pre check-in [Reviewer]: Leonid Lobachev Affected files ... ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/frontend.hpp#9 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/v0_8/if_acl.cpp#36 edit
103 строки
3.0 KiB
C++
103 строки
3.0 KiB
C++
//
|
|
// Copyright (c) 2008 Advanced Micro Devices, Inc. All rights reserved.
|
|
//
|
|
#ifndef _BE_FRONTEND_HPP_
|
|
#define _BE_FRONTEND_HPP_
|
|
#include <string>
|
|
#include "aclTypes.h"
|
|
#include "compiler_stage.hpp"
|
|
|
|
namespace amdcl
|
|
{
|
|
/*! \addtogroup CompilerLibrary
|
|
*
|
|
* \copydoc amdcl::Frontend
|
|
*
|
|
* @{
|
|
* \brief Interface parent class for the frontend child classes.
|
|
* This class should never be instantiated directly.
|
|
*/
|
|
class Frontend : public LLVMCompilerStage {
|
|
Frontend(Frontend&); // DO NOT IMPLEMENT.
|
|
Frontend(); // DO NOT IMPLEMENT.
|
|
public:
|
|
Frontend(aclCompiler* cl, aclBinary* elf, aclLogFunction log)
|
|
: LLVMCompilerStage(cl, elf, log) {}
|
|
//! Virtual destructer that makes sure everything is cleaned up.
|
|
virtual ~Frontend() {}
|
|
|
|
//! Function that converts from OpenCL singleSrc into
|
|
// OpenCL formatted LLVM-IR stored as a std::string.
|
|
// This function generates a command string for clc to execute.
|
|
virtual int compileCommand(const std::string& singleSrc) = 0;
|
|
|
|
virtual std::string getClassName() = 0;
|
|
}; // class Frontend
|
|
/*@}*/
|
|
|
|
/*! \addtogroup CompilerLibrary
|
|
*
|
|
* \copydoc amdcl::OCLFrontend
|
|
*
|
|
* @{
|
|
* \brief Implementation of the Frontend interface to compile
|
|
* from OpenCL C to LLVM-IR.
|
|
*/
|
|
class OCLFrontend : public Frontend {
|
|
OCLFrontend(OCLFrontend&); // DO NOT IMPLEMENT.
|
|
OCLFrontend(); // DO NOT IMPLEMENT.
|
|
|
|
void appendCLVersionFlag(
|
|
std::stringstream &ss,
|
|
const amd::option::Options *opts);
|
|
|
|
std::string getFrontendCommand(
|
|
aclBinary *elf,
|
|
const std::string &src,
|
|
std::string &logFile,
|
|
std::string &clFile,
|
|
bool preprocessOnly);
|
|
|
|
public:
|
|
OCLFrontend(aclCompiler* cl, aclBinary* elf, aclLogFunction log)
|
|
: Frontend(cl, elf, log) {}
|
|
|
|
virtual ~OCLFrontend() {}
|
|
|
|
//! Function that converts from OpenCL singleSrc into
|
|
// OpenCL formatted LLVM-IR stored as a std::string.
|
|
// This function generates a command string for clc to execute.
|
|
virtual int compileCommand(const std::string& singleSrc);
|
|
|
|
virtual std::string getClassName() {return "OCLFrontend";}
|
|
}; // class OCLFrontend
|
|
/*@}*/
|
|
|
|
|
|
/*! \addtogroup CompilerLibrary
|
|
*
|
|
* \copydoc amdcl::Frontend
|
|
*
|
|
* @{
|
|
* \brief This is the class which calls the clang front-end.
|
|
* This class will be used if user asks for it (By default EDG will be
|
|
* called).
|
|
*/
|
|
class ClangOCLFrontend : public Frontend {
|
|
//! Options to be passed to the ClangOCLFE library.
|
|
|
|
public:
|
|
ClangOCLFrontend(aclCompiler* cl, aclBinary* elf, aclLogFunction log);
|
|
|
|
//! Virtual destructer that makes sure everything is cleaned up.
|
|
virtual ~ClangOCLFrontend() {}
|
|
|
|
//! This function generates a command string for ClangOCLFE to execute.
|
|
virtual int compileCommand(const std::string& singleSrc);
|
|
|
|
virtual std::string getClassName() {return "ClangOCLFrontend";}
|
|
}; // class Frontend
|
|
/*@}*/
|
|
} // namespac amdcl
|
|
#endif // _BE_FRONTEND_HPP_
|