2022-04-12 20:53:04 +08:00
|
|
|
/*
|
2025-02-18 22:35:36 +08:00
|
|
|
* Copyright (C) 2022-2025 Intel Corporation
|
2022-04-12 20:53:04 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2025-04-08 22:43:25 +08:00
|
|
|
#include "shared/offline_compiler/source/ocloc_fcl_facade.h"
|
2025-02-18 22:35:36 +08:00
|
|
|
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
|
|
|
|
2022-04-12 20:53:04 +08:00
|
|
|
#include "cif/common/cif_main.h"
|
|
|
|
#include "cif/import/library_api.h"
|
|
|
|
#include "ocl_igc_interface/code_type.h"
|
|
|
|
#include "ocl_igc_interface/igc_ocl_device_ctx.h"
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
class OclocArgHelper;
|
|
|
|
|
|
|
|
namespace NEO {
|
|
|
|
|
2022-11-30 22:28:39 +08:00
|
|
|
class CompilerProductHelper;
|
2022-04-12 20:53:04 +08:00
|
|
|
class OsLibrary;
|
|
|
|
|
|
|
|
struct HardwareInfo;
|
|
|
|
|
2025-02-18 22:35:36 +08:00
|
|
|
class OclocIgcFacade : NEO::NonCopyableAndNonMovableClass {
|
2022-04-12 20:53:04 +08:00
|
|
|
public:
|
|
|
|
OclocIgcFacade(OclocArgHelper *argHelper);
|
|
|
|
MOCKABLE_VIRTUAL ~OclocIgcFacade();
|
|
|
|
|
|
|
|
int initialize(const HardwareInfo &hwInfo);
|
|
|
|
bool isInitialized() const;
|
2023-08-21 20:00:06 +08:00
|
|
|
const char *getIgcRevision();
|
|
|
|
size_t getIgcLibSize();
|
|
|
|
time_t getIgcLibMTime();
|
2022-04-12 20:53:04 +08:00
|
|
|
CIF::RAII::UPtr_t<CIF::Builtins::BufferLatest> createConstBuffer(const void *data, size_t size);
|
|
|
|
CIF::RAII::UPtr_t<IGC::IgcOclTranslationCtxTagOCL> createTranslationContext(IGC::CodeType::CodeType_t inType, IGC::CodeType::CodeType_t outType);
|
|
|
|
|
|
|
|
protected:
|
2024-10-15 02:23:13 +08:00
|
|
|
MOCKABLE_VIRTUAL std::unique_ptr<OsLibrary> loadIgcLibrary(const char *libName) const;
|
2022-04-12 20:53:04 +08:00
|
|
|
MOCKABLE_VIRTUAL CIF::CreateCIFMainFunc_t loadCreateIgcMainFunction() const;
|
|
|
|
MOCKABLE_VIRTUAL CIF::RAII::UPtr_t<CIF::CIFMain> createIgcMain(CIF::CreateCIFMainFunc_t createMainFunction) const;
|
|
|
|
MOCKABLE_VIRTUAL bool isIgcInterfaceCompatible(const std::vector<CIF::InterfaceId_t> &interfacesToIgnore) const;
|
|
|
|
MOCKABLE_VIRTUAL std::string getIncompatibleInterface(const std::vector<CIF::InterfaceId_t> &interfacesToIgnore) const;
|
|
|
|
MOCKABLE_VIRTUAL bool isPatchtokenInterfaceSupported() const;
|
2023-08-29 03:09:29 +08:00
|
|
|
MOCKABLE_VIRTUAL CIF::RAII::UPtr_t<IGC::IgcOclDeviceCtx<3>> createIgcDeviceContext3() const;
|
2022-04-12 20:53:04 +08:00
|
|
|
MOCKABLE_VIRTUAL CIF::RAII::UPtr_t<IGC::IgcOclDeviceCtxTagOCL> createIgcDeviceContext() const;
|
|
|
|
MOCKABLE_VIRTUAL CIF::RAII::UPtr_t<IGC::PlatformTagOCL> getIgcPlatformHandle() const;
|
|
|
|
MOCKABLE_VIRTUAL CIF::RAII::UPtr_t<IGC::GTSystemInfoTagOCL> getGTSystemInfoHandle() const;
|
|
|
|
MOCKABLE_VIRTUAL CIF::RAII::UPtr_t<IGC::IgcFeaturesAndWorkaroundsTagOCL> getIgcFeaturesAndWorkaroundsHandle() const;
|
2022-11-30 22:28:39 +08:00
|
|
|
void populateWithFeatures(IGC::IgcFeaturesAndWorkaroundsTagOCL *handle, const HardwareInfo &hwInfo, const CompilerProductHelper *compilerProductHelper) const;
|
2022-04-12 20:53:04 +08:00
|
|
|
|
|
|
|
OclocArgHelper *argHelper{};
|
2023-07-27 20:00:51 +08:00
|
|
|
std::unique_ptr<OsLibrary> igcLib;
|
2023-08-21 20:00:06 +08:00
|
|
|
std::vector<char> igcRevision;
|
|
|
|
size_t igcLibSize{0};
|
|
|
|
time_t igcLibMTime{0};
|
2023-07-27 20:00:51 +08:00
|
|
|
CIF::RAII::UPtr_t<CIF::CIFMain> igcMain;
|
|
|
|
CIF::RAII::UPtr_t<IGC::IgcOclDeviceCtxTagOCL> igcDeviceCtx;
|
2022-04-12 20:53:04 +08:00
|
|
|
bool initialized{false};
|
|
|
|
};
|
|
|
|
|
2025-02-18 22:35:36 +08:00
|
|
|
static_assert(NEO::NonCopyableAndNonMovable<OclocIgcFacade>);
|
|
|
|
|
2025-04-08 22:43:25 +08:00
|
|
|
class OclocIgcAsFcl : public OclocFclFacadeBase {
|
|
|
|
public:
|
|
|
|
OclocIgcAsFcl(OclocArgHelper *argHelper);
|
|
|
|
~OclocIgcAsFcl() override;
|
|
|
|
|
|
|
|
int initialize(const HardwareInfo &hwInfo) override;
|
|
|
|
bool isInitialized() const override;
|
|
|
|
IGC::CodeType::CodeType_t getPreferredIntermediateRepresentation() const override;
|
|
|
|
CIF::RAII::UPtr_t<CIF::Builtins::BufferLatest> createConstBuffer(const void *data, size_t size) override;
|
|
|
|
CIF::RAII::UPtr_t<IGC::OclTranslationOutputTagOCL> translate(IGC::CodeType::CodeType_t inType, IGC::CodeType::CodeType_t outType, CIF::Builtins::BufferLatest *error,
|
|
|
|
CIF::Builtins::BufferSimple *src,
|
|
|
|
CIF::Builtins::BufferSimple *options,
|
|
|
|
CIF::Builtins::BufferSimple *internalOptions,
|
|
|
|
CIF::Builtins::BufferSimple *tracingOptions,
|
|
|
|
uint32_t tracingOptionsCount) override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
IGC::CodeType::CodeType_t preferredIntermediateRepresentation = IGC::CodeType::undefined;
|
|
|
|
std::unique_ptr<OclocIgcFacade> igc;
|
|
|
|
};
|
|
|
|
|
|
|
|
static_assert(NEO::NonCopyableAndNonMovable<OclocIgcAsFcl>);
|
|
|
|
|
2025-02-18 22:35:36 +08:00
|
|
|
} // namespace NEO
|