File: host_ptr_defines.h

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 (73 lines) | stat: -rw-r--r-- 1,504 bytes parent folder | download
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
 * Copyright (C) 2018-2025 Intel Corporation
 *
 * SPDX-License-Identifier: MIT
 *
 */

#pragma once

#include <cinttypes>
#include <cstddef>
#include <limits>

namespace NEO {

struct OsHandle {
    virtual ~OsHandle() = default;

  protected:
    OsHandle() = default;
};
struct ResidencyData;

constexpr int maxFragmentsCount = 3;

enum class FragmentPosition {
    none = 0,
    leading,
    middle,
    trailing
};

enum class RequirementsStatus {
    success = 0,
    fatal
};

struct PartialAllocation {
    FragmentPosition fragmentPosition = FragmentPosition::none;
    const void *allocationPtr = nullptr;
    size_t allocationSize = 0u;
};

struct AllocationRequirements {
    PartialAllocation allocationFragments[maxFragmentsCount];
    uint64_t totalRequiredSize = 0u;
    uint32_t requiredFragmentsCount = 0u;
    uint32_t rootDeviceIndex = std::numeric_limits<uint32_t>::max();
};

struct FragmentStorage {
    const void *fragmentCpuPointer = nullptr;
    size_t fragmentSize = 0;
    int refCount = 0;
    OsHandle *osInternalStorage = nullptr;
    ResidencyData *residency = nullptr;
    bool driverAllocation = false;
};

struct AllocationStorageData {
    OsHandle *osHandleStorage = nullptr;
    size_t fragmentSize = 0;
    const void *cpuPtr = nullptr;
    bool freeTheFragment = false;
    ResidencyData *residency = nullptr;
};

struct OsHandleStorage {
    AllocationStorageData fragmentStorageData[maxFragmentsCount];
    uint32_t fragmentCount = 0;
};

} // namespace NEO