File: mock_compiler_interface_spirv.cpp

package info (click to toggle)
intel-compute-runtime 25.44.36015.8-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 79,632 kB
  • sloc: cpp: 931,547; lisp: 2,074; sh: 719; makefile: 162; python: 21
file content (33 lines) | stat: -rw-r--r-- 1,164 bytes parent folder | download | duplicates (2)
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
/*
 * Copyright (C) 2021-2023 Intel Corporation
 *
 * SPDX-License-Identifier: MIT
 *
 */

#include "shared/test/common/mocks/mock_compiler_interface_spirv.h"

#include "shared/source/helpers/file_io.h"
#include "shared/test/common/helpers/kernel_binary_helper.h"
#include "shared/test/common/helpers/test_files.h"
#include "shared/test/common/libult/global_environment.h"

namespace NEO {
TranslationOutput::ErrorCode MockCompilerInterfaceSpirv::compile(const NEO::Device &device, const TranslationInput &input, TranslationOutput &output) {
    std::string kernelName;
    retrieveBinaryKernelFilename(kernelName, KernelBinaryHelper::BUILT_INS + "_", ".bin");

    size_t size = 0;
    auto src = loadDataFromFile(
        kernelName.c_str(),
        size);
    output.deviceBinary.mem = std::move(src);
    output.deviceBinary.size = size;
    output.intermediateCodeType = IGC::CodeType::spirV;

    return TranslationOutput::ErrorCode::success;
}
TranslationOutput::ErrorCode MockCompilerInterfaceSpirv::build(const NEO::Device &device, const TranslationInput &input, TranslationOutput &out) {
    return this->compile(device, input, out);
}
} // namespace NEO