Repository navigation
Expand file tree
/
Copy pathTranslation.h
More file actions
45 lines (35 loc) · 1.67 KB
/
Copy pathTranslation.h
File metadata and controls
45 lines (35 loc) · 1.67 KB
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
//===- Translation.h - Translate SYCL images between different formats ----===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#pragma once
#include "JITBinaryInfo.h"
#include "JITContext.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/Error.h"
namespace jit_compiler {
class Translator {
public:
/// Translate `Mod` to the given target format. If the format is PTX or
/// AMDGCN, the optional `KernelName` will be used to determine additional
/// target attributes from the kernel function.
static llvm::Expected<JITBinaryInfo>
translate(llvm::Module &Mod, JITContext &JITCtx, BinaryFormat Format,
const char *KernelName = nullptr);
std::pair<std::string, std::string> static getTargetCPUAndFeatureAttrs(
const llvm::Module *M, const char *KernelName, BinaryFormat Format);
private:
/// Pair of address and size to represent a binary blob.
using BinaryBlob = std::pair<BinaryAddress, size_t>;
static llvm::Expected<JITBinary *> translateToSPIRV(llvm::Module &Mod,
JITContext &JITCtx);
static llvm::Expected<JITBinary *>
translateToPTX(llvm::Module &Mod, JITContext &JITCtx, const char *KernelName);
static llvm::Expected<JITBinary *> translateToAMDGCN(llvm::Module &Mod,
JITContext &JITCtx,
const char *KernelName);
};
} // namespace jit_compiler